123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291 |
- <?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.mk.store.MkStoreCampMinusDao">
- <resultMap type="com.kmall.admin.entity.mk.store.MkStoreCampMinusEntity" id="mkStoreCampMinusMap">
- <result property="campMinusId" column="camp_minus_id"/>
- <result property="campName" column="camp_name"/>
- <result property="thirdMerchSn" column="third_merch_sn"/>
- <result property="storeId" column="store_id"/>
- <result property="storeTopicId" column="store_topic_id"/>
- <result property="campBegTime" column="camp_beg_time"/>
- <result property="campEndTime" column="camp_end_time"/>
- <result property="campMinusType" column="camp_minus_type"/>
- <result property="minusMode" column="minus_mode"/>
- <result property="applyType" column="apply_type"/>
- <result property="advImgUrl" column="adv_img_url"/>
- <result property="advDesc" column="adv_desc"/>
- <result property="isValid" column="is_valid"/>
- <result property="isPast" column="is_past"/>
- <result property="isStoreShow" column="is_store_show"/>
- <result property="note" column="note"/>
- <result property="createrSn" column="creater_sn"/>
- <result property="createTime" column="create_time"/>
- <result property="moderSn" column="moder_sn"/>
- <result property="modTime" column="mod_time"/>
- <result property="tstm" column="tstm"/>
- <result property="goodsBizType" column="goods_biz_type"/>
- </resultMap>
- <select id="queryObject" resultType="com.kmall.admin.entity.mk.store.MkStoreCampMinusEntity">
- select
- `camp_minus_id`,
- `camp_name`,
- `third_merch_sn`,
- `store_id`,
- `store_topic_id`,
- `camp_beg_time`,
- `camp_end_time`,
- `camp_minus_type`,
- `minus_mode`,
- `apply_type`,
- `adv_img_url`,
- `adv_desc`,
- `is_valid`,
- `is_past`,
- `is_store_show`,
- `note`,
- `creater_sn`,
- `create_time`,
- `moder_sn`,
- `mod_time`,
- `tstm`,
- `goods_biz_type`
- from mk_store_camp_minus
- where camp_minus_id = #{id}
- </select>
- <select id="queryList" resultType="com.kmall.admin.entity.mk.store.MkStoreCampMinusEntity">
- SELECT
- s.store_name 'storeName',
- t.submit_order_num 'submitNum',
- t.browse_num 'browseNum',
- t.act_money 'actMoney',
- m.`camp_minus_id`,
- m.`camp_name`,
- m.`third_merch_sn`,
- m.`store_id`,
- m.`store_topic_id`,
- m.`camp_beg_time`,
- m.`camp_end_time`,
- m.`camp_minus_type`,
- m.`minus_mode`,
- m.`apply_type`,
- m.`adv_img_url`,
- m.`adv_desc`,
- m.`is_valid`,
- m.`is_past`,
- m.`is_store_show`,
- m.`note`,
- m.`creater_sn`,
- m.`create_time`,
- m.`moder_sn`,
- m.`mod_time`,
- m.`tstm`,
- m.`goods_biz_type`
- FROM
- mk_store_camp_minus m
- LEFT JOIN mall_store s ON m.store_id = s.id
- LEFT JOIN mk_store_topic_stat t ON t.store_topic_id = m.store_topic_id
- LEFT JOIN third_merchant_biz tb ON s.third_party_merch_code = tb.third_party_merch_code
- WHERE 1=1
- <if test="campName != null and campName.trim() != ''">
- AND m.camp_name LIKE concat('%',#{campName},'%')
- </if>
- <if test="isPast != null and isPast != ''">
- AND m.is_past = #{isPast}
- </if>
- <if test="storeId != null and storeId != ''">
- AND t.store_id = #{storeId}
- </if>
- <if test="thirdMerchSn != null and thirdMerchSn != ''">
- AND s.third_merch_sn = #{thirdMerchSn}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode != ''">
- AND tb.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- <choose>
- <when test="sidx != null and sidx.trim() != ''">
- order by ${sidx} ${order}
- </when>
- <otherwise>
- order by camp_minus_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_store_camp_minus m
- LEFT JOIN mall_store s ON m.store_id = s.id
- LEFT JOIN mk_store_topic_stat t ON t.store_topic_id = m.store_topic_id
- LEFT JOIN third_merchant_biz tb ON s.third_party_merch_code = tb.third_party_merch_code
- WHERE 1=1
- <if test="campName != null and campName.trim() != ''">
- AND m.camp_name LIKE concat('%',#{campName},'%')
- </if>
- <if test="isPast != null and isPast != ''">
- AND m.is_past = #{isPast}
- </if>
- <if test="storeId != null and storeId != ''">
- AND t.store_id = #{storeId}
- </if>
- <if test="thirdMerchSn != null and thirdMerchSn != ''">
- AND s.third_merch_sn = #{thirdMerchSn}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode != ''">
- AND tb.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- </select>
- <insert id="save" parameterType="com.kmall.admin.entity.mk.store.MkStoreCampMinusEntity" useGeneratedKeys="true" keyProperty="campMinusId">
- insert into mk_store_camp_minus(
- `camp_name`,
- `third_merch_sn`,
- `store_id`,
- `store_topic_id`,
- `camp_beg_time`,
- `camp_end_time`,
- `camp_minus_type`,
- `minus_mode`,
- `apply_type`,
- `adv_img_url`,
- `adv_desc`,
- `is_valid`,
- `is_past`,
- `is_store_show`,
- `note`,
- `creater_sn`,
- `create_time`,
- `moder_sn`,
- `mod_time`,
- `tstm`,
- `goods_biz_type`)
- values(
- #{campName},
- #{thirdMerchSn},
- #{storeId},
- #{storeTopicId},
- #{campBegTime},
- #{campEndTime},
- #{campMinusType},
- #{minusMode},
- #{applyType},
- #{advImgUrl},
- #{advDesc},
- #{isValid},
- #{isPast},
- #{isStoreShow},
- #{note},
- #{createrSn},
- #{createTime},
- #{moderSn},
- #{modTime},
- #{tstm},
- #{goodsBizType})
- </insert>
- <update id="update" parameterType="com.kmall.admin.entity.mk.store.MkStoreCampMinusEntity">
- update mk_store_camp_minus
- <set>
- <if test="campName != null">`camp_name` = #{campName}, </if>
- <if test="thirdMerchSn != null">`third_merch_sn` = #{thirdMerchSn}, </if>
- <if test="storeId != null">`store_id` = #{storeId}, </if>
- <if test="storeTopicId != null">`store_topic_id` = #{storeTopicId}, </if>
- <if test="campBegTime != null">`camp_beg_time` = #{campBegTime}, </if>
- <if test="campEndTime != null">`camp_end_time` = #{campEndTime}, </if>
- <if test="campMinusType != null">`camp_minus_type` = #{campMinusType}, </if>
- <if test="minusMode != null">`minus_mode` = #{minusMode}, </if>
- <if test="applyType != null">`apply_type` = #{applyType}, </if>
- <if test="advImgUrl != null">`adv_img_url` = #{advImgUrl}, </if>
- <if test="advDesc != null">`adv_desc` = #{advDesc}, </if>
- <if test="isValid != null">`is_valid` = #{isValid}, </if>
- <if test="isPast != null">`is_past` = #{isPast}, </if>
- <if test="isStoreShow != null">`is_store_show` = #{isStoreShow}, </if>
- <if test="note != null">`note` = #{note}, </if>
- <if test="createrSn != null">`creater_sn` = #{createrSn}, </if>
- <if test="createTime != null">`create_time` = #{createTime}, </if>
- <if test="moderSn != null">`moder_sn` = #{moderSn}, </if>
- <if test="modTime != null">`mod_time` = #{modTime}, </if>
- <if test="tstm != null">`tstm` = #{tstm}, </if>
- <if test="goodsBizType != null">`goods_biz_type` = #{goodsBizType}</if>
- </set>
- where camp_minus_id = #{campMinusId}
- </update>
- <delete id="delete">
- delete from mk_store_camp_minus where camp_minus_id = #{value}
- </delete>
- <delete id="deleteBatch">
- delete from mk_store_camp_minus where camp_minus_id in
- <foreach item="campMinusId" collection="array" open="(" separator="," close=")">
- #{campMinusId}
- </foreach>
- </delete>
- <select id="queryByGoodsId" resultType="com.kmall.admin.entity.mk.store.MkStoreCampMinusLevelEntity">
- select distinct
- mscml.camp_minus_level_id,
- mscml.camp_minus_type,
- mscml.camp_minus_id,
- mscml.minus_mode,
- mscml.yuan_minus_cond,
- mscml.yuan_minus_pref,
- mscml.piece_minus_conf,
- mscml.piece_minus_pref,
- mscml.piece_minus_each_disc,
- mscml.yuan_disc_cond,
- mscml.yuan_disc_pref,
- mscml.piece_disc_conf,
- mscml.piece_disc_pref,
- mscml.is_valid,
- mscml.note,
- mscml.creater_sn,
- mscml.create_time,
- mscml.moder_sn,
- mscml.mod_time,
- mscml.tstm
- from mk_store_camp_minus mscm
- left join mk_store_camp_minus_goods mscmg on mscmg.camp_minus_id = mscm.camp_minus_id
- left join mk_store_camp_minus_level mscml on mscml.camp_minus_id = mscm.camp_minus_id
- and mscmg.camp_minus_id = mscml.camp_minus_id
- left join mall_product_store_rela rela on mscmg.store_rela_id = rela.id
- where rela.goods_id = #{goodsId} and mscm.camp_beg_time < now() and mscm.camp_end_time > now() and mscm.apply_type != '02'
- </select>
- <select id="queryByStoreId" resultType="com.kmall.admin.entity.mk.store.MkStoreCampMinusEntity">
- select
- camp_minus_id,
- camp_name,
- third_merch_sn,
- store_id,
- store_topic_id,
- camp_beg_time,
- camp_end_time,
- camp_minus_type,
- minus_mode,
- apply_type,
- adv_img_url,
- adv_desc,
- is_valid,
- is_past,
- is_store_show,
- note,
- creater_sn,
- create_time,
- moder_sn,
- mod_time,
- tstm,
- goods_biz_type
- from mk_store_camp_minus mscm
- where mscm.store_id = #{storeId}
- </select>
- </mapper>
|