后台服务
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

WxMsgLimitMapper.xml 3.0 KiB

2 年之前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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.WxMsgLimitMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxMsgLimit">
  5. <id column="id" jdbcType="BIGINT" property="id"/>
  6. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  7. <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" />
  8. <result column="type" jdbcType="INTEGER" property="type"/>
  9. <result column="limit_id" jdbcType="VARCHAR" property="limitId"/>
  10. <result column="limit_num" jdbcType="INTEGER" property="limitNum"/>
  11. <result column="limit_date" jdbcType="TIMESTAMP" property="limitDate"/>
  12. </resultMap>
  13. <sql id="allColumns">
  14. `id`,`tenant_id`,`parent_tenant_id`,`type`,`limit_id`,`limit_num`,`limit_date`
  15. </sql>
  16. <sql id="dynamicWhereConditions">
  17. where 1 = 1
  18. <if test=" null != id ">
  19. and `id` = #{id}
  20. </if>
  21. <if test=" null != tenantId and '' != tenantId">
  22. and `tenant_id` = #{tenantId}
  23. </if>
  24. <if test=" null != parentTenantId and '' != parentTenantId">
  25. and `parent_tenant_id` = #{parentTenantId}
  26. </if>
  27. <if test=" null != type ">
  28. and `type` = #{type}
  29. </if>
  30. <if test=" null != limitId ">
  31. and `limit_id` = #{limitId}
  32. </if>
  33. <if test=" null != limitNum ">
  34. and `limitNum` = #{limitNum}
  35. </if>
  36. <if test=" null != limitDate ">
  37. and `limit_date` = #{limitDate}
  38. </if>
  39. <if test=" null != expireDate ">
  40. and `limit_date` > #{expireDate}
  41. </if>
  42. <if test=" null != ids ">
  43. and 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.WxMsgLimit" resultMap="BaseResultMap">
  51. select
  52. <include refid="allColumns"/>
  53. from wx_msg_limit
  54. <include refid="dynamicWhereConditions"/>
  55. </select>
  56. <update id="updateLimitNum" parameterType="com.iformall.domain.po.WxMsgLimit">
  57. update wx_msg_limit set limit_num = limit_num - 1 where `id` = #{id}
  58. <if test=" null != tenantId and '' != tenantId">
  59. and `tenant_id` = #{tenantId}
  60. </if>
  61. <if test=" null != parentTenantId and '' != parentTenantId">
  62. and `parent_tenant_id` = #{parentTenantId}
  63. </if>
  64. and limit_num > 0
  65. </update>
  66. <delete id="delLimitNum" parameterType="com.iformall.domain.po.WxMsgLimit">
  67. delete from wx_msg_limit
  68. where `tenant_id` = #{tenantId} and `type`= #{type} and `limit_id` = #{limitId}
  69. </delete>
  70. </mapper>