nxdt-system/bonus-modules/bonus-project/src/main/resources/mapper/system/EngineeringEquipmentBindMap...

154 lines
6.7 KiB
XML
Raw Normal View History

2025-01-16 16:16:53 +08:00
<?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.EngineeringEquipmentBindMapper">
<insert id="addBind">
INSERT INTO lk_device_pro (device_id, pro_id, create_user, create_time, is_active)
VALUES
<foreach collection="value" item="item" separator=",">
(#{item}, #{proId}, #{createUser}, now(), '1')
</foreach>
</insert>
<update id="untieInformation">
UPDATE lk_device_pro
SET is_active = '0',
unbind_user = #{createUser},
unbind_time = now()
WHERE device_id = #{deviceId} AND pro_id = #{proId}
</update>
<select id="listEngineeringEquipment" resultType="com.bonus.project.domain.EngineeringEquipmentBind">
select
(@rowNum := @rowNum + 1) as exportId,
ppi.pro_id as proId,
ppi.pro_name as proName,
ppi.pro_user_name as proLeader,
ppi.pro_user_phone as proLeaderPhone,
sdd1.dict_label as proStatus,
ppi.create_user as createPerson,
ppi.create_time as createTime,
count(ldp.device_id) as proEquipmentNum
from (select @rowNum := 0) r,pt_project_info ppi
left join sys_dict_data sdd1 on sdd1.dict_value = ppi.pro_status and sdd1.dict_type = 'sys_pro_status' and
sdd1.status = '0'
left join lk_device_pro ldp on ldp.pro_id = ppi.pro_id and ldp.is_active = '1'
where ppi.pro_status != '1' and ppi.pro_status != '4' and ppi.is_active = '1'
<if test="proName != null and proName != ''">
and ppi.pro_name like concat('%', #{proName}, '%')
</if>
<if test="proLeader != null and proLeader != ''">
and ppi.pro_user_name like concat('%', #{proLeader}, '%')
</if>
<if test="createPerson != null and createPerson != ''">
and ppi.create_user like concat('%', #{createPerson}, '%')
</if>
<if test="proStatus != null and proStatus != ''">
and ppi.pro_status = #{proStatus}
</if>
GROUP BY
ppi.pro_id, ppi.pro_name, ppi.pro_user_name, ppi.pro_user_phone, ppi.create_user, ppi.create_time
ORDER BY
ppi.create_time DESC
</select>
<select id="listEquipment" resultType="com.bonus.project.domain.DeviceInformation">
SELECT
(@rowNum := @rowNum + 1) as exportId,
ppi.pro_name AS proName,
pdi.device_id AS deviceId,
pdi.device_code AS deviceCode,
pdi.device_name AS deviceName,
pdi.device_type AS deviceType,
pdt.device_name AS deviceTypeName,
pdi.device_model AS deviceModel,
pdi.device_user AS deviceUser,
pdi.device_phone AS devicePhone,
ldp.create_user AS createUser,
ldp.create_time AS createTime,
pdi.puid,
pdi.ball_index as ballIndex
FROM
(select @rowNum := 0) r,lk_device_pro AS ldp
LEFT JOIN pf_device_info AS pdi ON ldp.device_id = pdi.device_id AND pdi.is_active = '1'
LEFT JOIN pt_device_type AS pdt ON pdi.device_type = pdt.device_type AND pdt.is_active = '1'
LEFT JOIN pt_project_info AS ppi ON ldp.pro_id = ppi.pro_id AND ppi.is_active = '1'
WHERE ldp.is_active = '1' AND ldp.pro_id = #{proId}
<if test="deviceName != null and deviceName != ''">
AND pdi.device_name like concat('%', #{deviceName}, '%')
</if>
<if test="deviceUser != null and deviceUser != ''">
AND pdi.device_user like concat('%', #{deviceUser}, '%')
</if>
<if test="createUser != null and createUser != ''">
AND pdi.create_user like concat('%', #{createUser}, '%')
</if>
<if test="deviceType != null and deviceType != ''">
AND pdi.device_type = #{deviceType}
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND date_format(ldp.create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
AND date_format(ldp.create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
</if>
</select>
<select id="listConstructionMaterial" resultType="com.bonus.project.domain.ConstructionMaterials">
SELECT
(@rowNum := @rowNum + 1) as exportId,
pci.information_id AS id,
ppi.pro_name AS proName,
psi.cont_name AS consName,
pci.information_name AS fileName,
substr(pci.information_name, instr(pci.information_name, '.') + 1) as fileType,
pci.information_size AS fileSize,
lcf.create_time AS createTime,
lcf.uuid as uuid,
lcf.task_id as taskId,
lcf.proc_inst_id as procInsId,
2025-02-14 16:55:56 +08:00
#{dataType} AS status,
2025-01-16 16:16:53 +08:00
lcf.status as intoStatus
FROM (select @rowNum := 0) r, lk_cont_file AS lcf
LEFT JOIN pt_cons_information AS pci ON lcf.uuid = pci.uuid and pci.is_active = '1'
left join pt_cont_info psi on psi.uuid = lcf.cont_uuid and psi.is_active = '1'
left join pt_project_info ppi on ppi.pro_id = lcf.pro_id and ppi.is_active = '1'
WHERE lcf.status != '0'
<if test="userType == 01 and userType == '01'">
AND lcf.pro_id = #{proId}
</if>
<if test="proName != null and proName != ''">
AND lcf.pro_id = #{proName}
</if>
<if test="consName != null and consName != ''">
AND lcf.cont_uuid = #{consName}
</if>
<if test="fileName != null and fileName != ''">
AND pci.information_name like concat('%', #{fileName}, '%')
</if>
<if test="status != null and status != '' and status != 1 and status != '1' and status != '2' and status != 2 ">
AND lcf.status = #{status}
</if>
2025-02-14 16:55:56 +08:00
<if test="status==2 or status=='2'">
and lcf.status = #{status}
</if>
<if test='dataType==1'>
AND lcf.proc_inst_id IN (
<foreach collection="proInsId" item="item" separator=",">
#{item}
</foreach>
)
</if>
2025-01-16 16:16:53 +08:00
ORDER BY lcf.create_time DESC
</select>
<select id="getFileList" resultType="com.bonus.common.entity.SysFileInfo">
SELECT
uuid AS uuid,
information_id as id,
information_name AS fileName,
information_path AS filePath,
information_path AS url,
information_size AS fileSize,
create_time AS createTime
FROM pt_cons_information
WHERE uuid = #{uuid} and is_active = '1'
</select>
</mapper>