diff --git a/sql/SQL集合.txt b/sql/SQL集合.txt index a93e8bdc..ed87394f 100644 --- a/sql/SQL集合.txt +++ b/sql/SQL集合.txt @@ -380,3 +380,12 @@ FROM (SELECT project_id,money AS paidAmount FROM sur_project_cost_output WHERE cost_type=4) c, (SELECT project_id,money AS onAccountAmount FROM sur_project_cost_output WHERE cost_type=5) d WHERE a.project_id=b.project_id AND a.project_id=c.project_id AND a.project_id=d.project_id) o ON p.id=o.project_id + + +广联达分组信息中有重复的companyId,companyTypeId因此写view来解决 +CREATE VIEW vw_sur_project_attendance_group +AS +SELECT * FROM sur_project_attendance_group WHERE id IN ( +SELECT MIN(id) FROM sur_project_attendance_group GROUP BY companyId,companyTypeId) + + diff --git a/yanzhu-jh/src/main/resources/mapper/project/SurProjectAttendanceDataMapper.xml b/yanzhu-jh/src/main/resources/mapper/project/SurProjectAttendanceDataMapper.xml index 682f6cfa..7a79dadc 100644 --- a/yanzhu-jh/src/main/resources/mapper/project/SurProjectAttendanceDataMapper.xml +++ b/yanzhu-jh/src/main/resources/mapper/project/SurProjectAttendanceDataMapper.xml @@ -38,7 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select * FROM ( select a.*,b.project_id,b.sub_dept_id,c.companyTypeId - from sur_project_attendance_data a,sur_project_attendance_cfg b,sur_project_attendance_group c + from sur_project_attendance_data a,sur_project_attendance_cfg b,vw_sur_project_attendance_group c where a.cfgid=b.id and a.companyId=c.companyId ) sur_project_attendance_data diff --git a/yanzhu-jh/src/main/resources/mapper/project/SurProjectAttendanceGroupMapper.xml b/yanzhu-jh/src/main/resources/mapper/project/SurProjectAttendanceGroupMapper.xml index 764fe300..04cafae0 100644 --- a/yanzhu-jh/src/main/resources/mapper/project/SurProjectAttendanceGroupMapper.xml +++ b/yanzhu-jh/src/main/resources/mapper/project/SurProjectAttendanceGroupMapper.xml @@ -36,7 +36,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select id, cfgid, serverid, bizLicense, companyCode, companyId, companyName, companyTypeId, vendorId, name, leaderName, leaderPhone, teamId, teamName, type, leaderId, deleted, createTime, platformGroupId, platformTeamId, enterDate, exitDate, remark, is_del, create_by, create_time, update_by, update_time from sur_project_attendance_group + select id, cfgid, serverid, bizLicense, companyCode, companyId, companyName, companyTypeId, vendorId, name, leaderName, leaderPhone, teamId, teamName, type, leaderId, deleted, createTime, platformGroupId, platformTeamId, enterDate, exitDate, remark, is_del, create_by, create_time, update_by, update_time + from vw_sur_project_attendance_group