WaterSourceInfoMapper.xml 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4. <mapper namespace="com.zksy.WaterSupply.WaterSourceInfo.mapper.WaterSourceInfoMapper">
  5. <resultMap id="BaseResultMap" type="com.zksy.WaterSupply.WaterSourceInfo.domain.WaterSourceInfo">
  6. <id column="id" property="id"/>
  7. <result column="source_id" property="sourceId"/>
  8. <result column="source_name" property="sourceName"/>
  9. <result column="source_type" property="sourceType"/>
  10. <result column="unit" property="unit"/>
  11. <result column="address" property="address"/>
  12. <result column="water_type" property="waterType"/>
  13. <result column="protection_level" property="protectionLevel"/>
  14. <result column="water_quality_level" property="waterQualityLevel"/>
  15. <result column="protection_scope" property="protectionScope"/>
  16. <result column="report_time" property="reportTime"/>
  17. <result column="status" property="status"/>
  18. <result column="remark" property="remark"/>
  19. <result column="del_flag" property="delFlag"/>
  20. <result column="create_by" property="createBy"/>
  21. <result column="create_time" property="createTime"/>
  22. <result column="update_by" property="updateBy"/>
  23. <result column="update_time" property="updateTime"/>
  24. </resultMap>
  25. <sql id="Base_Column_List">
  26. id, source_id, source_name, source_type, unit, address, water_type,
  27. protection_level, water_quality_level, protection_scope, report_time,
  28. status, remark, del_flag, create_by, create_time, update_by, update_time
  29. </sql>
  30. <select id="selectSourceList" resultMap="BaseResultMap">
  31. SELECT <include refid="Base_Column_List"/>
  32. FROM water_source_info
  33. WHERE del_flag = '0'
  34. <if test="sourceId != null and sourceId != ''">
  35. AND source_id LIKE CONCAT('%', #{sourceId}, '%')
  36. </if>
  37. <if test="sourceName != null and sourceName != ''">
  38. AND source_name LIKE CONCAT('%', #{sourceName}, '%')
  39. </if>
  40. <if test="status != null and status != ''">
  41. AND status = #{status}
  42. </if>
  43. <if test="unit != null and unit != ''">
  44. AND unit LIKE CONCAT('%', #{unit}, '%')
  45. </if>
  46. ORDER BY create_time DESC
  47. </select>
  48. <select id="selectDeletedList" resultMap="BaseResultMap">
  49. SELECT <include refid="Base_Column_List"/>
  50. FROM water_source_info
  51. WHERE del_flag = '2'
  52. <if test="sourceId != null and sourceId != ''">
  53. AND source_id LIKE CONCAT('%', #{sourceId}, '%')
  54. </if>
  55. <if test="sourceName != null and sourceName != ''">
  56. AND source_name LIKE CONCAT('%', #{sourceName}, '%')
  57. </if>
  58. <if test="status != null and status != ''">
  59. AND status = #{status}
  60. </if>
  61. ORDER BY update_time DESC
  62. </select>
  63. <update id="restoreByIds">
  64. UPDATE water_source_info
  65. SET del_flag = '0',
  66. update_by = #{updateBy},
  67. update_time = NOW()
  68. WHERE id IN
  69. <foreach collection="ids" item="id" open="(" separator="," close=")">
  70. #{id}
  71. </foreach>
  72. </update>
  73. <delete id="deleteByIdsPhysically">
  74. DELETE FROM water_source_info WHERE id IN
  75. <foreach collection="ids" item="id" open="(" separator="," close=")">
  76. #{id}
  77. </foreach>
  78. </delete>
  79. </mapper>