123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288 |
- <?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.vip.Mall2PointsRulesDao">
- <resultMap type="com.kmall.admin.entity.vip.Mall2PointsRulesEntity" id="mall2PointsRulesMap">
- <result property="mprId" column="mpr_id"/>
- <result property="pointsType" column="points_type"/>
- <result property="pointsBeginTime" column="points_begin_time"/>
- <result property="pointsEndTime" column="points_end_time"/>
- <result property="isValid" column="is_valid"/>
- <result property="ratio" column="ratio"/>
- <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"/>
- </resultMap>
- <select id="queryObject" resultType="com.kmall.admin.entity.vip.Mall2PointsRulesEntity">
- select
- `mpr_id`,
- `points_type` as pointsType,
- `ratio`,
- `points_begin_time`,
- `points_end_time`,
- `is_valid`,
- `creater_sn`,
- `create_time`,
- `moder_sn`,
- `mod_time`,
- `tstm`
- from mall2_points_rules
- where mpr_id = #{id}
- </select>
- <select id="queryList" resultType="com.kmall.admin.entity.vip.Mall2PointsRulesEntity">
- select
- `mpr_id`,
- `points_type`,
- `ratio`,
- `points_begin_time`,
- `points_end_time`,
- `is_valid`,
- `creater_sn`,
- `create_time`,
- `moder_sn`,
- `mod_time`,
- `tstm`
- from mall2_points_rules
- WHERE 1=1
- <if test="name != null and name.trim() != ''">
- AND points_type = #{name}
- </if>
- <choose>
- <when test="sidx != null and sidx.trim() != ''">
- order by ${sidx} ${order}
- </when>
- <otherwise>
- order by mpr_id desc
- </otherwise>
- </choose>
- <if test="offset != null and limit != null">
- limit #{offset}, #{limit}
- </if>
- </select>
- <select id="queryTotal" resultType="int">
- select count(*) from mall2_points_rules
- WHERE 1=1
- <if test="name != null and name.trim() != ''">
- AND points_type = #{name}
- </if>
- </select>
- <insert id="save" parameterType="com.kmall.admin.entity.vip.Mall2PointsRulesEntity" useGeneratedKeys="true" keyProperty="id">
- insert into mall2_points_rules(
- `mpr_id`,
- `points_type`,
- `ratio`,
- `points_begin_time`,
- `points_end_time`,
- `is_valid`,
- `creater_sn`,
- `create_time`,
- `moder_sn`,
- `mod_time`,
- `tstm`)
- values(
- #{mprId},
- #{pointsType},
- #{ratio},
- #{pointsBeginTime},
- #{pointsEndTime},
- #{isValid},
- #{createrSn},
- #{createTime},
- #{moderSn},
- #{modTime},
- #{tstm})
- </insert>
- <update id="update" parameterType="com.kmall.admin.entity.vip.Mall2PointsRulesEntity">
- update mall2_points_rules
- <set>
- <if test="pointsType != null">`points_type` = #{pointsType}, </if>
- <if test="pointsBeginTime != null">`points_begin_time` = #{pointsBeginTime}, </if>
- <if test="pointsEndTime != null">`points_end_time` = #{pointsEndTime}, </if>
- <if test="isValid != null">`is_valid` = #{isValid}, </if>
- <if test="ratio != null">`ratio` = #{ratio}, </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>
- </set>
- where mpr_id = #{mprId}
- </update>
- <delete id="delete">
- delete from mall2_points_rules where mpr_id = #{value}
- </delete>
- <delete id="deleteBatch">
- delete from mall2_points_rules where mpr_id in
- <foreach item="mprId" collection="array" open="(" separator="," close=")">
- #{mprId}
- </foreach>
- </delete>
-
- <select id="queryRulesDetilId" parameterType="java.lang.Long" resultType="java.lang.Integer">
- select points_type from mall2_points_rules where mpr_id=#{mkaId}
- </select>
- <select id="queryListByTime" resultType="com.kmall.admin.haikong.vo.PointsRulesAndDetailVO">
- select
- mpr.`mpr_id` as mprId,
- mpr.`points_type` as pointsType,
- mpr.`points_begin_time` as pointsBeginTime,
- mpr.`points_end_time` as pointsEndTime,
- mpr.`is_valid` as isValid,
- mpr.`ratio` as ratio,
- mpr.`creater_sn` as createrSn,
- mpr.`create_time` as createTime,
- mpr.`moder_sn` as moderSn,
- mpr.`mod_time` as modTime,
- mpr.`tstm` as tstm,
- mprs.`id` as id,
- mprs.`father_id` as fatherId,
- mprs.`points_rules_type` as pointRulesType,
- mprs.`points_detil_name` as pointsDetailName,
- mprs.`points_detil_name_id` as pointsDetailNameId,
- mprs.`points_store_name` as pointsStoreName,
- mprs.`points_store_id` as pointsStoreId,
- mprs.`remark` as remark
- from mall2_points_rules mpr
- left join mall2_points_rules_detil mprs on mpr.mpr_id = mprs.father_id
- where mprs.id is not null and mpr.is_valid = 0 and mpr.points_begin_time <= #{nowTime} and mpr.points_end_time >= #{nowTime}
- and mprs.points_store_id = #{pointsStoreId}
- order by mpr.points_type desc
- </select>
- <select id="queryListBy" resultType="com.kmall.admin.haikong.vo.PointsRulesAndDetailVO" parameterType="com.kmall.admin.dto.Mall2PointsRulesDto">
- select
- mpr.`mpr_id` as mprId,
- mpr.`points_type` as pointsType,
- mpr.`points_begin_time` as pointsBeginTime,
- mpr.`points_end_time` as pointsEndTime,
- mpr.`is_valid` as isValid,
- mpr.`ratio` as ratio,
- mpr.`creater_sn` as createrSn,
- mpr.`create_time` as createTime,
- mpr.`moder_sn` as moderSn,
- mpr.`mod_time` as modTime,
- mpr.`tstm` as tstm,
- mprs.`id` as id,
- mprs.`father_id` as fatherId,
- mprs.`points_rules_type` as pointRulesType,
- mprs.`points_detil_name` as pointsDetailName,
- mprs.`points_detil_name_id` as pointsDetailNameId,
- mprs.`points_store_name` as pointsStoreName,
- mprs.`points_store_id` as pointsStoreId,
- mprs.`remark` as remark
- from mall2_points_rules mpr
- left join mall2_points_rules_detil mprs on mpr.mpr_id = mprs.father_id
- <where>
- <if test="pointsType!=null">
- and mpr.points_type=#{pointsType}
- </if>
- <if test="isValid!=null">
- and mpr.is_valid=#{isValid}
- </if>
- <if test="nowTime!=null">
- and mpr.points_begin_time <= #{nowTime} and mpr.points_end_time >= #{nowTime}
- </if>
- <if test="pointsStoreId!=null">
- and mprs.points_store_id =#{pointsStoreId}
- </if>
- </where>
- order by mpr.points_type desc
- </select>
- <insert id="saveMall2PointsRulesDetil" parameterType="com.kmall.admin.dto.Mall2RulesDto">
- insert into mall2_points_rules_detil(
- father_id,
- points_rules_type,
- points_detil_name,
- points_detil_name_id,
- points_store_name,
- points_store_id)
- values
- <foreach collection="list" item="item" separator=",">
- (
- #{item.mkaId},
- #{item.pointsRulesType},
- #{item.pointsRulesName},
- #{item.rulesId},
- #{item.storeName},
- #{item.storeId}
- )
- </foreach>
- </insert>
- <update id="updateMall2PointsRulesDetil" parameterType="com.kmall.admin.dto.Mall2RulesDto">
- <foreach collection="list" item="item" separator=";">
- update mall2_points_rules_detil
- <set>
- <if test="item.mkaId != null and item.mkaId !=''">
- father_id=#{item.mkaId},
- </if>
- <if test="item.pointsRulesType != null and item.pointsRulesType !=''">
- points_rules_type=#{item.pointsRulesType},
- </if>
- <if test="item.rulesId != null and item.rulesId !=''">
- points_detil_name=#{item.pointsRulesName},
- </if>
- <if test="item.pointsRulesName != null and item.pointsRulesName !=''">
- points_detil_name_id=#{item.rulesId},
- </if>
- <if test="item.storeName != null and item.storeName !=''">
- points_store_name=#{item.storeName},
- </if>
- <if test="item.storeId != null and item.storeId !=''">
- points_store_id=#{item.storeId}
- </if>
- </set>
- where id=#{item.id}
- </foreach>
- </update>
- <select id="querymall2PointsRulesDetil" resultType="com.kmall.admin.dto.Mall2RulesDto">
- select
- id,
- father_id as mkaId,
- points_rules_type as rulesType,
- points_detil_name as pointsRulesName,
- points_store_name as storeName,
- points_detil_name_id as rulesId
- from mall2_points_rules_detil
- WHERE
- father_id = #{mkaId}
- <if test="pointsDetilNameId !=null and pointsDetilNameId !=''">
- and points_detil_name_id=#{pointsDetilNameId}
- </if>
- <if test="pointsDetilName !=null and pointsDetilName !=''">
- and points_detil_name=#{pointsDetilName}
- </if>
- <if test="storeName !=null and storeName !=''">
- and points_store_name=#{storeName}
- </if>
- <if test="offset != null and limit != null">
- limit #{offset}, #{limit}
- </if>
- </select>
- <select id="querymall2PointsRulesDetilTotal" parameterType="java.lang.Long" resultType="java.lang.Integer">
- select count(*) from mall2_points_rules_detil
- where father_id = #{id}
- </select>
- <delete id="deleteRulesDetil">
- delete from mall2_points_rules_detil where id in
- <foreach item="mprId" collection="array" open="(" separator="," close=")">
- #{mprId}
- </foreach>
- </delete>
- </mapper>
|