WaterPumpStationMapper.xml 4.0 KB

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