WaterPumpStationMapper.xml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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.zksy.WaterSupply.WaterPumpStation.mapper.WaterPumpStationMapper">
  4. <resultMap id="BaseResultMap" type="com.zksy.WaterSupply.WaterPumpStation.domain.WaterPumpStation">
  5. <id column="id" property="id" />
  6. <result column="station_code" property="stationCode" />
  7. <result column="station_name" property="stationName" />
  8. <result column="location" property="location" />
  9. <result column="longitude" property="longitude" />
  10. <result column="latitude" property="latitude" />
  11. <result column="pump_count" property="pumpCount" />
  12. <result column="design_flow" property="designFlow" />
  13. <result column="design_head" property="designHead" />
  14. <result column="power_capacity" property="powerCapacity" />
  15. <result column="commission_date" property="commissionDate" />
  16. <result column="status" property="status" />
  17. <result column="principal" property="principal" />
  18. <result column="contact_phone" property="contactPhone" />
  19. <result column="remark" property="remark" />
  20. <result column="del_flag" property="delFlag" />
  21. <result column="create_by" property="createBy" />
  22. <result column="create_time" property="createTime" />
  23. <result column="update_by" property="updateBy" />
  24. <result column="update_time" property="updateTime" />
  25. </resultMap>
  26. <sql id="Base_Column_List">
  27. id, station_code, station_name, location, longitude, latitude, pump_count, design_flow, design_head,
  28. power_capacity, commission_date, status, principal, contact_phone, remark,
  29. del_flag, create_by, create_time, update_by, update_time
  30. </sql>
  31. <!-- 条件查询泵站列表 -->
  32. <select id="selectStationList" resultMap="BaseResultMap">
  33. SELECT <include refid="Base_Column_List"/>
  34. FROM water_pump_station
  35. WHERE del_flag = '0'
  36. <if test="stationCode != null and stationCode != ''">
  37. AND station_code LIKE CONCAT('%', #{stationCode}, '%')
  38. </if>
  39. <if test="stationName != null and stationName != ''">
  40. AND station_name LIKE CONCAT('%', #{stationName}, '%')
  41. </if>
  42. <if test="status != null and status != ''">
  43. AND status = #{status}
  44. </if>
  45. <if test="principal != null and principal != ''">
  46. AND principal LIKE CONCAT('%', #{principal}, '%')
  47. </if>
  48. <if test="startTime != null">
  49. AND create_time &gt;= #{startTime}
  50. </if>
  51. <if test="endTime != null">
  52. AND create_time &lt;= #{endTime}
  53. </if>
  54. ORDER BY create_time DESC
  55. </select>
  56. <!-- 回收站SQL -->
  57. <select id="selectDeletedList" resultMap="BaseResultMap">
  58. SELECT <include refid="Base_Column_List"/>
  59. FROM water_pump_station
  60. WHERE del_flag = '2'
  61. <if test="stationCode != null and stationCode != ''">
  62. AND station_code LIKE CONCAT('%', #{stationCode}, '%')
  63. </if>
  64. <if test="stationName != null and stationName != ''">
  65. AND station_name LIKE CONCAT('%', #{stationName}, '%')
  66. </if>
  67. <if test="status != null and status != ''">
  68. AND status = #{status}
  69. </if>
  70. <if test="startTime != null">
  71. AND update_time &gt;= #{startTime}
  72. </if>
  73. <if test="endTime != null">
  74. AND update_time &lt;= #{endTime}
  75. </if>
  76. ORDER BY update_time DESC
  77. </select>
  78. <update id="restoreByIds">
  79. UPDATE water_pump_station
  80. SET del_flag = '0',
  81. update_by = #{updateBy},
  82. update_time = CURRENT_TIMESTAMP
  83. WHERE id IN
  84. <foreach collection="ids" item="id" open="(" separator="," close=")">
  85. #{id}
  86. </foreach>
  87. </update>
  88. <delete id="deleteByIdsPhysically">
  89. DELETE FROM water_pump_station WHERE id IN
  90. <foreach collection="ids" item="id" open="(" separator="," close=")">
  91. #{id}
  92. </foreach>
  93. </delete>
  94. </mapper>