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

89 lines
5.2 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.TbThreeSpanMapper">
<insert id="addTbThreeSpan" useGeneratedKeys="true" keyProperty="id">
insert into tb_three_span
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="proId != null ">pro_id,</if>
<if test="spanType != null ">span_type,</if>
<if test="towerId != null ">tower_id,</if>
<if test="nextTowerId != null ">next_tower_id,</if>
<if test="upperLine != null">upper_line,</if>
<if test="lowerLine != null ">lower_line,</if>
<if test="intersectionAngle != null ">intersection_angle,</if>
<if test="verticalDistance != null ">vertical_distance,</if>
<if test="safetyMargin != null ">safety_margin,</if>
<if test="verticalClearDistance != null ">vertical_clear_distance,</if>
<if test="towerSpacing != null ">tower_spacing,</if>
<if test="highwayWidth != null ">highway_width,</if>
<if test="createTime != null">create_time,</if>
<if test="createUserId != null ">create_user_id,</if>
is_actvice
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="proId != null ">#{proId},</if>
<if test="spanType != null ">#{spanType},</if>
<if test="towerId != null ">#{towerId},</if>
<if test="nextTowerId != null ">#{nextTowerId},</if>
<if test="upperLine != null ">#{upperLine},</if>
<if test="lowerLine != null ">#{lowerLine},</if>
<if test="intersectionAngle != null ">#{intersectionAngle},</if>
<if test="verticalDistance != null ">#{verticalDistance},</if>
<if test="safetyMargin != null ">#{safetyMargin},</if>
<if test="verticalClearDistance != null ">#{verticalClearDistance},</if>
<if test="towerSpacing != null ">#{towerSpacing},</if>
<if test="highwayWidth != null ">#{highwayWidth},</if>
<if test="createTime != null ">#{createTime},</if>
<if test="createUserId != null ">#{createUserId},</if>
1
</trim>
</insert>
<update id="updateTbThreeSpan">
update tb_three_span
<trim prefix="SET" suffixOverrides=",">
<if test="spanType != null">span_type = #{spanType},</if>
<if test="towerId != null">tower_id = #{towerId},</if>
<if test="nextTowerId != null">next_tower_id = #{nextTowerId},</if>
<if test="upperLine != null">upper_line = #{upperLine},</if>
<if test="lowerLine != null">lower_line = #{lowerLine},</if>
<if test="intersectionAngle != null">intersection_angle = #{intersectionAngle},</if>
<if test="verticalDistance != null">vertical_distance = #{verticalDistance},</if>
<if test="safetyMargin != null">safety_margin = #{safetyMargin},</if>
<if test="verticalClearDistance != null">vertical_clear_distance = #{verticalClearDistance},</if>
<if test="towerSpacing != null">tower_spacing = #{towerSpacing},</if>
<if test="highwayWidth != null">highway_width = #{highwayWidth},</if>
<if test="updateUserId != null">update_user_id = #{updateUserId},</if>
update_time = now()
</trim>
where id = #{id}
</update>
<delete id="delTbThreeSpan">
update tb_three_span set is_active = 0 where id = #{id}
</delete>
<select id="getTbThreeSpanList" resultType="com.bonus.digitalSignage.basic.vo.TbThreeSpanVo">
select tts.id as id,tts.pro_id as proId,tts.span_type as spanType,tts.tower_id as towerId,
tt.tower_name as towerName, tts.next_tower_id as nextTowerId,tt2.tower_name as nextTowerName,
tts.upper_line as upperLine,tts.lower_line as lowerLine,tts.intersection_angle as intersectionAngle,
tts.vertical_distance as verticalDistance,tts.safety_margin as safetyMargin,tts.vertical_clear_distance as verticalClearDistance,
tts.tower_spacing as towerSpacing,tts.highway_width as highwayWidth
from tb_three_span tts
left join tb_tower tt on tts.tower_id = tt.id
left join tb_tower tt2 on tts.next_tower_id = tt.id
where tts.pro_id = #{proId} and tts.is_active = '1'
<if test="keyWord != '' and keyWord != null">
and (tt.tower_name like concat('%',#{keyWord},'%') or
tt2.tower_name like concat('%',#{keyWord},'%'))
</if>
</select>
<select id="getTbThreeSpanById" resultType="com.bonus.digitalSignage.basic.vo.TbThreeSpanVo">
select id as id,pro_id as proId,span_type as spanType,tower_id as towerId,next_tower_id as nextTowerId,
upper_line as upperLine,lower_line as lowerLine,intersection_angle as intersectionAngle,
vertical_distance as verticalDistance,safety_margin as safetyMargin,vertical_clear_distance as verticalClearDistance,
tower_spacing as towerSpacing,highway_width as highwayWidth
from tb_three_span where id = #{id}
</select>
</mapper>