SysSmsLogDao.xml 5.3 KB

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