Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 

123 строки
5.3 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 != parentTenantId and '' != parentTenantId">
  28. and wm.`parent_tenant_id` = #{parentTenantId}
  29. </if>
  30. <if test=" null != points ">
  31. and wlc.`points` = #{points}
  32. </if>
  33. <if test=" null != level ">
  34. and wlc.`level` like concat('%', #{level},'%')
  35. </if>
  36. <if test=" null != description ">
  37. and wlc.`description` like concat('%', #{description},'%')
  38. </if>
  39. <if test=" null != createDate ">
  40. and wlc.`create_date` = #{createDate}
  41. </if>
  42. <if test=" null != updateDate ">
  43. and wlc.`update_date` = #{updateDate}
  44. </if>
  45. <if test=" null != discountEnable ">
  46. and wlc.`discount_enable` = #{discountEnable}
  47. </if>
  48. <if test=" null != ids ">
  49. and wlc.id in
  50. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  51. #{idItem}
  52. </foreach>
  53. </if>
  54. <if test=" null != sortColumns">order by ${sortColumns}</if>
  55. </sql>
  56. <select id="findList" parameterType="com.iformall.domain.po.WxLevelConfig" resultMap="BaseResultMap">
  57. select
  58. <include refid="allColumns"/>
  59. from wx_level_config wlc
  60. left join wx_mall wm on wm.tenant_id = wlc.tenant_id
  61. <include refid="dynamicWhereConditions"/>
  62. </select>
  63. <insert id="insertBatch" parameterType="java.util.List">
  64. insert into wx_level_config (id, tenant_id, points, level, description, create_date, update_date,
  65. discount_enable, capability,scale) values
  66. <foreach collection="list" item="item" index="index" separator=",">
  67. (#{item.id,jdbcType=BIGINT},
  68. #{item.tenantId,jdbcType=VARCHAR},
  69. #{item.points,jdbcType=INTEGER},
  70. #{item.level,jdbcType=VARCHAR},
  71. #{item.description,jdbcType=VARCHAR},
  72. #{item.createDate,jdbcType=TIMESTAMP},
  73. #{item.updateDate,jdbcType=TIMESTAMP},
  74. #{item.discountEnable,jdbcType=SMALLINT},
  75. #{item.capability,jdbcType=VARCHAR},
  76. #{item.scale,jdbcType=INTEGER})
  77. </foreach>
  78. </insert>
  79. <update id="batchUpdate" parameterType="java.util.List">
  80. <foreach collection="list" item="item" index="index" open="" close="" separator=";">
  81. update wx_level_config
  82. <set>
  83. <if test=" null != item.tenantId ">`tenant_id` = #{item.tenantId},</if>
  84. <if test=" null != item.points ">`points` = #{item.points},</if>
  85. <if test=" null != item.level ">`level` = #{item.level},</if>
  86. <if test=" null != item.description ">`description` = #{item.description},</if>
  87. <if test=" null != item.updateDate ">`update_date` = #{item.updateDate},</if>
  88. <if test=" null != item.discountEnable ">`discount_enable` = #{item.discountEnable},</if>
  89. <if test=" null != item.capability ">`capability` = #{item.capability},</if>
  90. <if test=" null != item.scale ">`scale` = #{item.scale},</if>
  91. </set>
  92. where id = ${item.id}
  93. </foreach>
  94. </update>
  95. <delete id="deleteAll" parameterType="com.iformall.domain.po.WxLevelConfig">
  96. delete from wx_level_config where `tenant_id` = #{tenantId};
  97. </delete>
  98. <select id="getLevel" parameterType="com.iformall.domain.po.WxLevelConfig" resultType="String">
  99. SELECT `level` FROM `wx_level_config` where tenant_id=#{tenantId} and points &lt;= #{points} ORDER BY points desc LIMIT 1
  100. </select>
  101. <select id="getScale" parameterType="com.iformall.domain.po.WxLevelConfig" resultType="java.lang.Integer">
  102. select `scale` from wx_level_config where #{points} &gt;=points and tenant_id=#{tenantId} order by points desc limit 1 ;
  103. </select>
  104. </mapper>