nxdt-system/bonus-modules/bonus-project/src/main/resources/mapper/safetycheck/ConsControlMapper.xml

61 lines
2.8 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.project.mapper.SmartIdentifyMapper">
<!--添加告警信息-->
<insert id="addWarnInfo" useGeneratedKeys="true" keyProperty="id">
INSERT INTO tb_warn
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="proId != null">pro_id,</if>
<if test="devId != null">dev_id,</if>
<if test="warnContent != null and warnContent!=''">warn_content,</if>
<if test="warnTime != null and warnTime!=''">warn_time,</if>
<if test="idCard != null and idCard!=''">id_card,</if>
<if test="warnType != null">warn_type,</if>
<if test="devType != null">dev_type,</if>
create_time,
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="proId != null">#{proId},</if>
<if test="devId != null">#{devId},</if>
<if test="warnContent != null and warnContent!=''">#{warnContent},</if>
<if test="warnTime != null and warnTime!=''">#{warnTime},</if>
<if test="idCard != null and idCard!=''">#{idCard},</if>
<if test="warnType != null">#{warnType},</if>
<if test="devType != null">#{devType},</if>
now(),
</trim>
</insert>
<insert id="addFileSource">
INSERT INTO sys_file_source(
file_name, file_suffix, file_path,
file_type, source_id, source_type,
create_time,create_user,update_time,
update_user, del_flag
) VALUE(
#{fileName},#{fileSuffix},#{filePath},
#{fileType},#{sourceId},#{sourceType},
now(),#{createUser},now(),
#{updateUser},0
)
</insert>
<!--判断球机是否被班组领用-->
<select id="getDevices" resultType="com.bonus.common.entity.DeviceUseVo">
SELECT pdi.dev_id AS devId,
pdi.device_user AS deviceUser,
ldp.pro_id AS proId
FROM pf_device_info AS pdi
LEFT JOIN pt_device_type AS pdt ON pdi.device_type = pdt.device_type AND pdt.is_active = '1'
LEFT JOIN lk_device_pro AS ldp ON ldp.device_id = pdi.device_id AND ldp.is_active = '1'
LEFT JOIN pt_project_info AS ppi ON ppi.pro_id = ldp.pro_id AND ppi.is_active = '1'
WHERE pdi.is_active = '1'
</select>
<!--根据身份证号获取班组成员/临时人员-->
<select id="getUserByIdCard" resultType="com.bonus.common.entity.PeopleVioVo">
SELECT id,name,0 AS peopleType FROM tb_people tp WHERE id_card = #{idCard} AND del_flag = 0
UNION ALL
SELECT id,name,0 AS peopleType FROM tb_ls_user tlu WHERE id_card = #{idCard}
</select>
</mapper>