SysSmsLogDao.xml 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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.kmall.admin.fromcomm.dao.SysSmsLogDao">
  4. <resultMap type="com.kmall.manager.entity.SysSmsLogEntity" id="smsLogMap">
  5. <result property="id" column="id"/>
  6. <result property="userId" column="user_id"/>
  7. <result property="content" column="content"/>
  8. <result property="mobile" column="mobile"/>
  9. <result property="storeId" column="store_id"/>
  10. <result property="merchSn" column="merch_sn"/>
  11. <result property="stime" column="stime"/>
  12. <result property="sign" column="sign"/>
  13. <result property="type" column="type"/>
  14. <result property="extno" column="extno"/>
  15. <result property="sendStatus" column="send_status"/>
  16. <result property="sendId" column="send_id"/>
  17. <result property="invalidNum" column="invalid_num"/>
  18. <result property="successNum" column="success_num"/>
  19. <result property="blackNum" column="black_num"/>
  20. <result property="returnMsg" column="return_msg"/>
  21. <result property="smsode" column="sms_code"/>
  22. </resultMap>
  23. <select id="queryObject" resultType="com.kmall.manager.entity.SysSmsLogEntity">
  24. select
  25. `id`,
  26. `user_id`,
  27. `content`,
  28. `mobile`,
  29. `store_id`,
  30. `merch_sn`,
  31. `stime`,
  32. `sign`,
  33. `type`,
  34. `extno`,
  35. `send_status`,
  36. `send_id`,
  37. `invalid_num`,
  38. `success_num`,
  39. `black_num`,
  40. `return_msg`,
  41. sms_code
  42. from sys_sms_log
  43. where id = #{id}
  44. </select>
  45. <select id="queryList" resultType="com.kmall.manager.entity.SysSmsLogEntity">
  46. select
  47. sys_sms_log.id,
  48. sys_sms_log.user_id,
  49. sys_sms_log.content,
  50. sys_sms_log.mobile,
  51. sys_sms_log.store_id,
  52. sys_sms_log.merch_sn,
  53. sys_sms_log.stime,
  54. sys_sms_log.sign,
  55. sys_sms_log.type,
  56. sys_sms_log.extno,
  57. sys_sms_log.send_status,
  58. sys_sms_log.send_id,
  59. sys_sms_log.invalid_num,
  60. sys_sms_log.success_num,
  61. sys_sms_log.black_num,
  62. sys_sms_log.return_msg,
  63. sys_sms_log.sms_code,
  64. mall_user.nickname user_name
  65. from sys_sms_log
  66. LEFT JOIN mall_user ON mall_user.id = sys_sms_log.user_id
  67. left join mall_store s on sys_sms_log.store_id = s.id
  68. WHERE 1=1
  69. <if test="storeId != null and storeId != ''">
  70. AND sys_sms_log.store_id = #{storeId}
  71. </if>
  72. <if test="merchSn != null and merchSn.trim() != ''">
  73. AND sys_sms_log.merch_sn = #{merchSn}
  74. </if>
  75. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  76. AND s.third_party_merch_code = #{thirdPartyMerchCode}
  77. </if>
  78. <if test="sendId != null and sendId != ''">
  79. AND sys_sms_log.send_id LIKE concat('%',#{sendId},'%')
  80. </if>
  81. <choose>
  82. <when test="sidx != null and sidx.trim() != ''">
  83. order by ${sidx} ${order}
  84. </when>
  85. <otherwise>
  86. order by stime DESC
  87. </otherwise>
  88. </choose>
  89. <if test="offset != null and limit != null">
  90. limit #{offset}, #{limit}
  91. </if>
  92. </select>
  93. <select id="queryTotal" resultType="int">
  94. select count(*) from sys_sms_log
  95. left join mall_store s on sys_sms_log.store_id = s.id
  96. WHERE 1=1
  97. <if test="storeId != null and storeId != ''">
  98. AND sys_sms_log.store_id = #{storeId}
  99. </if>
  100. <if test="merchSn != null and merchSn.trim() != ''">
  101. AND sys_sms_log.merch_sn = #{merchSn}
  102. </if>
  103. <if test="sendId != null and sendId != ''">
  104. AND send_id LIKE concat('%',#{sendId},'%')
  105. </if>
  106. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  107. AND s.third_party_merch_code = #{thirdPartyMerchCode}
  108. </if>
  109. </select>
  110. <insert id="save" parameterType="com.kmall.manager.entity.SysSmsLogEntity">
  111. insert into sys_sms_log(
  112. `user_id`,
  113. `content`,
  114. `mobile`,
  115. `store_id`,
  116. `merch_sn`,
  117. `stime`,
  118. `sign`,
  119. `type`,
  120. `extno`,
  121. `send_status`,
  122. `send_id`,
  123. `invalid_num`,
  124. `success_num`,
  125. `black_num`,
  126. sms_code,
  127. `return_msg`)
  128. values(
  129. #{userId},
  130. #{content},
  131. #{mobile},
  132. #{storeId},
  133. #{merchSn},
  134. #{stime},
  135. #{sign},
  136. #{type},
  137. #{extno},
  138. #{sendStatus},
  139. #{sendId},
  140. #{invalidNum},
  141. #{successNum},
  142. #{blackNum},
  143. #{smsCode},
  144. #{returnMsg})
  145. </insert>
  146. <update id="update" parameterType="com.kmall.manager.entity.SysSmsLogEntity">
  147. update sys_sms_log
  148. <set>
  149. <if test="userId != null">`user_id` = #{userId},</if>
  150. <if test="content != null">`content` = #{content},</if>
  151. <if test="mobile != null">`mobile` = #{mobile},</if>
  152. <if test="storeId != null">`store_id` = #{storeId}, </if>
  153. <if test="merchSn != null">`merch_sn` = #{merchSn}, </if>
  154. <if test="stime != null">`stime` = #{stime},</if>
  155. <if test="sign != null">`sign` = #{sign},</if>
  156. <if test="type != null">`type` = #{type},</if>
  157. <if test="extno != null">`extno` = #{extno},</if>
  158. <if test="sendStatus != null">`send_status` = #{sendStatus},</if>
  159. <if test="sendId != null">`send_id` = #{sendId},</if>
  160. <if test="invalidNum != null">`invalid_num` = #{invalidNum},</if>
  161. <if test="successNum != null">`success_num` = #{successNum},</if>
  162. <if test="blackNum != null">`black_num` = #{blackNum},</if>
  163. <if test="smsCode != null">`sms_code` = #{smsCode},</if>
  164. <if test="returnMsg != null">`return_msg` = #{returnMsg}</if>
  165. </set>
  166. where id = #{id}
  167. </update>
  168. <delete id="delete">
  169. delete from sys_sms_log where id = #{value}
  170. </delete>
  171. <delete id="deleteBatch">
  172. delete from sys_sms_log where id in
  173. <foreach item="id" collection="array" open="(" separator="," close=")">
  174. #{id}
  175. </foreach>
  176. </delete>
  177. <select id="querySmsCodeByUserId" resultType="com.kmall.manager.entity.SysSmsLogEntity">
  178. select
  179. a.id,
  180. a.user_id,
  181. a.content,
  182. a.mobile,
  183. a.store_id,
  184. a.merch_sn,
  185. a.stime,
  186. a.sign,
  187. a.type,
  188. a.extno,
  189. a.send_status,
  190. a.send_id,
  191. a.invalid_num,
  192. a.success_num,
  193. a.black_num,
  194. a.return_msg,
  195. a.sms_code
  196. from sys_sms_log a
  197. left join sys_sms_log b on a.user_id = b.user_id and b.stime > a.stime
  198. where a.user_id = #{user_id} and b.id is null
  199. </select>
  200. </mapper>