Commit c14c914a authored by chenzhao's avatar chenzhao

优化video查询逻辑

parent bd19f405
...@@ -53,8 +53,6 @@ ...@@ -53,8 +53,6 @@
group by wlv.id group by wlv.id
order by wlv.create_date desc order by wlv.create_date desc
</select> </select>
<select id="pageBuildingVideo" resultType="com.yeejoin.equipmanage.common.entity.vo.BuildingVideoVO">
<!-- SELECT <!-- SELECT
v.id AS id, v.id AS id,
v.name AS name, v.name AS name,
...@@ -88,7 +86,7 @@ ...@@ -88,7 +86,7 @@
</if> </if>
</where> </where>
order by v.create_date--> order by v.create_date-->
<select id="pageBuildingVideo" resultType="com.yeejoin.equipmanage.common.entity.vo.BuildingVideoVO">
SELECT SELECT
v.id AS id, v.id AS id,
v.name AS name, v.name AS name,
...@@ -98,28 +96,37 @@ ...@@ -98,28 +96,37 @@
v.address, v.address,
v.preset_position as presetPosition v.preset_position as presetPosition
FROM wl_video v FROM wl_video v
<choose>
<when test="dto.buildingId!=null and dto.buildingId!=''">
JOIN wl_video_source vc ON vc.video_id = v.id JOIN wl_video_source vc ON vc.video_id = v.id
join wl_form_instance wfl on wfl.instance_id = vc.source_id join wl_form_instance wfl on wfl.instance_id = vc.source_id
WHERE WHERE
1 = 1 FIND_IN_SET(#{dto.buildingId}, vc.parent_source_ids)
<if test="dto.buildingId!=null and dto.buildingId!=''">
and FIND_IN_SET(#{dto.buildingId}, vc.parent_source_ids)
</if>
<if test="dto.bizOrgCode!=null and dto.bizOrgCode!=''">
and v.biz_org_code LIKE CONCAT(#{dto.bizOrgCode}, '%')
</if>
<if test="dto.equipmentName!=null and dto.equipmentName!=''"> <if test="dto.equipmentName!=null and dto.equipmentName!=''">
and v.name like concat('%',#{dto.equipmentName},'%') and v.name like concat('%',#{dto.equipmentName},'%')
</if> </if>
<if test="dto.code!=null and dto.code!=''"> <if test="dto.code!=null and dto.code!=''">
and v.code like concat('%',#{dto.code},'%') and v.code like concat('%',#{dto.code},'%')
</if> </if>
<if test="dto.orgCode!=null and dto.bizOrgCode!='' and dto.buildingId ==null and dto.buildingId =='' "> GROUP BY id
and wfl.field_value like concat (#{dto.bizOrgCode},'%') order by v.create_date
</when>
<when test="dto.buildingId == null and dto.buildingId ==''">
<where>
<if test="dto.bizOrgCode!=null and dto.bizOrgCode!=''">
v.biz_org_code LIKE CONCAT(#{dto.bizOrgCode}, '%')
</if>
<if test="dto.code!=null and dto.code!=''">
and v.code like concat('%',#{dto.code},'%')
</if>
<if test="dto.equipmentName!=null and dto.equipmentName!=''">
and v.name like concat('%',#{dto.equipmentName},'%')
</if> </if>
</where>
GROUP BY id GROUP BY id
order by v.create_date order by v.create_date
</when>
</choose>
</select> </select>
<select id="getFireEquipByVideoId" resultType="com.yeejoin.equipmanage.common.entity.vo.BuildingListVO"> <select id="getFireEquipByVideoId" resultType="com.yeejoin.equipmanage.common.entity.vo.BuildingListVO">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment