WwkjWaterMeterMapper.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.api.mapper.WwkjWaterMeterMapper">
  6. <resultMap type="WwkjWaterMeter" id="WwkjWaterMeterResult">
  7. <result property="id" column="id" />
  8. <result property="MeterCode" column="MeterCode" />
  9. <result property="LifetimeCode" column="LifetimeCode" />
  10. <result property="LeadSeal" column="LeadSeal" />
  11. <result property="CustomerCode" column="CustomerCode" />
  12. <result property="MeterType" column="MeterType" />
  13. <result property="BasicType" column="BasicType" />
  14. <result property="InputType" column="InputType" />
  15. <result property="ReadType" column="ReadType" />
  16. <result property="Type" column="Type" />
  17. <result property="MeterPlaceCode" column="MeterPlaceCode" />
  18. <result property="ModelCode" column="ModelCode" />
  19. <result property="MeterCliber" column="MeterCliber" />
  20. <result property="RatioQ" column="RatioQ" />
  21. <result property="MeterRatio" column="MeterRatio" />
  22. <result property="StartReading" column="StartReading" />
  23. <result property="EndReading" column="EndReading" />
  24. <result property="NeterRange" column="NeterRange" />
  25. <result property="ChangeMeterCycle" column="ChangeMeterCycle" />
  26. <result property="CreateCustomeDate" column="CreateCustomeDate" />
  27. <result property="InstallDate" column="InstallDate" />
  28. <result property="RemoveDate" column="RemoveDate" />
  29. <result property="RunStatus" column="RunStatus" />
  30. <result property="ValueStatus" column="ValueStatus" />
  31. <result property="ICCID" column="ICCID" />
  32. <result property="IMEI" column="IMEI" />
  33. <result property="DmaName" column="DmaName" />
  34. <result property="delFlag" column="del_flag" />
  35. <result property="createBy" column="create_by" />
  36. <result property="createTime" column="create_time" />
  37. <result property="updateBy" column="update_by" />
  38. <result property="updateTime" column="update_time" />
  39. </resultMap>
  40. <sql id="selectWwkjWaterMeterVo">
  41. select id, MeterCode, LifetimeCode, LeadSeal, CustomerCode, MeterType, BasicType, InputType, ReadType, Type, MeterPlaceCode, ModelCode, MeterCliber, RatioQ, MeterRatio, StartReading, EndReading, NeterRange, ChangeMeterCycle, CreateCustomeDate, InstallDate, RemoveDate, RunStatus, ValueStatus, ICCID, IMEI, DmaName, del_flag, create_by, create_time, update_by, update_time from wwkj_water_meter
  42. </sql>
  43. <select id="selectWwkjWaterMeterList" parameterType="WwkjWaterMeter" resultMap="WwkjWaterMeterResult">
  44. <include refid="selectWwkjWaterMeterVo"/>
  45. <where>
  46. <if test="MeterCode != null and MeterCode != ''"> and MeterCode = #{MeterCode}</if>
  47. <if test="LifetimeCode != null and LifetimeCode != ''"> and LifetimeCode = #{LifetimeCode}</if>
  48. <if test="LeadSeal != null and LeadSeal != ''"> and LeadSeal = #{LeadSeal}</if>
  49. <if test="CustomerCode != null and CustomerCode != ''"> and CustomerCode = #{CustomerCode}</if>
  50. <if test="MeterType != null "> and MeterType = #{MeterType}</if>
  51. <if test="BasicType != null "> and BasicType = #{BasicType}</if>
  52. <if test="InputType != null "> and InputType = #{InputType}</if>
  53. <if test="ReadType != null "> and ReadType = #{ReadType}</if>
  54. <if test="Type != null "> and Type = #{Type}</if>
  55. <if test="MeterPlaceCode != null "> and MeterPlaceCode = #{MeterPlaceCode}</if>
  56. <if test="ModelCode != null and ModelCode != ''"> and ModelCode = #{ModelCode}</if>
  57. <if test="MeterCliber != null and MeterCliber != ''"> and MeterCliber = #{MeterCliber}</if>
  58. <if test="RatioQ != null "> and RatioQ = #{RatioQ}</if>
  59. <if test="MeterRatio != null "> and MeterRatio = #{MeterRatio}</if>
  60. <if test="StartReading != null "> and StartReading = #{StartReading}</if>
  61. <if test="EndReading != null "> and EndReading = #{EndReading}</if>
  62. <if test="NeterRange != null "> and NeterRange = #{NeterRange}</if>
  63. <if test="ChangeMeterCycle != null "> and ChangeMeterCycle = #{ChangeMeterCycle}</if>
  64. <if test="CreateCustomeDate != null "> and CreateCustomeDate = #{CreateCustomeDate}</if>
  65. <if test="InstallDate != null "> and InstallDate = #{InstallDate}</if>
  66. <if test="RemoveDate != null "> and RemoveDate = #{RemoveDate}</if>
  67. <if test="RunStatus != null "> and RunStatus = #{RunStatus}</if>
  68. <if test="ValueStatus != null and ValueStatus != ''"> and ValueStatus = #{ValueStatus}</if>
  69. <if test="ICCID != null and ICCID != ''"> and ICCID = #{ICCID}</if>
  70. <if test="IMEI != null and IMEI != ''"> and IMEI = #{IMEI}</if>
  71. <if test="DmaName != null and DmaName != ''"> and DmaName like concat('%', #{DmaName}, '%')</if>
  72. </where>
  73. </select>
  74. <select id="selectWwkjWaterMeterById" parameterType="Long" resultMap="WwkjWaterMeterResult">
  75. <include refid="selectWwkjWaterMeterVo"/>
  76. where id = #{id}
  77. </select>
  78. <insert id="insertWwkjWaterMeter" parameterType="WwkjWaterMeter" useGeneratedKeys="true" keyProperty="id">
  79. insert into wwkj_water_meter
  80. <trim prefix="(" suffix=")" suffixOverrides=",">
  81. <if test="MeterCode != null and MeterCode != ''">MeterCode,</if>
  82. <if test="LifetimeCode != null">LifetimeCode,</if>
  83. <if test="LeadSeal != null">LeadSeal,</if>
  84. <if test="CustomerCode != null">CustomerCode,</if>
  85. <if test="MeterType != null">MeterType,</if>
  86. <if test="BasicType != null">BasicType,</if>
  87. <if test="InputType != null">InputType,</if>
  88. <if test="ReadType != null">ReadType,</if>
  89. <if test="Type != null">Type,</if>
  90. <if test="MeterPlaceCode != null">MeterPlaceCode,</if>
  91. <if test="ModelCode != null">ModelCode,</if>
  92. <if test="MeterCliber != null">MeterCliber,</if>
  93. <if test="RatioQ != null">RatioQ,</if>
  94. <if test="MeterRatio != null">MeterRatio,</if>
  95. <if test="StartReading != null">StartReading,</if>
  96. <if test="EndReading != null">EndReading,</if>
  97. <if test="NeterRange != null">NeterRange,</if>
  98. <if test="ChangeMeterCycle != null">ChangeMeterCycle,</if>
  99. <if test="CreateCustomeDate != null">CreateCustomeDate,</if>
  100. <if test="InstallDate != null">InstallDate,</if>
  101. <if test="RemoveDate != null">RemoveDate,</if>
  102. <if test="RunStatus != null">RunStatus,</if>
  103. <if test="ValueStatus != null">ValueStatus,</if>
  104. <if test="ICCID != null">ICCID,</if>
  105. <if test="IMEI != null">IMEI,</if>
  106. <if test="DmaName != null">DmaName,</if>
  107. <if test="delFlag != null">del_flag,</if>
  108. <if test="createBy != null">create_by,</if>
  109. <if test="createTime != null">create_time,</if>
  110. <if test="updateBy != null">update_by,</if>
  111. <if test="updateTime != null">update_time,</if>
  112. </trim>
  113. <trim prefix="values (" suffix=")" suffixOverrides=",">
  114. <if test="MeterCode != null and MeterCode != ''">#{MeterCode},</if>
  115. <if test="LifetimeCode != null">#{LifetimeCode},</if>
  116. <if test="LeadSeal != null">#{LeadSeal},</if>
  117. <if test="CustomerCode != null">#{CustomerCode},</if>
  118. <if test="MeterType != null">#{MeterType},</if>
  119. <if test="BasicType != null">#{BasicType},</if>
  120. <if test="InputType != null">#{InputType},</if>
  121. <if test="ReadType != null">#{ReadType},</if>
  122. <if test="Type != null">#{Type},</if>
  123. <if test="MeterPlaceCode != null">#{MeterPlaceCode},</if>
  124. <if test="ModelCode != null">#{ModelCode},</if>
  125. <if test="MeterCliber != null">#{MeterCliber},</if>
  126. <if test="RatioQ != null">#{RatioQ},</if>
  127. <if test="MeterRatio != null">#{MeterRatio},</if>
  128. <if test="StartReading != null">#{StartReading},</if>
  129. <if test="EndReading != null">#{EndReading},</if>
  130. <if test="NeterRange != null">#{NeterRange},</if>
  131. <if test="ChangeMeterCycle != null">#{ChangeMeterCycle},</if>
  132. <if test="CreateCustomeDate != null">#{CreateCustomeDate},</if>
  133. <if test="InstallDate != null">#{InstallDate},</if>
  134. <if test="RemoveDate != null">#{RemoveDate},</if>
  135. <if test="RunStatus != null">#{RunStatus},</if>
  136. <if test="ValueStatus != null">#{ValueStatus},</if>
  137. <if test="ICCID != null">#{ICCID},</if>
  138. <if test="IMEI != null">#{IMEI},</if>
  139. <if test="DmaName != null">#{DmaName},</if>
  140. <if test="delFlag != null">#{delFlag},</if>
  141. <if test="createBy != null">#{createBy},</if>
  142. <if test="createTime != null">#{createTime},</if>
  143. <if test="updateBy != null">#{updateBy},</if>
  144. <if test="updateTime != null">#{updateTime},</if>
  145. </trim>
  146. </insert>
  147. <update id="updateWwkjWaterMeter" parameterType="WwkjWaterMeter">
  148. update wwkj_water_meter
  149. <trim prefix="SET" suffixOverrides=",">
  150. <if test="MeterCode != null and MeterCode != ''">MeterCode = #{MeterCode},</if>
  151. <if test="LifetimeCode != null">LifetimeCode = #{LifetimeCode},</if>
  152. <if test="LeadSeal != null">LeadSeal = #{LeadSeal},</if>
  153. <if test="CustomerCode != null">CustomerCode = #{CustomerCode},</if>
  154. <if test="MeterType != null">MeterType = #{MeterType},</if>
  155. <if test="BasicType != null">BasicType = #{BasicType},</if>
  156. <if test="InputType != null">InputType = #{InputType},</if>
  157. <if test="ReadType != null">ReadType = #{ReadType},</if>
  158. <if test="Type != null">Type = #{Type},</if>
  159. <if test="MeterPlaceCode != null">MeterPlaceCode = #{MeterPlaceCode},</if>
  160. <if test="ModelCode != null">ModelCode = #{ModelCode},</if>
  161. <if test="MeterCliber != null">MeterCliber = #{MeterCliber},</if>
  162. <if test="RatioQ != null">RatioQ = #{RatioQ},</if>
  163. <if test="MeterRatio != null">MeterRatio = #{MeterRatio},</if>
  164. <if test="StartReading != null">StartReading = #{StartReading},</if>
  165. <if test="EndReading != null">EndReading = #{EndReading},</if>
  166. <if test="NeterRange != null">NeterRange = #{NeterRange},</if>
  167. <if test="ChangeMeterCycle != null">ChangeMeterCycle = #{ChangeMeterCycle},</if>
  168. <if test="CreateCustomeDate != null">CreateCustomeDate = #{CreateCustomeDate},</if>
  169. <if test="InstallDate != null">InstallDate = #{InstallDate},</if>
  170. <if test="RemoveDate != null">RemoveDate = #{RemoveDate},</if>
  171. <if test="RunStatus != null">RunStatus = #{RunStatus},</if>
  172. <if test="ValueStatus != null">ValueStatus = #{ValueStatus},</if>
  173. <if test="ICCID != null">ICCID = #{ICCID},</if>
  174. <if test="IMEI != null">IMEI = #{IMEI},</if>
  175. <if test="DmaName != null">DmaName = #{DmaName},</if>
  176. <if test="delFlag != null">del_flag = #{delFlag},</if>
  177. <if test="createBy != null">create_by = #{createBy},</if>
  178. <if test="createTime != null">create_time = #{createTime},</if>
  179. <if test="updateBy != null">update_by = #{updateBy},</if>
  180. <if test="updateTime != null">update_time = #{updateTime},</if>
  181. </trim>
  182. where id = #{id}
  183. </update>
  184. <delete id="deleteWwkjWaterMeterById" parameterType="Long">
  185. delete from wwkj_water_meter where id = #{id}
  186. </delete>
  187. <delete id="deleteWwkjWaterMeterByIds" parameterType="String">
  188. delete from wwkj_water_meter where id in
  189. <foreach item="id" collection="array" open="(" separator="," close=")">
  190. #{id}
  191. </foreach>
  192. </delete>
  193. <select id="selectByMeterCode" parameterType="String" resultMap="WwkjWaterMeterResult">
  194. <include refid="selectWwkjWaterMeterVo"/>
  195. where MeterCode = #{meterCode} and del_flag = '0'
  196. </select>
  197. <select id="selectWaterMeterByCustomerCodes" resultMap="WwkjWaterMeterResult">
  198. select MeterCode, LifetimeCode, CustomerCode, MeterCliber, MeterPlaceCode, RunStatus, del_flag
  199. from wwkj_water_meter
  200. where del_flag = '0'
  201. and RunStatus = 0 -- 只查询运行状态为0(启用)的水表
  202. <if test="list != null and list.size() > 0">
  203. and CustomerCode in
  204. <foreach collection="list" item="code" open="(" separator="," close=")">
  205. #{code}
  206. </foreach>
  207. </if>
  208. <if test="list == null or list.size() == 0">
  209. and 1=0
  210. </if>
  211. order by InstallDate asc -- 按安装日期排序,最早安装的排前面
  212. </select>
  213. </mapper>