123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.slibra.business.mapper.TPumpingStationMapper">
-
- <resultMap type="TPumpingStation" id="TPumpingStationResult">
- <result property="id" column="id" />
- <result property="name" column="name" />
- <result property="provinceId" column="province_id" />
- <result property="cityId" column="city_id" />
- <result property="countryId" column="country_id" />
- <result property="address" column="address" />
- <result property="sort" column="sort" />
- <result property="delFlag" column="del_flag" />
- <result property="revision" column="revision" />
- <result property="createBy" column="create_by" />
- <result property="createTime" column="create_time" />
- <result property="updateBy" column="update_by" />
- <result property="updateTime" column="update_time" />
- <result property="remark" column="remark" />
- </resultMap>
- <sql id="selectTPumpingStationVo">
- 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
- </sql>
- <select id="selectTPumpingStationList" parameterType="TPumpingStation" resultMap="TPumpingStationResult">
- <include refid="selectTPumpingStationVo"/>
- <where>
- 1 = 1
- <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
- <if test="provinceId != null and provinceId != ''"> and province_id = #{provinceId}</if>
- <if test="cityId != null and cityId != ''"> and city_id = #{cityId}</if>
- <if test="countryId != null and countryId != ''"> and country_id = #{countryId}</if>
- <if test="address != null and address != ''"> and address = #{address}</if>
- <if test="sort != null and sort != ''"> and sort = #{sort}</if>
- <if test="revision != null "> and revision = #{revision}</if>
- <if test="fullName != null and fullName != ''"> and name = #{fullName}</if>
- </where>
- and del_flag = 0 order by id desc
- </select>
-
- <select id="selectTPumpingStationById" parameterType="Long" resultMap="TPumpingStationResult">
- <include refid="selectTPumpingStationVo"/>
- where id = #{id} and del_flag = 0
- </select>
-
- <insert id="insertTPumpingStation" parameterType="TPumpingStation" useGeneratedKeys="true" keyProperty="id">
- insert into t_pumping_station
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="name != null and name != ''">name,</if>
- <if test="provinceId != null">province_id,</if>
- <if test="cityId != null">city_id,</if>
- <if test="countryId != null">country_id,</if>
- <if test="address != null">address,</if>
- <if test="sort != null">sort,</if>
- <if test="delFlag != null">del_flag,</if>
- <if test="revision != null">revision,</if>
- <if test="createBy != null">create_by,</if>
- <if test="createTime != null">create_time,</if>
- <if test="updateBy != null">update_by,</if>
- <if test="updateTime != null">update_time,</if>
- <if test="remark != null">remark,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="name != null and name != ''">#{name},</if>
- <if test="provinceId != null">#{provinceId},</if>
- <if test="cityId != null">#{cityId},</if>
- <if test="countryId != null">#{countryId},</if>
- <if test="address != null">#{address},</if>
- <if test="sort != null">#{sort},</if>
- <if test="delFlag != null">#{delFlag},</if>
- <if test="revision != null">#{revision},</if>
- <if test="createBy != null">#{createBy},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="updateBy != null">#{updateBy},</if>
- <if test="updateTime != null">#{updateTime},</if>
- <if test="remark != null">#{remark},</if>
- </trim>
- </insert>
- <update id="updateTPumpingStation" parameterType="TPumpingStation">
- update t_pumping_station
- <trim prefix="SET" suffixOverrides=",">
- <if test="name != null and name != ''">name = #{name},</if>
- <if test="provinceId != null">province_id = #{provinceId},</if>
- <if test="cityId != null">city_id = #{cityId},</if>
- <if test="countryId != null">country_id = #{countryId},</if>
- <if test="address != null">address = #{address},</if>
- <if test="sort != null">sort = #{sort},</if>
- <if test="delFlag != null">del_flag = #{delFlag},</if>
- <if test="revision != null">revision = #{revision},</if>
- <if test="createBy != null">create_by = #{createBy},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="updateBy != null">update_by = #{updateBy},</if>
- <if test="updateTime != null">update_time = #{updateTime},</if>
- <if test="remark != null">remark = #{remark},</if>
- </trim>
- ,revision = revision + 1
- where id = #{id}
- </update>
-
- <delete id="deleteTPumpingStationById" parameterType="Long">
- update t_pumping_station set del_flag = 2,revision = revision + 1 where del_flag = 0 and id = #{id}
- </delete>
- <delete id="deleteTPumpingStationByIds" parameterType="String">
- update t_pumping_station set del_flag = 2,revision = revision + 1 where del_flag = 0 and id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- <!-- 2024年11月12日16:05:46 下面是新增的SQL,不允许覆盖 -->
- <select id="getNeighbourhoodAndBuildingByPumpingId" resultType="com.slibra.business.res.NeighbourhoodAndBuilding">
- SELECT
- tpsnn.id id,
- tnb.`name` neighborhoodBuildingName,
- tn.`name` neighborhoodName
- FROM
- t_neighborhood_building tnb
- INNER JOIN t_pumping_station_neighbourhood_number tpsnn ON tpsnn.neighborhood_building_id = tnb.id
- INNER JOIN t_neighborhood tn ON tn.id = tnb.neighborhood_id
- WHERE
- tnb.del_flag = 0
- AND tpsnn.del_flag = 0
- AND tn.del_flag = 0
- AND tpsnn.pumping_station_id = #{id}
- </select>
- </mapper>
|