后台服务
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

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