gz_digital_signage/src/main/resources/mappers/basic/TbCablewaTransMapper.xml

73 lines
3.9 KiB
XML

<?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.bonus.digitalSignage.basic.dao.TbCablewaTransMapper">
<insert id="addTbCablewaTrans">
insert into tb_cablewa_trans
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="proId != null ">pro_id,</if>
<if test="towerId != null ">tower_id,</if>
<if test="cablewayLength != null ">cableway_length,</if>
<if test="maxHeight != null">max_height,</if>
<if test="safetyDistance != null ">safety_distance,</if>
<if test="maxSlope != null ">max_slope,</if>
<if test="createTime != null">create_time,</if>
<if test="createUserId != null ">create_user_id,</if>
is_active
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="proId != null ">#{proId},</if>
<if test="towerId != null ">#{towerId},</if>
<if test="cablewayLength != null ">#{cablewayLength},</if>
<if test="maxHeight != null ">#{maxHeight},</if>
<if test="safetyDistance != null ">#{safetyDistance},</if>
<if test="maxSlope != null ">#{maxSlope},</if>
<if test="createTime != null ">#{createTime},</if>
<if test="createUserId != null ">#{createUserId},</if>
1
</trim>
</insert>
<update id="updateTbCablewaTrans">
update tb_cablewa_trans
<trim prefix="SET" suffixOverrides=",">
<if test="towerId != null">tower_id = #{towerId},</if>
<if test="cablewayLength != null">cableway_length = #{cablewayLength},</if>
<if test="maxHeight != null">max_height = #{maxHeight},</if>
<if test="safetyDistance != null">safety_distance = #{safetyDistance},</if>
<if test="maxSlope != null">max_slope = #{maxSlope},</if>
<if test="updateUserId != null">update_user_id = #{updateUserId},</if>
update_time = now()
</trim>
where id = #{id}
</update>
<delete id="delTbCablewaTrans">
update tb_cablewa_trans set is_active = '0' where id =#{id}
</delete>
<select id="tbCablewaTransList" resultType="com.bonus.digitalSignage.basic.vo.TbCablewaTransVo">
select tct.id as id,tct.pro_id as proId,tct.tower_id as towerId,tct.cableway_length as cablewayLength,
tct.max_height as maxHeight,tct.safety_distance as safetyDistance,tct.max_slope as maxSlope,
tct.create_user_id as createUserId,tt.tower_name as towerName
from tb_cablewa_trans tct
left join tb_tower tt on tct.tower_id = tt.id
where tct.pro_id = #{proId} and tct.is_active = '1'
<if test="keyWord != '' and keyWord != null">
and tt.tower_name like concat('%',#{keyWord},'%')
</if>
</select>
<select id="getTbCablewaTransById" resultType="com.bonus.digitalSignage.basic.vo.TbCablewaTransVo">
select tct.id as id,tct.pro_id as proId,tct.tower_id as towerId,tct.cableway_length as cablewayLength,
tct.max_height as maxHeight,tct.safety_distance as safetyDistance,tct.max_slope as maxSlope,
tct.create_user_id as createUserId,tt.tower_name as towerName
from tb_cablewa_trans tct
left join tb_tower tt on tct.tower_id = tt.id
where tct.id = #{id}
</select>
<select id="getTbCablewaTransByTowerId" resultType="com.bonus.digitalSignage.basic.vo.TbCablewaTransVo">
select tct.id as id,tct.pro_id as proId,tct.tower_id as towerId,tct.cableway_length as cablewayLength,
tct.max_height as maxHeight,tct.safety_distance as safetyDistance,tct.max_slope as maxSlope,
tct.create_user_id as createUserId
from tb_cablewa_trans tct where tct.tower_id = #{towerId} and tct.is_active='1'
</select>
</mapper>