devicesmgt/sgzb-modules/sgzb-system/src/main/resources/mapper/system/SelectMapper.xml

91 lines
3.4 KiB
XML
Raw Normal View History

2023-12-20 15:32:26 +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.sgzb.system.mapper.SelectMapper">
<!--往来单位-->
<select id="getUnitData" resultType="com.bonus.sgzb.system.domain.SelectVo">
/*根据标段工程id关联协议查询往来单位*/
<if test="id != null and id != ''">
SELECT DISTINCT bui.unit_id AS id,
2023-12-20 18:09:46 +08:00
bui.unit_name AS `name`
2023-12-20 15:32:26 +08:00
FROM bm_project_lot bpl
LEFT JOIN bm_agreement_info bai ON bpl.lot_id = bai.project_id AND bai.`status` = '1'
LEFT JOIN bm_unit_info bui ON bai.unit_id = bui.unit_id AND bui.del_flag = '0'
WHERE bpl.lot_id = #{id} AND bpl.del_flag = '0'
</if>
<if test="id == null or id == ''">
SELECT unit_id AS id,
2023-12-20 18:09:46 +08:00
unit_name AS `name`
2023-12-20 15:32:26 +08:00
FROM bm_unit_info
WHERE del_flag = '0'
</if>
</select>
<!--工程-->
<select id="getProData" resultType="com.bonus.sgzb.system.domain.SelectVo">
/*根据往来单位id关联协议查询工程*/
<if test="id != null and id != ''">
SELECT DISTINCT bpl.lot_id AS id,
2023-12-20 18:09:46 +08:00
bpl.lot_name AS `name`
2023-12-20 15:32:26 +08:00
FROM bm_unit_info bui
LEFT JOIN bm_agreement_info bai ON bui.unit_id = bai.unit_id AND bai.`status` = '1'
LEFT JOIN bm_project_lot bpl ON bai.project_id = bpl.lot_id AND bpl.del_flag = '0'
WHERE bui.unit_id = #{id} AND bui.del_flag = '0'
</if>
<if test="id == null or id == ''">
SELECT lot_id AS id,
2023-12-20 18:09:46 +08:00
lot_name AS `name`
2023-12-20 15:32:26 +08:00
FROM bm_project_lot
WHERE del_flag = '0'
</if>
</select>
2023-12-20 18:09:46 +08:00
<!--机具类型-->
<select id="getMaTypeData" resultType="com.bonus.sgzb.system.domain.SelectVo">
SELECT type_id AS id,
type_name AS `name`
FROM ma_type
WHERE `level` = #{type} AND del_flag = '0'
</select>
<!--数据字典下拉选-->
<select id="getDictByPidCbx" resultType="com.bonus.sgzb.system.domain.SelectVo">
SELECT sd2.id,sd2.`name`
FROM sys_dic sd
LEFT JOIN sys_dic sd2 ON sd.id = sd2.p_id
WHERE sd.`value` = #{parentValue} AND sd.p_id = 0
</select>
<!--单位树/归属部门/所属上级-->
<select id="getDeptTree" resultType="com.bonus.sgzb.system.domain.TreeNode">
SELECT dept_id AS id,
parent_id AS parentId,
dept_name AS label
FROM sys_dept
WHERE del_flag = '0'
ORDER BY order_num
</select>
<!--岗位下拉选-->
<select id="getPostCbx" resultType="com.bonus.sgzb.system.domain.SelectVo">
SELECT post_id AS id,
post_name AS `name`
FROM sys_post
WHERE status = '0'
ORDER BY post_sort
</select>
<!--角色下拉选-->
<select id="getRoleCbx" resultType="com.bonus.sgzb.system.domain.SelectVo">
SELECT role_id AS id,
role_name AS `name`
FROM sys_role
WHERE status = '0'
ORDER BY role_sort
</select>
<!--单位类型下拉选-->
<select id="getUnitTypeCbx" resultType="com.bonus.sgzb.system.domain.SelectVo">
SELECT sd2.id,sd2.`name`
FROM sys_dic sd
LEFT JOIN sys_dic sd2 ON sd.id = sd2.p_id
WHERE sd.`value` = #{parentValue} AND sd.p_id = 0
</select>
2023-12-20 15:32:26 +08:00
</mapper>