123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.kmall.admin.dao.MkActivitiesPromotionDao">
- <resultMap type="com.kmall.admin.entity.MkActivitiesPromotionEntity" id="mkActivitiesPromotionMap">
- <result property="mapId" column="map_id"/>
- <result property="productName" column="product_name"/>
- <result property="activityPrice" column="activity_price"/>
- <result property="shopSn" column="shop_sn"/>
- <result property="goodsSn" column="goods_sn"/>
- <result property="barcode" column="barcode"/>
- <result property="productBrand" column="product_brand"/>
- <result property="productSeries" column="product_series"/>
- <result property="mkaId" column="mka_id"/>
- <result property="deadline" column="deadline"/>
- <result property="createTime" column="create_time"/>
- <result property="createrSn" column="creater_sn"/>
- <result property="moderSn" column="moder_sn"/>
- <result property="updateTime" column="update_time"/>
- </resultMap>
- <select id="queryObject" resultType="com.kmall.admin.entity.MkActivitiesPromotionEntity">
- select
- `map_id`,
- `product_name`,
- `activity_price`,
- `shop_sn`,
- `goods_sn`,
- `barcode`,
- `product_brand`,
- `product_series`,
- `mka_id`,
- `deadline`,
- `create_time`,
- `creater_sn`,
- `moder_sn`,
- `update_time`
- from mk_activities_promotion
- where map_id = #{id}
- </select>
- <select id="queryList" resultType="com.kmall.admin.entity.MkActivitiesPromotionEntity">
- select
- `map_id`,
- `product_name`,
- `activity_price`,
- `shop_sn`,
- `goods_sn`,
- `barcode`,
- `product_brand`,
- `product_series`,
- `mka_id`,
- `deadline`,
- `create_time`,
- `creater_sn`,
- `moder_sn`,
- `update_time`
- from mk_activities_promotion
- WHERE 1=1
- <if test="name != null and name.trim() != ''">
- AND barcode LIKE concat('%',#{name},'%')
- </if>
- <if test="storeId != null and storeId.trim() != ''">
- AND shop_sn = #{storeId}
- </if>
- <if test="mkaId != null">
- AND mka_id = #{mkaId}
- </if>
- <choose>
- <when test="sidx != null and sidx.trim() != ''">
- order by ${sidx} ${order}
- </when>
- <otherwise>
- order by map_id desc
- </otherwise>
- </choose>
- <if test="offset != null and limit != null">
- limit #{offset}, #{limit}
- </if>
- </select>
- <select id="queryTotal" resultType="int">
- select count(*) from mk_activities_promotion
- WHERE 1=1
- <if test="name != null and name.trim() != ''">
- AND barcode LIKE concat('%',#{name},'%')
- </if>
- <if test="storeId != null and storeId.trim() != ''">
- AND shop_sn = #{storeId}
- </if>
- <if test="mkaId != null">
- AND mka_id = #{mkaId}
- </if>
- </select>
- <insert id="save" parameterType="com.kmall.admin.entity.MkActivitiesPromotionEntity" useGeneratedKeys="true" keyProperty="mapId">
- insert into mk_activities_promotion(
- `product_name`,
- `activity_price`,
- `shop_sn`,
- `goods_sn`,
- `barcode`,
- `product_brand`,
- `product_series`,
- `mka_id`,
- `deadline`,
- `create_time`,
- `creater_sn`,
- `moder_sn`,
- `update_time`)
- values(
- #{productName},
- #{activityPrice},
- #{shopSn},
- #{goodsSn},
- #{barcode},
- #{productBrand},
- #{productSeries},
- #{mkaId},
- #{deadline},
- #{createTime},
- #{createrSn},
- #{moderSn},
- #{updateTime})
- </insert>
- <update id="update" parameterType="com.kmall.admin.entity.MkActivitiesPromotionEntity">
- update mk_activities_promotion
- <set>
- <if test="productName != null">`product_name` = #{productName}, </if>
- <if test="activityPrice != null">`activity_price` = #{activityPrice}, </if>
- <if test="shopSn != null">`shop_sn` = #{shopSn}, </if>
- <if test="goodsSn != null">`goods_sn` = #{goodsSn}, </if>
- <if test="barcode != null">`barcode` = #{barcode}, </if>
- <if test="productBrand != null">`product_brand` = #{productBrand}, </if>
- <if test="productSeries != null">`product_series` = #{productSeries}, </if>
- <if test="mkaId != null">`mka_id` = #{mkaId}, </if>
- <if test="deadline != null">`deadline` = #{deadline}, </if>
- <if test="createTime != null">`create_time` = #{createTime}, </if>
- <if test="createrSn != null">`creater_sn` = #{createrSn}, </if>
- <if test="moderSn != null">`moder_sn` = #{moderSn}, </if>
- <if test="updateTime != null">`update_time` = #{updateTime}</if>
- </set>
- where map_id = #{mapId}
- </update>
- <delete id="delete">
- delete from mk_activities_promotion where map_id = #{value}
- </delete>
- <delete id="deleteBatch">
- delete from mk_activities_promotion where map_id in
- <foreach item="mapId" collection="array" open="(" separator="," close=")">
- #{mapId}
- </foreach>
- </delete>
- <select id="queryByBarCode" resultType="com.kmall.admin.entity.MkActivitiesPromotionEntity">
- select
- `map_id`,
- `product_name`,
- `activity_price`,
- `shop_sn`,
- `goods_sn`,
- `barcode`,
- `product_brand`,
- `product_series`,
- `mka_id`,
- `deadline`,
- `create_time`,
- `creater_sn`,
- `moder_sn`,
- `update_time`
- from mk_activities_promotion
- where mka_id in (${mkaId})
- and barcode = #{prodBarcode}
- </select>
- <select id="queryByDateAndBarcode" resultType="com.kmall.admin.entity.MkActivitiesPromotionEntity">
- select
- pro.map_id,
- pro.product_name,
- pro.activity_price,
- pro.shop_sn,
- pro.goods_sn,
- pro.barcode,
- pro.product_brand,
- pro.product_series,
- pro.mka_id,
- pro.deadline,
- pro.create_time,
- pro.creater_sn,
- pro.moder_sn,
- pro.update_time
- from mk_activities_promotion pro,
- mk_activities activity
- where pro.mka_id = activity.mka_id
- and pro.barcode = #{prodBarcode}
- and activity.mka_start_time < #{currentTime}
- and activity.mkd_end_time > #{currentTime}
- and activity.mka_topic = #{topic}
- and activity.mka_status = 1
- and activity.mka_store_id = #{storeId}
- </select>
- <update id="updatePriceBySku" >
- update mk_activities_promotion set activity_price = #{updatePrice} where goods_sn = #{sku}
- and mka_id = #{mkaId}
- </update>
- </mapper>
|