后台服务
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.

123 lines
4.4 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.WxScoreHistoryMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxScoreHistory">
  5. <id column="id" jdbcType="BIGINT" property="id"/>
  6. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  7. <result column="c_user_id" jdbcType="BIGINT" property="cUserId"/>
  8. <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
  9. <result column="score_type" jdbcType="INTEGER" property="scoreType"/>
  10. <result column="valid_date" jdbcType="TIMESTAMP" property="validDate"/>
  11. <result column="order_id" jdbcType="BIGINT" property="orderId"/>
  12. <result column="pay_type" jdbcType="INTEGER" property="payType"/>
  13. <result column="pay_amount" jdbcType="INTEGER" property="payAmount"/>
  14. <result column="score_amount" jdbcType="INTEGER" property="scoreAmount"/>
  15. <result column="reason" jdbcType="VARCHAR" property="reason"/>
  16. </resultMap>
  17. <sql id="allColumns">
  18. `id`,`tenant_id`,`c_user_id`,`create_date`,`score_type`,`valid_date`,`order_id`,`pay_type`,`pay_amount`,`score_amount`,`reason`
  19. </sql>
  20. <sql id="dynamicWhereConditions">
  21. where 1 = 1
  22. <if test=" null != id ">
  23. and `id` = #{id}
  24. </if>
  25. <if test=" null != tenantId and '' != tenantId">
  26. and `tenant_id` = #{tenantId}
  27. </if>
  28. <if test=" null != cUserId ">
  29. and `c_user_id` = #{cUserId}
  30. </if>
  31. <if test=" null != createDate ">
  32. and `create_date` = #{createDate}
  33. </if>
  34. <if test=" null != scoreType ">
  35. and `score_type` = #{scoreType}
  36. </if>
  37. <if test=" null != validDate ">
  38. and `valid_date` = #{validDate}
  39. </if>
  40. <if test=" null != orderId ">
  41. and `order_id` = #{orderId}
  42. </if>
  43. <if test=" null != payType ">
  44. and `pay_type` = #{payType}
  45. </if>
  46. <if test=" null != payAmount ">
  47. and `pay_amount` = #{payAmount}
  48. </if>
  49. <if test=" null != scoreAmount ">
  50. and `score_amount` = #{scoreAmount}
  51. </if>
  52. <if test=" null != reason ">
  53. and `reason` = #{reason}
  54. </if>
  55. <if test=" null != startdate and null!=enddate">
  56. and `create_date` between #{startdate} and #{enddate}
  57. </if>
  58. <if test=" null != ids ">
  59. and id in
  60. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  61. #{idItem}
  62. </foreach>
  63. </if>
  64. <if test=" null != sortColumns">order by ${sortColumns}</if>
  65. </sql>
  66. <select id="findList" parameterType="com.iformall.domain.po.WxScoreHistory" resultMap="BaseResultMap">
  67. select
  68. <include refid="allColumns"/>
  69. from wx_score_history
  70. <include refid="dynamicWhereConditions"/>
  71. </select>
  72. <select id="selectById" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  73. select <include refid="allColumns"/> from wx_score_history where id = #{id} and tenant_id = #{tenantId}
  74. </select>
  75. <select id="countTodayList" parameterType="com.iformall.domain.po.WxScoreHistory" resultType="java.lang.Integer">
  76. select count(1)
  77. from wx_score_history
  78. where tenant_id = #{tenantId}
  79. <if test=" null != cUserId ">
  80. and `c_user_id` = #{cUserId}
  81. </if>
  82. <if test=" null != scoreType ">
  83. and `score_type` = #{scoreType}
  84. </if>
  85. and DATEDIFF(`create_date`,now())=0
  86. </select>
  87. <select id="countList" parameterType="com.iformall.domain.po.WxScoreHistory" resultType="java.lang.Integer">
  88. select count(1)
  89. from wx_score_history
  90. where 1=1
  91. <if test=" null != tenantId and '' != tenantId">
  92. and `tenant_id` = #{tenantId}
  93. </if>
  94. <if test=" null != cUserId ">
  95. and `c_user_id` = #{cUserId}
  96. </if>
  97. <if test=" null != scoreType ">
  98. and `score_type` = #{scoreType}
  99. </if>
  100. </select>
  101. <delete id="deleteById" parameterType="java.util.HashMap">
  102. delete from wx_score_history where id = #{id} and tenant_id = #{tenantId}
  103. </delete>
  104. </mapper>