|
- <?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.iformall.mapper.WxLevelConfigMapper">
- <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxLevelConfig">
- <id column="id" jdbcType="BIGINT" property="id"/>
- <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
- <result column="points" jdbcType="INTEGER" property="points"/>
- <result column="level" jdbcType="VARCHAR" property="level"/>
- <result column="description" jdbcType="VARCHAR" property="description"/>
- <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
- <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
- <result column="discount_enable" jdbcType="SMALLINT" property="discountEnable"/>
- <result column="capability" jdbcType="VARCHAR" property="capability"/>
- <result column="scale" jdbcType="INTEGER" property="scale"/>
- </resultMap>
-
- <sql id="allColumns">
- wlc.`id`, wlc.`tenant_id`, wlc.`points`, wlc.`level`, wlc.`description`, wlc.`create_date`, wlc.`update_date`, wlc.`discount_enable`, wlc.`capability`,wlc.`scale`
- </sql>
-
- <sql id="dynamicWhereConditions">
- where wlc.`tenant_id` = #{finalTenantId}
-
- <if test=" null != id ">
- and wlc.`id` = #{id}
- </if>
-
- <if test=" null != points ">
- and wlc.`points` = #{points}
- </if>
-
- <if test=" null != level ">
- and wlc.`level` like concat('%', #{level},'%')
- </if>
-
- <if test=" null != description ">
- and wlc.`description` like concat('%', #{description},'%')
- </if>
-
- <if test=" null != createDate ">
- and wlc.`create_date` = #{createDate}
- </if>
-
- <if test=" null != updateDate ">
- and wlc.`update_date` = #{updateDate}
- </if>
-
- <if test=" null != discountEnable ">
- and wlc.`discount_enable` = #{discountEnable}
- </if>
-
-
- <if test=" null != ids ">
- and wlc.id in
- <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
- #{idItem}
- </foreach>
- </if>
- <if test=" null != sortColumns">order by ${sortColumns}</if>
- </sql>
-
- <select id="findList" parameterType="com.iformall.domain.po.WxLevelConfig" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from wx_level_config wlc
- <include refid="dynamicWhereConditions"/>
- </select>
-
- <insert id="insertBatch" parameterType="java.util.List">
- insert into wx_level_config (id, tenant_id, points, level, description, create_date, update_date,
- discount_enable, capability,scale) values
- <foreach collection="list" item="item" index="index" separator=",">
- (#{item.id,jdbcType=BIGINT},
- #{item.finalTenantId,jdbcType=VARCHAR},
- #{item.points,jdbcType=INTEGER},
- #{item.level,jdbcType=VARCHAR},
- #{item.description,jdbcType=VARCHAR},
- #{item.createDate,jdbcType=TIMESTAMP},
- #{item.updateDate,jdbcType=TIMESTAMP},
- #{item.discountEnable,jdbcType=SMALLINT},
- #{item.capability,jdbcType=VARCHAR},
- #{item.scale,jdbcType=INTEGER})
- </foreach>
- </insert>
-
- <!-- <update id="batchUpdate" parameterType="java.util.List">-->
- <update id="batchUpdate" parameterType="com.iformall.domain.po.WxLevelConfig">
- <!-- <foreach collection="list" item="item" index="index" open="" close="" separator=";">-->
- update wx_level_config
- <set>
- <if test=" null != tenantId ">`tenant_id` = #{finalTenantId},</if>
- <if test=" null != points ">`points` = #{points},</if>
- <if test=" null != level ">`level` = #{level},</if>
- <if test=" null != description ">`description` = #{description},</if>
- <if test=" null != updateDate ">`update_date` = #{updateDate},</if>
- <if test=" null != discountEnable ">`discount_enable` = #{discountEnable},</if>
- <if test=" null != capability ">`capability` = #{capability},</if>
- <if test=" null != scale ">`scale` = #{scale},</if>
- </set>
- where id = ${id};
- <!-- </foreach>-->
- </update>
-
- <delete id="deleteAll" parameterType="com.iformall.domain.po.WxLevelConfig">
- delete from wx_level_config where `tenant_id` = #{tenantId};
- </delete>
-
- <select id="getLevel" parameterType="com.iformall.domain.po.WxLevelConfig" resultType="String">
- SELECT `level` FROM `wx_level_config` where tenant_id = #{tenantId} and points <= #{points} ORDER BY points desc LIMIT 1
- </select>
- <select id="getScale" parameterType="com.iformall.domain.po.WxLevelConfig" resultType="java.lang.Integer">
- select `scale` from wx_level_config where tenant_id = #{tenantId} and #{points} >=points order by points desc limit 1 ;
- </select>
-
- </mapper>
|