109 lines
6.0 KiB
XML
109 lines
6.0 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" useGeneratedKeys="true" keyProperty="id">
|
|
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>
|
|
<if test="cablewayWidth != null and cablewayWidth!=''">cableway_width,</if>
|
|
<if test="sourceType != null and sourceType!=''">source_type,</if>
|
|
<if test="name != null and name!=''">name,</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>
|
|
<if test="cablewayWidth != null and cablewayWidth!=''">#{cablewayWidth},</if>
|
|
<if test="sourceType != null and sourceType!=''">#{sourceType},</if>
|
|
<if test="name != null and name!=''">#{name},</if>
|
|
1
|
|
</trim>
|
|
</insert>
|
|
<!--添加索道口、中转口、索道终点经纬度-->
|
|
<insert id="addCablewaTransPoint">
|
|
INSERT INTO tb_cablewa_trans_point(pro_id,cablewa_trans_id,lng,lat,sort) VALUES
|
|
<foreach collection="cablewaTransPointVoList" separator="," item="item">
|
|
(
|
|
${proId},#{id},#{item.lng},#{item.lat},#{item.sort}
|
|
)
|
|
</foreach>
|
|
</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="cablewayWidth != null and cablewayWidth!=''">cableway_width = #{cablewayWidth},</if>
|
|
<if test="updateUserId != null">update_user_id = #{updateUserId},</if>
|
|
<if test="sourceType != null">source_type = #{sourceType},</if>
|
|
<if test="name != null">name = #{name},</if>
|
|
update_time = now()
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
<delete id="delTbCablewaTrans">
|
|
update tb_cablewa_trans set is_active = '0' where id =#{id}
|
|
</delete>
|
|
<!--删除索道口、中转口、索道终点经纬度-->
|
|
<delete id="delCablewaTransPoint">
|
|
DELETE FROM tb_cablewa_trans_point WHERE cablewa_trans_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,tct.cableway_width AS cablewayWidth,
|
|
tct.source_type as sourceType,COALESCE(tct.name, 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},'%')
|
|
or tct.name like concat('%',#{keyWord},'%'))
|
|
</if>
|
|
<if test="sourceType != '' and sourceType != null">
|
|
and tct.source_type = #{sourceType}
|
|
</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,tct.cableway_width AS cablewayWidth,
|
|
tct.source_type as sourceType,COALESCE(tct.name, 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,tct.cableway_width AS cablewayWidth
|
|
from tb_cablewa_trans tct where tct.tower_id = #{towerId} and tct.is_active='1'
|
|
</select>
|
|
<!--索道口、中转口、索道终点经纬度-->
|
|
<select id="getCablewaTransPointVos"
|
|
resultType="com.bonus.digitalSignage.basic.vo.TbCablewaTransVo$CablewaTransPointVo">
|
|
SELECT lng,lat,sort
|
|
FROM tb_cablewa_trans_point
|
|
WHERE cablewa_trans_id = #{id}
|
|
ORDER BY sort
|
|
</select>
|
|
</mapper>
|