nxdt-system/bonus-modules/bonus-system/src/main/resources/mapper/system/SysSelectMapper.xml

203 lines
7.9 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.system.mapper.SysSelectMapper">
<delete id="delFileById">
update pt_cons_information set is_active = '0' where information_id = #{id}
</delete>
<select id="getDictTableOption" resultType="com.bonus.system.domain.SysSelect">
select
dict_label as label,
dict_value as value
from sys_dict_data
<where>
<if test="dictType != null and dictType != ''">
and dict_type = #{dictType}
</if>
<if test="dictValue != null and dictValue != ''">
and dict_value = #{dictValue}
</if>
</where>
</select>
<select id="selectProAddress" resultType="com.bonus.system.domain.SysSelect">
select pro_address as label,
address_id as value,
lon as lon,
lat as lat
from pt_pro_address
where is_active = '1'
</select>
<select id="selectCons" resultType="com.bonus.system.domain.SysSelect">
select
distinct
pci.cont_name as label,
pci.cont_id as value,
pci.uuid as dictValue
from pt_cont_info pci
left join lk_pro_cont lpc on pci.uuid = lpc.cont_uuid
where is_active = '1'
<if test="proId != null and proId != ''">
and lpc.pro_id = #{proId}
</if>
<if test="consUuid != null and consUuid != ''">
and pci.uuid = #{consUuid}
</if>
</select>
<select id="selectMaterial" resultType="com.bonus.system.domain.SysSelect">
select material_name as label,
material_id as value
from pt_material_template
where is_active = '1'
and material_type = '1' and status = '1'
</select>
<select id="selectSupervisionUnit" resultType="com.bonus.system.domain.SysSelect">
select sup_name as label,
sup_id as value
from pt_sup_info
where is_active = '1'
</select>
<select id="selectFile" resultType="com.bonus.system.domain.SysFileInfo">
select information_id as id,
information_name as fileName,
information_path as filePath,
information_name as name,
information_path as url,
information_size as fileSize,
DATE(upload_time) as updateTime,
DATE(upload_time) as createTime
from pt_cons_information pci
where is_active = '1' and from_type = #{fromType} and information_type = #{informationType}
<if test="classification == '1' or classification == 1">
<if test="id != null and id != ''">
and uuid = (SELECT uuid from lk_pro_sup WHERE pro_id = #{id})
</if>
<if test="uuid != null and uuid != ''">
and uuid = #{uuid}
</if>
</if>
<if test="classification == '2' or classification == 2">
<if test="proId != null and proId != ''">
and uuid = (select uuid from lk_pro_cont where pro_id = #{proId} and cont_uuid = #{consUuid})
</if>
<if test="uuid != null and uuid != ''">
and uuid = #{uuid}
</if>
</if>
<if test="classification == '3' or classification == 3">
<if test="id != null and id != ''">
and uuid = (select psi.uuid from pt_sub_info psi
left join lk_pro_cont lpc on psi.cont_id = lpc.cont_id
where lpc.pro_id = #{id})
</if>
<if test="uuid != null and uuid != ''">
and uuid = #{uuid}
</if>
</if>
<if test="classification == '9' or classification == 9">
and uuid = #{uuid}
</if>
</select>
<select id="selectDeviceType" resultType="com.bonus.system.domain.SysSelect">
select device_name as deviceName,
device_type as deviceType
from pt_device_type
where is_active = '1'
</select>
<select id="selectDeviceInformation" resultType="com.bonus.system.domain.SysSelect">
SELECT
pdi.device_name AS label,
pdi.device_id AS `key`
FROM
pf_device_info pdi
LEFT JOIN
lk_device_pro ldp ON ldp.device_id = pdi.device_id AND ldp.is_active = '1'
WHERE
pdi.is_active = '1'
AND ldp.device_id IS NULL
<if test="deviceType != null and deviceType != '' ">
and pdi.device_type = #{deviceType}
</if>
</select>
<select id="getProjectOptions" resultType="com.bonus.system.domain.SysSelect">
select pro_name as label,
pro_id as value
from pt_project_info
where is_active = '1'
</select>
<select id="getConsOptions" resultType="com.bonus.system.domain.SysSelect">
select cont_name as label,
cont_id as value,
uuid as valueUuid
from pt_cont_info
where is_active = '1'
</select>
<select id="getSubOptions" resultType="com.bonus.system.domain.SysSelect">
select sub_name as label,
sub_id as value,
uuid as valueUuid
from pt_sub_info
where is_active = '1'
</select>
<select id="queryTheApprovalServiceType" resultType="com.bonus.system.domain.SysSelect">
select dict_label as label,
dict_value as value
from sys_dict_data sdd
where sdd.dict_type = 'sys_approval_type'
<if test="type == 1 || type == '1' || type == '专用审批流'">
and sdd.dict_value not in (select DISTINCT pfp.business_type from pt_flow_process pfp
left join lk_pro_examine_configuration lpec on lpec.examine_id = pfp.examine_id where examine_type =
'1' and is_active = '1' and lpec.pro_id = #{proId})
</if>
<if test="type == 2 || type == '2' || type == '通用审批流'">
and sdd.dict_value not in (select DISTINCT business_type from pt_flow_process where examine_type = '2'
and is_active = '1')
</if>
</select>
<select id="getUploadMaterialOptions" resultType="com.bonus.system.domain.SysSelect">
select
material_id as value
from lk_pro_cont_material
where pro_id = #{proId} and cont_id = #{consId}
</select>
<select id="personnelDropDownBox" resultType="com.bonus.system.domain.SysSelect">
select
nick_name as label,
user_id as value
from sys_user
where del_flag = '0' and status = '0' and user_type = '00'
<if test="id != null and id!= ''">
and dept_id = #{id}
</if>
</select>
<select id="checkIsExistPerson" resultType="java.lang.Integer">
select count(1) from lk_cont_person lcp
left join pt_cons_person pcp on lcp.cons_persion_id = pcp.cons_user_id
where lcp.pro_id = #{proId} and pcp.phone = #{phone}
<if test="userId != null and userId != ''">
and lcp.cons_persion_id != #{userId}
</if>
</select>
<select id="getMaterialList" resultType="com.bonus.system.domain.SysSelect">
select material_name as label,
material_path as value
from pt_material_template
where is_active = '1'
</select>
<select id="getProLeaderOption" resultType="com.bonus.system.domain.SysSelect">
select
nick_name as label,
user_id as value,
phonenumber as phone
from sys_user
where del_flag = '0' and status = '0' and user_type = '00'
</select>
<select id="getTemplateLink" resultType="java.lang.String">
select dict_label
from sys_dict_data
where dict_type = 'sys_template_link'
and dict_value = #{dictValue}
</select>
</mapper>