ah_sz_gqj/src/main/resources/mappers/basis/ToolsManageMapper.xml

60 lines
2.0 KiB
XML
Raw Normal View History

2024-07-20 14:56:38 +08:00
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.aqgqj.basis.dao.ToolsManageDao">
<select id="list" resultType="com.bonus.aqgqj.basis.entity.dto.ToolsManageDto">
2024-07-20 22:28:17 +08:00
SELECT ts.id,
tc.custom_name as customName,
ts.sample_user as sampleUser,
ts.sample_time as sampleTime,
su.user_name as collectSamplesUser,
tsd.create_time as collectSamplesTime,
tt.team_name as teamName
FROM tb_sample ts
LEFT JOIN tb_custom tc
on tc.id = ts.custom_id
LEFT JOIN tb_sample_device tsd on tsd.sample_id = ts.id
LEFT JOIN sys_user su on su.id = tsd.create_user
LEFT JOIN tb_team tt on tt.id = ts.team_id
WHERE ts.del_flag = '0'
<if test="collectSamplesUser != null and collectSamplesUser != ''">
AND su.user_name like concat('%', #{collectSamplesUser}, '%')
2024-07-20 14:56:38 +08:00
</if>
2024-07-20 22:28:17 +08:00
<if test="sampleTools != null and sampleTools != ''">
and tsd.dev_type_name like concat('%',#{sampleTools}, '%')
2024-07-20 14:56:38 +08:00
</if>
2024-07-20 22:28:17 +08:00
GROUP BY ts.id
</select>
<select id="getSampleTools" resultType="java.lang.String">
SELECT GROUP_CONCAT(aa.dev_type_name SEPARATOR '、') AS sampleTools
FROM (SELECT DISTINCT tsd.dev_type_name
FROM tb_sample_device tsd
LEFT JOIN tb_sample ts ON ts.id = tsd.sample_id
WHERE tsd.sample_id = #{id}
AND tsd.del_falg = '0') aa
</select>
<select id="getDetailsList" resultType="com.bonus.aqgqj.basis.entity.dto.ToolsManageDto">
select
tsd.id,
tsd.dev_type_name as sampleTools,
tsd.dev_type_code as devTypeCode,
tsd.dev_module as devModule
from
tb_sample_device tsd
where tsd.del_falg = 0
and tsd.sample_id = #{id}
<if test="sampleTools != null and sampleTools != ''">
and tsd.dev_type_name like concat('%',#{sampleTools}, '%')
2024-07-20 14:56:38 +08:00
</if>
2024-07-20 22:28:17 +08:00
</select>
<select id="listTools" resultType="com.bonus.aqgqj.basis.entity.dto.ToolsManageDto">
select
id,
dict_name as name
from
sys_distinct
where
p_id = 92
and del_flag = 0
2024-07-20 14:56:38 +08:00
</select>
</mapper>