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>
|
|
|
|
|
|
2023-12-20 21:16:17 +08:00
|
|
|
<!--标段工程-->
|
2023-12-20 15:32:26 +08:00
|
|
|
<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 21:16:17 +08:00
|
|
|
<!--设备类型树-->
|
|
|
|
|
<select id="getDeviceTypeTree" resultType="com.bonus.sgzb.system.domain.TreeNode">
|
|
|
|
|
SELECT type_id AS id,
|
|
|
|
|
type_name AS label,
|
2023-12-21 16:34:28 +08:00
|
|
|
parent_id AS parentId,
|
2023-12-22 16:17:57 +08:00
|
|
|
unit_name AS unitName,
|
2023-12-24 00:13:14 +08:00
|
|
|
company_id AS companyId,
|
|
|
|
|
code,
|
2024-01-19 15:57:05 +08:00
|
|
|
num,
|
2023-12-24 00:13:14 +08:00
|
|
|
model_code modelCode
|
2023-12-20 21:16:17 +08:00
|
|
|
FROM ma_type
|
|
|
|
|
WHERE del_flag = '0'
|
|
|
|
|
<if test="level!=null and level!=''">
|
|
|
|
|
<if test="level == 2">
|
|
|
|
|
AND level IN ('1','2')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="level == 3">
|
|
|
|
|
AND level IN ('1','2','3')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="level == 4">
|
|
|
|
|
AND level IN ('1','2','3','4')
|
|
|
|
|
</if>
|
|
|
|
|
</if>
|
|
|
|
|
ORDER BY create_time
|
|
|
|
|
</select>
|
|
|
|
|
<!--资产属性-->
|
|
|
|
|
<select id="getAssetAttributesCbx" resultType="com.bonus.sgzb.system.domain.SelectVo">
|
|
|
|
|
SELECT prop_id AS id,
|
|
|
|
|
prop_name AS `name`
|
|
|
|
|
FROM ma_prop_info
|
|
|
|
|
WHERE del_flag = '0'
|
|
|
|
|
ORDER BY create_time
|
|
|
|
|
</select>
|
|
|
|
|
<!--机具厂家-->
|
|
|
|
|
<select id="getDeviceFactoryCbx" resultType="com.bonus.sgzb.system.domain.SelectVo">
|
|
|
|
|
SELECT supplier_id AS id,
|
|
|
|
|
supplier AS `name`
|
|
|
|
|
FROM ma_supplier_info
|
|
|
|
|
WHERE del_flag = '0'
|
|
|
|
|
ORDER BY create_time
|
|
|
|
|
</select>
|
|
|
|
|
<!--工程项目-->
|
|
|
|
|
<select id="getProCbx" resultType="com.bonus.sgzb.system.domain.SelectVo">
|
|
|
|
|
SELECT pro_id AS id,
|
|
|
|
|
pro_name AS `name`
|
|
|
|
|
FROM bm_project_info
|
2023-12-21 16:24:46 +08:00
|
|
|
WHERE del_flag = '0' AND status = '0'
|
2023-12-20 21:16:17 +08:00
|
|
|
ORDER BY create_time
|
|
|
|
|
</select>
|
|
|
|
|
<!--配件所属上级树-->
|
|
|
|
|
<select id="getAccessoryTree" resultType="com.bonus.sgzb.system.domain.TreeNode">
|
|
|
|
|
SELECT pa_id AS id,
|
|
|
|
|
pa_name AS label,
|
2023-12-21 16:24:46 +08:00
|
|
|
parent_id AS parentId,
|
2024-01-16 17:09:48 +08:00
|
|
|
unit_id as unitName,
|
2023-12-21 16:24:46 +08:00
|
|
|
level
|
2023-12-20 21:16:17 +08:00
|
|
|
FROM ma_part_type
|
|
|
|
|
WHERE del_flag = '0'
|
|
|
|
|
ORDER BY create_time
|
|
|
|
|
</select>
|
2023-12-21 20:24:45 +08:00
|
|
|
|
|
|
|
|
<select id="getPartTree" resultType="com.bonus.sgzb.system.domain.TreeNode">
|
|
|
|
|
SELECT pa_id AS id,
|
|
|
|
|
pa_name AS label,
|
|
|
|
|
parent_id AS parentId,
|
|
|
|
|
level
|
|
|
|
|
FROM ma_part_type
|
2023-12-22 17:59:58 +08:00
|
|
|
WHERE del_flag = '0' and level != '3'
|
2023-12-21 20:24:45 +08:00
|
|
|
ORDER BY create_time
|
|
|
|
|
</select>
|
2023-12-20 21:16:17 +08:00
|
|
|
<!--货架-->
|
|
|
|
|
<select id="getGoodsShelvesCbx" resultType="com.bonus.sgzb.system.domain.TreeNode">
|
|
|
|
|
SELECT house_id AS id,
|
|
|
|
|
house_name AS label,
|
|
|
|
|
parent_id AS parentId
|
|
|
|
|
FROM ma_house_info
|
|
|
|
|
WHERE del_flag = '0' AND status = '0'
|
|
|
|
|
</select>
|
|
|
|
|
<!--用户/维修员/库管员/采购员-下拉选-->
|
|
|
|
|
<select id="getUserByRoleIdCbxSelect" resultType="com.bonus.sgzb.system.domain.SelectVo">
|
|
|
|
|
SELECT su.user_id AS id,
|
2024-03-11 17:35:30 +08:00
|
|
|
su.nick_name AS `name`
|
2023-12-20 21:16:17 +08:00
|
|
|
FROM sys_role sr
|
|
|
|
|
LEFT JOIN sys_user_role sur ON sr.role_id = sur.role_id
|
|
|
|
|
LEFT JOIN sys_user su ON sur.user_id = su.user_id AND su.del_flag = '0'
|
|
|
|
|
WHERE sr.role_key = #{roleKey} AND sr.del_flag = '0'
|
|
|
|
|
</select>
|
|
|
|
|
<!--用户/维修员/库管员/采购员-树-->
|
|
|
|
|
<select id="getUserByRoleIdCbxTree" 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'
|
|
|
|
|
UNION ALL
|
|
|
|
|
SELECT su.user_id AS id,
|
|
|
|
|
su.dept_id AS parentId,
|
2024-03-11 17:35:30 +08:00
|
|
|
su.nick_name AS label
|
2023-12-20 21:16:17 +08:00
|
|
|
FROM sys_role sr
|
|
|
|
|
LEFT JOIN sys_user_role sur ON sr.role_id = sur.role_id
|
|
|
|
|
LEFT JOIN sys_user su ON sur.user_id = su.user_id AND su.del_flag = '0'
|
|
|
|
|
WHERE sr.role_key = #{roleKey} AND sr.del_flag = '0'
|
|
|
|
|
</select>
|
2023-12-21 11:12:12 +08:00
|
|
|
<!--往来单位id和标段工程id获取协议信息-->
|
|
|
|
|
<select id="getAgreementInfoById" resultType="com.bonus.sgzb.system.domain.AgreementVo">
|
|
|
|
|
SELECT agreement_id AS agreementId,
|
|
|
|
|
agreement_code AS agreementCode
|
|
|
|
|
FROM bm_agreement_info
|
|
|
|
|
WHERE unit_id = #{unitId} AND project_id = #{projectId} AND status = '1'
|
|
|
|
|
</select>
|
2023-12-21 20:24:45 +08:00
|
|
|
|
2023-12-20 15:32:26 +08:00
|
|
|
</mapper>
|