TPumpingStationMapper.xml 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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.slibra.business.mapper.TPumpingStationMapper">
  6. <resultMap type="TPumpingStation" id="TPumpingStationResult">
  7. <result property="id" column="id" />
  8. <result property="name" column="name" />
  9. <result property="provinceId" column="province_id" />
  10. <result property="cityId" column="city_id" />
  11. <result property="countryId" column="country_id" />
  12. <result property="address" column="address" />
  13. <result property="sort" column="sort" />
  14. <result property="delFlag" column="del_flag" />
  15. <result property="revision" column="revision" />
  16. <result property="createBy" column="create_by" />
  17. <result property="createTime" column="create_time" />
  18. <result property="updateBy" column="update_by" />
  19. <result property="updateTime" column="update_time" />
  20. <result property="remark" column="remark" />
  21. </resultMap>
  22. <sql id="selectTPumpingStationVo">
  23. select id, name, province_id, city_id, country_id, address, sort, del_flag, revision, create_by, create_time, update_by, update_time, remark from t_pumping_station
  24. </sql>
  25. <select id="selectTPumpingStationList" parameterType="TPumpingStation" resultMap="TPumpingStationResult">
  26. <include refid="selectTPumpingStationVo"/>
  27. <where>
  28. 1 = 1
  29. <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
  30. <if test="provinceId != null and provinceId != ''"> and province_id = #{provinceId}</if>
  31. <if test="cityId != null and cityId != ''"> and city_id = #{cityId}</if>
  32. <if test="countryId != null and countryId != ''"> and country_id = #{countryId}</if>
  33. <if test="address != null and address != ''"> and address = #{address}</if>
  34. <if test="sort != null and sort != ''"> and sort = #{sort}</if>
  35. <if test="revision != null "> and revision = #{revision}</if>
  36. <if test="fullName != null and fullName != ''"> and name = #{fullName}</if>
  37. </where>
  38. and del_flag = 0 order by id desc
  39. </select>
  40. <select id="selectTPumpingStationById" parameterType="Long" resultMap="TPumpingStationResult">
  41. <include refid="selectTPumpingStationVo"/>
  42. where id = #{id} and del_flag = 0
  43. </select>
  44. <insert id="insertTPumpingStation" parameterType="TPumpingStation" useGeneratedKeys="true" keyProperty="id">
  45. insert into t_pumping_station
  46. <trim prefix="(" suffix=")" suffixOverrides=",">
  47. <if test="name != null and name != ''">name,</if>
  48. <if test="provinceId != null">province_id,</if>
  49. <if test="cityId != null">city_id,</if>
  50. <if test="countryId != null">country_id,</if>
  51. <if test="address != null">address,</if>
  52. <if test="sort != null">sort,</if>
  53. <if test="delFlag != null">del_flag,</if>
  54. <if test="revision != null">revision,</if>
  55. <if test="createBy != null">create_by,</if>
  56. <if test="createTime != null">create_time,</if>
  57. <if test="updateBy != null">update_by,</if>
  58. <if test="updateTime != null">update_time,</if>
  59. <if test="remark != null">remark,</if>
  60. </trim>
  61. <trim prefix="values (" suffix=")" suffixOverrides=",">
  62. <if test="name != null and name != ''">#{name},</if>
  63. <if test="provinceId != null">#{provinceId},</if>
  64. <if test="cityId != null">#{cityId},</if>
  65. <if test="countryId != null">#{countryId},</if>
  66. <if test="address != null">#{address},</if>
  67. <if test="sort != null">#{sort},</if>
  68. <if test="delFlag != null">#{delFlag},</if>
  69. <if test="revision != null">#{revision},</if>
  70. <if test="createBy != null">#{createBy},</if>
  71. <if test="createTime != null">#{createTime},</if>
  72. <if test="updateBy != null">#{updateBy},</if>
  73. <if test="updateTime != null">#{updateTime},</if>
  74. <if test="remark != null">#{remark},</if>
  75. </trim>
  76. </insert>
  77. <update id="updateTPumpingStation" parameterType="TPumpingStation">
  78. update t_pumping_station
  79. <trim prefix="SET" suffixOverrides=",">
  80. <if test="name != null and name != ''">name = #{name},</if>
  81. <if test="provinceId != null">province_id = #{provinceId},</if>
  82. <if test="cityId != null">city_id = #{cityId},</if>
  83. <if test="countryId != null">country_id = #{countryId},</if>
  84. <if test="address != null">address = #{address},</if>
  85. <if test="sort != null">sort = #{sort},</if>
  86. <if test="delFlag != null">del_flag = #{delFlag},</if>
  87. <if test="revision != null">revision = #{revision},</if>
  88. <if test="createBy != null">create_by = #{createBy},</if>
  89. <if test="createTime != null">create_time = #{createTime},</if>
  90. <if test="updateBy != null">update_by = #{updateBy},</if>
  91. <if test="updateTime != null">update_time = #{updateTime},</if>
  92. <if test="remark != null">remark = #{remark},</if>
  93. </trim>
  94. ,revision = revision + 1
  95. where id = #{id}
  96. </update>
  97. <delete id="deleteTPumpingStationById" parameterType="Long">
  98. update t_pumping_station set del_flag = 2,revision = revision + 1 where del_flag = 0 and id = #{id}
  99. </delete>
  100. <delete id="deleteTPumpingStationByIds" parameterType="String">
  101. update t_pumping_station set del_flag = 2,revision = revision + 1 where del_flag = 0 and id in
  102. <foreach item="id" collection="array" open="(" separator="," close=")">
  103. #{id}
  104. </foreach>
  105. </delete>
  106. <!-- 2024年11月12日16:05:46 下面是新增的SQL,不允许覆盖 -->
  107. <select id="getNeighbourhoodAndBuildingByPumpingId" resultType="com.slibra.business.res.NeighbourhoodAndBuilding">
  108. SELECT
  109. tpsnn.id id,
  110. tnb.`name` neighborhoodBuildingName,
  111. tn.`name` neighborhoodName
  112. FROM
  113. t_neighborhood_building tnb
  114. INNER JOIN t_pumping_station_neighbourhood_number tpsnn ON tpsnn.neighborhood_building_id = tnb.id
  115. INNER JOIN t_neighborhood tn ON tn.id = tnb.neighborhood_id
  116. WHERE
  117. tnb.del_flag = 0
  118. AND tpsnn.del_flag = 0
  119. AND tn.del_flag = 0
  120. AND tpsnn.pumping_station_id = #{id}
  121. </select>
  122. </mapper>