qa-prevention-gwj/src/main/resources/mybatis/dsno2/keyProjects/AIWarningMapper.xml

258 lines
7.2 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<?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.zcloud.mapper.dsno2.keyProjects.AIWarningMapper">
<!--表名 -->
<sql id="tableName">
BUS_AIWARNING
</sql>
<!--数据字典表名 -->
<sql id="dicTableName">
SYS_DICTIONARIES
</sql>
<!-- 字段 -->
<sql id="Field">
f.CREATOR,
f.CREATTIME,
f.OPERATOR,
f.OPERATTIME,
f.ISDELETE,
f.VIDEOMANAGER_ID,
f.TYPE,
f.WARNING_TIME,
f.IMG_PATH,
f.VIDEO_PATH,
f.STATUS,
f.ISTRUE,
f.HASHIDDEN,
f.AIWARNING_ID,
f.REMARKS
</sql>
<!-- 字段用于新增 -->
<sql id="Field2">
CREATOR,
CREATTIME,
OPERATOR,
OPERATTIME,
ISDELETE,
VIDEOMANAGER_ID,
TYPE,
WARNING_TIME,
IMG_PATH,
VIDEO_PATH,
STATUS,
ISTRUE,
HASHIDDEN,
AIWARNING_ID,
REMARKS
</sql>
<!-- 字段值 -->
<sql id="FieldValue">
#{CREATOR},
#{CREATTIME},
#{OPERATOR},
#{OPERATTIME},
#{ISDELETE},
#{VIDEOMANAGER_ID},
#{TYPE},
#{WARNING_TIME},
#{IMG_PATH},
#{VIDEO_PATH},
#{STATUS},
#{ISTRUE},
#{HASHIDDEN},
#{AIWARNING_ID},
#{REMARKS}
</sql>
<!-- 新增-->
<insert id="save" parameterType="pd">
insert into
<include refid="tableName"></include>
(
<include refid="Field2"></include>
) values (
<include refid="FieldValue"></include>
)
</insert>
<!-- 新增-->
<insert id="addPeople" parameterType="pd">
insert into BUS_AIWARNING_PEOPLE (AIWARNING_PEOPLE,DEPARTMENT_ID,CONTRACT_PIC_ID,CREATOR,CREATTIME,OPERATOR,OPERATTIME,ISDELETE,OUTSOURCED_ID)
values (
#{AIWARNING_PEOPLE},#{DEPARTMENT_ID},#{CONTRACT_PIC_ID},#{CREATOR},#{CREATTIME},#{OPERATOR},#{OPERATTIME},0,#{OUTSOURCED_ID}
)
</insert>
<!-- 新增-->
<select id="getPeopleListByIds" parameterType="pd" resultType="pd">
select f.*,cr.NAME from `qa-gwj-regulatory`.bus_aiwarning_people f
left join `qa-gwj-prevention`.vi_user_all cr on cr.USER_ID = f.AIWARNING_PEOPLE
where 1=1 and ISDELETE = 0
<if test="outIds != null and outIds.size()>0"><!-- 关键词检索 -->
and f.OUTSOURCED_ID in
<foreach collection="outIds" index="index" item="item" open="(" separator="," close=")">
#{outIds[${index}]}
</foreach>
</if>
</select>
<!-- 删除-->
<delete id="delete" parameterType="pd">
update
<include refid="tableName"></include>
set
ISDELETE = '1'
where
AIWARNING_ID = #{AIWARNING_ID}
</delete>
<!-- 修改 -->
<update id="edit" parameterType="pd">
update
<include refid="tableName"></include>
set
STATUS = #{STATUS},
ISTRUE = #{ISTRUE},
HASHIDDEN = #{HASHIDDEN}
<if test="CREATOR != null and CREATOR != ''">
,OPERATOR = #{CREATOR}
</if>
<if test="OPERATTIME != null and OPERATTIME != ''">
,OPERATTIME = #{OPERATTIME}
</if>
where
AIWARNING_ID = #{AIWARNING_ID}
</update>
<!-- 通过ID获取数据 -->
<select id="findById" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>,
vid.*,
o.UNITS_ID RECTIFICATIONDEPT,
u.UNITS_NAME RECTIFICATIONDEPT_NAME,
o.UNITS_PIC RECTIFICATIONOR,
p.NAME RECTIFICATIONOR_NAME
from
<include refid="tableName"></include> f
left join bus_device v on v.VIDEOMANAGER_ID = f.VIDEOMANAGER_ID
left join bus_videomanager vid on vid.VIDEOMANAGER_ID = f.VIDEOMANAGER_ID
left join BUS_OUTSOURCED o on o.OUTSOURCED_ID = vid.OUTSOURCED_ID
left join BUS_UNITS u on u.UNITS_ID = o.UNITS_ID
left join BUS_PERSONNELMANAGEMENT p on p.PERSONNELMANAGEMENT_ID = o.UNITS_PIC
where
f.AIWARNING_ID = #{AIWARNING_ID}
</select>
<!-- 列表 -->
<select id="datalistPage" parameterType="page" resultType="pd">
select
vid.OUTSOURCED_ID, <!-- 这个字段代表的是将ai报警表BUS_AIWARNING和视频管理bus_videomanager关联查询取视频管理里的重点工程字段值 -->
f.*,
vid.VIDEONAME,
o.OUTSOURCED_NAME
from
`qa-gwj-regulatory`.BUS_AIWARNING f
left join `qa-gwj-regulatory`.bus_device v on v.VIDEOMANAGER_ID = f.VIDEOMANAGER_ID
left join `qa-gwj-regulatory`.bus_videomanager vid on vid.VIDEOMANAGER_ID = f.VIDEOMANAGER_ID
left join `qa-gwj-regulatory`.BUS_OUTSOURCED o on o.OUTSOURCED_ID = vid.OUTSOURCED_ID
where f.ISDELETE = '0' and vid.OUTSOURCED_ID = #{pd.OUTSOURCED_ID}
<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''"><!-- 关键词检索 -->
</if>
<if test='pd.STATUS != null and pd.STATUS !="" and pd.STATUS == "0"' >
and f.STATUS = 0
</if>
<if test='pd.STATUS != null and pd.STATUS !="" and pd.STATUS == "1"' >
and f.STATUS = 1
</if>
<if test="pd.loginUserId != null and pd.loginUserId !='' " >
and vid.OUTSOURCED_ID in (select aip.OUTSOURCED_ID from `qa-gwj-regulatory`.bus_aiwarning_people aip where aip.AIWARNING_PEOPLE = #{pd.loginUserId} and aip.ISDELETE = 0)
</if>
order by f.CREATTIME desc
</select>
<!-- app列表用的sql -->
<select id="datalistPageApp" parameterType="page" resultType="pd">
select
f.*,
vid.VIDEONAME,
o.OUTSOURCED_NAME
from
`qa-gwj-regulatory`.BUS_AIWARNING f
left join `qa-gwj-regulatory`.bus_device v on v.VIDEOMANAGER_ID = f.VIDEOMANAGER_ID
left join `qa-gwj-regulatory`.bus_videomanager vid on vid.VIDEOMANAGER_ID = f.VIDEOMANAGER_ID
left join `qa-gwj-regulatory`.BUS_OUTSOURCED o on o.OUTSOURCED_ID = vid.OUTSOURCED_ID
where f.ISDELETE = '0'
<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''"><!-- 关键词检索 -->
</if>
<if test='pd.STATUS != null and pd.STATUS !="" and pd.STATUS == "0"' >
and f.STATUS = 0
</if>
<if test='pd.STATUS != null and pd.STATUS !="" and pd.STATUS == "1"' >
and f.STATUS = 1
</if>
<if test="pd.loginUserId != null and pd.loginUserId !='' " >
and vid.OUTSOURCED_ID in (select aip.OUTSOURCED_ID from `qa-gwj-regulatory`.bus_aiwarning_people aip where aip.AIWARNING_PEOPLE = #{pd.loginUserId} and aip.ISDELETE = 0)
</if>
order by f.CREATTIME desc
</select>
<!-- 列表(全部) -->
<select id="listAll" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
</select>
<select id="findByOperatorId" parameterType="pd" resultType="pd">
select name from `qa-gwj-prevention`.vi_user_all where USER_ID = #{OPERATOR}
</select>
<select id="getDisposerList" parameterType="pd" resultType="pd">
select f.CONTRACT_PIC_ID,u.NAME from bus_aiwarning_people f
LEFT JOIN `qa-gwj-prevention`.vi_user_all u on u.USER_ID = f.AIWARNING_PEOPLE
where OUTSOURCED_ID = #{OUTSOURCED_ID} and ISDELETE = 0
</select>
<!-- 删除报警处置人 -->
<update id="updateByDisposer" parameterType="pd">
update
bus_aiwarning_people
set
ISDELETE = 1
where
CONTRACT_PIC_ID = #{CONTRACT_PIC_ID}
</update>
<!-- 批量删除 -->
<delete id="deleteAll" parameterType="String">
update
<include refid="tableName"></include>
set
ISDELETE = '1'
where
AIWARNING_ID in
<foreach item="item" index="index" collection="array" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<select id="getListAllByIds" parameterType="String" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where
AIWARNING_ID in
<foreach item="item" index="index" collection="array" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>