YlxAlarmMapper.xml 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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.ylx.massage.mapper.YlxAlarmMapper">
  4. <resultMap type="com.ylx.massage.domain.YlxAlarm" id="YlxAlarmMap">
  5. <result property="id" column="id" jdbcType="VARCHAR"/>
  6. <result property="userName" column="user_name" jdbcType="VARCHAR"/>
  7. <result property="userPhone" column="user_phone" jdbcType="VARCHAR"/>
  8. <result property="address" column="address" jdbcType="VARCHAR"/>
  9. <result property="jsName" column="js_name" jdbcType="VARCHAR"/>
  10. <result property="jsPhone" column="js_phone" jdbcType="VARCHAR"/>
  11. <result property="jsId" column="js_id" jdbcType="VARCHAR"/>
  12. <result property="openId" column="open_id" jdbcType="VARCHAR"/>
  13. <result property="alarmStatus" column="alarm_status" jdbcType="INTEGER"/>
  14. <result property="note" column="note" jdbcType="VARCHAR"/>
  15. <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
  16. <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
  17. <result property="isDelete" column="is_delete" jdbcType="INTEGER"/>
  18. </resultMap>
  19. <!--查询单个-->
  20. <select id="queryById" resultMap="YlxAlarmMap">
  21. select id,user_name,user_phone,address,js_name,js_phone,js_id,open_id,alarm_status,note,create_time,update_time,is_delete
  22. from ylx_alarm
  23. where id = #{id}
  24. </select>
  25. <!--查询指定行数据-->
  26. <select id="queryAllByLimit" resultMap="YlxAlarmMap">
  27. select
  28. id,user_name,user_phone,address,js_name,js_phone,js_id,open_id,alarm_status,note,create_time,update_time,is_delete
  29. from ylx_alarm
  30. <where>
  31. <if test="id != null and id != ''">
  32. and id = #{id}
  33. </if>
  34. <if test="userName != null and userName != ''">
  35. and user_name = #{userName}
  36. </if>
  37. <if test="userPhone != null and userPhone != ''">
  38. and user_phone = #{userPhone}
  39. </if>
  40. <if test="address != null and address != ''">
  41. and address = #{address}
  42. </if>
  43. <if test="jsName != null and jsName != ''">
  44. and js_name = #{jsName}
  45. </if>
  46. <if test="jsPhone != null and jsPhone != ''">
  47. and js_phone = #{jsPhone}
  48. </if>
  49. <if test="jsId != null and jsId != ''">
  50. and js_id = #{jsId}
  51. </if>
  52. <if test="openId != null and openId != ''">
  53. and open_id = #{openId}
  54. </if>
  55. <if test="alarmStatus != null">
  56. and alarm_status = #{alarmStatus}
  57. </if>
  58. <if test="note != null and note != ''">
  59. and note = #{note}
  60. </if>
  61. <if test="createTime != null">
  62. and create_time = #{createTime}
  63. </if>
  64. <if test="updateTime != null">
  65. and update_time = #{updateTime}
  66. </if>
  67. <if test="isDelete != null">
  68. and is_delete = #{isDelete}
  69. </if>
  70. </where>
  71. limit #{pageable.offset}, #{pageable.pageSize}
  72. </select>
  73. <!--统计总行数-->
  74. <select id="count" resultType="java.lang.Long">
  75. select count(1)
  76. from ylx_alarm
  77. <where>
  78. <if test="id != null and id != ''">
  79. and id = #{id}
  80. </if>
  81. <if test="userName != null and userName != ''">
  82. and user_name = #{userName}
  83. </if>
  84. <if test="userPhone != null and userPhone != ''">
  85. and user_phone = #{userPhone}
  86. </if>
  87. <if test="address != null and address != ''">
  88. and address = #{address}
  89. </if>
  90. <if test="jsName != null and jsName != ''">
  91. and js_name = #{jsName}
  92. </if>
  93. <if test="jsPhone != null and jsPhone != ''">
  94. and js_phone = #{jsPhone}
  95. </if>
  96. <if test="jsId != null and jsId != ''">
  97. and js_id = #{jsId}
  98. </if>
  99. <if test="openId != null and openId != ''">
  100. and open_id = #{openId}
  101. </if>
  102. <if test="alarmStatus != null">
  103. and alarm_status = #{alarmStatus}
  104. </if>
  105. <if test="note != null and note != ''">
  106. and note = #{note}
  107. </if>
  108. <if test="createTime != null">
  109. and create_time = #{createTime}
  110. </if>
  111. <if test="updateTime != null">
  112. and update_time = #{updateTime}
  113. </if>
  114. <if test="isDelete != null">
  115. and is_delete = #{isDelete}
  116. </if>
  117. </where>
  118. </select>
  119. <!--新增所有列-->
  120. <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
  121. insert into
  122. ylx_alarm(user_name,user_phone,address,js_name,js_phone,js_id,open_id,alarm_status,note,create_time,update_time,is_delete)
  123. values
  124. <foreach collection="entities" item="entity" separator=",">
  125. (#{entity.userName}#{entity.userPhone}#{entity.address}#{entity.jsName}#{entity.jsPhone}#{entity.jsId}#{entity.openId}#{entity.alarmStatus}#{entity.note}#{entity.createTime}#{entity.updateTime}#{entity.isDelete})
  126. </foreach>
  127. </insert>
  128. <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
  129. insert into
  130. ylx_alarm(user_name,user_phone,address,js_name,js_phone,js_id,open_id,alarm_status,note,create_time,update_time,is_delete)
  131. values
  132. <foreach collection="entities" item="entity" separator=",">
  133. (#{entity.userName}#{entity.userPhone}#{entity.address}#{entity.jsName}#{entity.jsPhone}#{entity.jsId}#{entity.openId}#{entity.alarmStatus}#{entity.note}#{entity.createTime}#{entity.updateTime}#{entity.isDelete})
  134. </foreach>
  135. on duplicate key update
  136. user_name = values(user_name)user_phone = values(user_phone)address = values(address)js_name =
  137. values(js_name)js_phone = values(js_phone)js_id = values(js_id)open_id = values(open_id)alarm_status =
  138. values(alarm_status)note = values(note)create_time = values(create_time)update_time =
  139. values(update_time)is_delete = values(is_delete)
  140. </insert>
  141. <!--通过主键修改数据-->
  142. <update id="update">
  143. update ylx_alarm
  144. <set>
  145. <if test="userName != null and userName != ''">
  146. user_name = #{userName},
  147. </if>
  148. <if test="userPhone != null and userPhone != ''">
  149. user_phone = #{userPhone},
  150. </if>
  151. <if test="address != null and address != ''">
  152. address = #{address},
  153. </if>
  154. <if test="jsName != null and jsName != ''">
  155. js_name = #{jsName},
  156. </if>
  157. <if test="jsPhone != null and jsPhone != ''">
  158. js_phone = #{jsPhone},
  159. </if>
  160. <if test="jsId != null and jsId != ''">
  161. js_id = #{jsId},
  162. </if>
  163. <if test="openId != null and openId != ''">
  164. open_id = #{openId},
  165. </if>
  166. <if test="alarmStatus != null">
  167. alarm_status = #{alarmStatus},
  168. </if>
  169. <if test="note != null and note != ''">
  170. note = #{note},
  171. </if>
  172. <if test="createTime != null">
  173. create_time = #{createTime},
  174. </if>
  175. <if test="updateTime != null">
  176. update_time = #{updateTime},
  177. </if>
  178. <if test="isDelete != null">
  179. is_delete = #{isDelete},
  180. </if>
  181. </set>
  182. where id = #{id}
  183. </update>
  184. <!--通过主键删除-->
  185. <delete id="deleteById">
  186. delete
  187. from ylx_alarm
  188. where id = #{id}
  189. </delete>
  190. </mapper>