Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 

120 righe
5.1 KiB

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.iformall.mapper.WxLevelConfigMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxLevelConfig">
  5. <id column="id" jdbcType="BIGINT" property="id"/>
  6. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  7. <result column="points" jdbcType="INTEGER" property="points"/>
  8. <result column="level" jdbcType="VARCHAR" property="level"/>
  9. <result column="description" jdbcType="VARCHAR" property="description"/>
  10. <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
  11. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
  12. <result column="discount_enable" jdbcType="SMALLINT" property="discountEnable"/>
  13. <result column="capability" jdbcType="VARCHAR" property="capability"/>
  14. <result column="scale" jdbcType="INTEGER" property="scale"/>
  15. </resultMap>
  16. <sql id="allColumns">
  17. wlc.`id`, wlc.`tenant_id`, wlc.`points`, wlc.`level`, wlc.`description`, wlc.`create_date`, wlc.`update_date`, wlc.`discount_enable`, wlc.`capability`,wlc.`scale`
  18. </sql>
  19. <sql id="dynamicWhereConditions">
  20. where 1 = 1
  21. <if test=" null != id ">
  22. and wlc.`id` = #{id}
  23. </if>
  24. <if test=" null != tenantId and '' != tenantId">
  25. and wlc.`tenant_id` = #{tenantId}
  26. </if>
  27. <if test=" null != points ">
  28. and wlc.`points` = #{points}
  29. </if>
  30. <if test=" null != level ">
  31. and wlc.`level` like concat('%', #{level},'%')
  32. </if>
  33. <if test=" null != description ">
  34. and wlc.`description` like concat('%', #{description},'%')
  35. </if>
  36. <if test=" null != createDate ">
  37. and wlc.`create_date` = #{createDate}
  38. </if>
  39. <if test=" null != updateDate ">
  40. and wlc.`update_date` = #{updateDate}
  41. </if>
  42. <if test=" null != discountEnable ">
  43. and wlc.`discount_enable` = #{discountEnable}
  44. </if>
  45. <if test=" null != ids ">
  46. and wlc.id in
  47. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  48. #{idItem}
  49. </foreach>
  50. </if>
  51. <if test=" null != sortColumns">order by ${sortColumns}</if>
  52. </sql>
  53. <select id="findList" parameterType="com.iformall.domain.po.WxLevelConfig" resultMap="BaseResultMap">
  54. select
  55. <include refid="allColumns"/>
  56. from wx_level_config wlc
  57. <include refid="dynamicWhereConditions"/>
  58. </select>
  59. <insert id="insertBatch" parameterType="java.util.List">
  60. insert into wx_level_config (id, tenant_id, points, level, description, create_date, update_date,
  61. discount_enable, capability,scale) values
  62. <foreach collection="list" item="item" index="index" separator=",">
  63. (#{item.id,jdbcType=BIGINT},
  64. #{item.tenantId,jdbcType=VARCHAR},
  65. #{item.points,jdbcType=INTEGER},
  66. #{item.level,jdbcType=VARCHAR},
  67. #{item.description,jdbcType=VARCHAR},
  68. #{item.createDate,jdbcType=TIMESTAMP},
  69. #{item.updateDate,jdbcType=TIMESTAMP},
  70. #{item.discountEnable,jdbcType=SMALLINT},
  71. #{item.capability,jdbcType=VARCHAR},
  72. #{item.scale,jdbcType=INTEGER})
  73. </foreach>
  74. </insert>
  75. <!-- <update id="batchUpdate" parameterType="java.util.List">-->
  76. <update id="batchUpdate" parameterType="com.iformall.domain.po.WxLevelConfig">
  77. <!-- <foreach collection="list" item="item" index="index" open="" close="" separator=";">-->
  78. update wx_level_config
  79. <set>
  80. <if test=" null != tenantId ">`tenant_id` = #{tenantId},</if>
  81. <if test=" null != points ">`points` = #{points},</if>
  82. <if test=" null != level ">`level` = #{level},</if>
  83. <if test=" null != description ">`description` = #{description},</if>
  84. <if test=" null != updateDate ">`update_date` = #{updateDate},</if>
  85. <if test=" null != discountEnable ">`discount_enable` = #{discountEnable},</if>
  86. <if test=" null != capability ">`capability` = #{capability},</if>
  87. <if test=" null != scale ">`scale` = #{scale},</if>
  88. </set>
  89. where id = ${item.id};
  90. <!-- </foreach>-->
  91. </update>
  92. <delete id="deleteAll" parameterType="com.iformall.domain.po.WxLevelConfig">
  93. delete from wx_level_config where `tenant_id` = #{tenantId};
  94. </delete>
  95. <select id="getLevel" parameterType="com.iformall.domain.po.WxLevelConfig" resultType="String">
  96. SELECT `level` FROM `wx_level_config` where tenant_id = #{tenantId} and points &lt;= #{points} ORDER BY points desc LIMIT 1
  97. </select>
  98. <select id="getScale" parameterType="com.iformall.domain.po.WxLevelConfig" resultType="java.lang.Integer">
  99. select `scale` from wx_level_config where #{points} &gt;=points and tenant_id = #{tenantId} order by points desc limit 1 ;
  100. </select>
  101. </mapper>