pull/211/head
Chengliang 2 years ago
parent 7cb3b019a8
commit 21cd02c72a

@ -373,27 +373,25 @@
</select> </select>
<select id="selectByEcCompany" resultMap="BaseResultMap"> <select id="selectByEcCompany" resultMap="BaseResultMap">
select SELECT <include refid="baseColumns"/>
<include refid="baseColumns"/> FROM jcl_org_staff t
from jcl_org_staff t where t.delete_type = 0
WHERE delete_type = 0 AND t.ec_company IN
AND control_policy = 1
AND ec_company IN
<foreach collection="companyIds" open="(" item="companyId" separator="," close=")"> <foreach collection="companyIds" open="(" item="companyId" separator="," close=")">
#{companyId} #{companyId}
</foreach> </foreach>
AND t.plan_id IN (SELECT id from jcl_org_staffplan s where s.control_dimension = 1)
</select> </select>
<select id="selectByEcDepartment" resultMap="BaseResultMap"> <select id="selectByEcDepartment" resultMap="BaseResultMap">
select SELECT <include refid="baseColumns"/>
<include refid="baseColumns"/> FROM jcl_org_staff t
from jcl_org_staff t where t.delete_type = 0
WHERE delete_type = 0 AND t.ec_department IN
AND control_policy = 2
AND ec_department IN
<foreach collection="departmentIds" open="(" item="departmentId" separator="," close=")"> <foreach collection="departmentIds" open="(" item="departmentId" separator="," close=")">
#{departmentIds} #{departmentIds}
</foreach> </foreach>
AND t.plan_id IN (SELECT id from jcl_org_staffplan s where s.control_dimension = 2)
</select> </select>
</mapper> </mapper>

@ -3,6 +3,7 @@ package com.engine.organization.service.impl;
import com.engine.organization.entity.staff.param.StaffOutParam; import com.engine.organization.entity.staff.param.StaffOutParam;
import com.engine.organization.entity.staff.po.StaffPO; import com.engine.organization.entity.staff.po.StaffPO;
import com.engine.organization.enums.StaffChangeEnum; import com.engine.organization.enums.StaffChangeEnum;
import com.engine.organization.exception.OrganizationRunTimeException;
import com.engine.organization.mapper.staff.StaffMapper; import com.engine.organization.mapper.staff.StaffMapper;
import com.engine.organization.util.OrganizationAssert; import com.engine.organization.util.OrganizationAssert;
import com.engine.organization.util.db.MapperProxyFactory; import com.engine.organization.util.db.MapperProxyFactory;
@ -62,7 +63,7 @@ public class FunctionOutStaffServiceImpl {
if (staffPO.getControlPolicy().equals(HARDCONTROLLER)) { if (staffPO.getControlPolicy().equals(HARDCONTROLLER)) {
OrganizationAssert.isFalse(difference.compareTo(sums) < 0,"存在编制超编风险,请先修改控制策略"); OrganizationAssert.isFalse(difference.compareTo(sums) < 0,"存在编制超编风险,请先修改控制策略");
} }
staffPO.setStaffNum(difference); staffPO.setStaffNum(difference < 0 ? 0 :difference);
buildStaffPO(staffPO); buildStaffPO(staffPO);
return staffMapper().updateStaff(staffPO); return staffMapper().updateStaff(staffPO);
} }
@ -172,7 +173,7 @@ public class FunctionOutStaffServiceImpl {
//2.部门 //2.部门
if (param.getDepartment() != null) { if (param.getDepartment() != null) {
String allSupDepartment = departmentComInfo.getAllSupDepartment(String.valueOf(param.getDepartment())); String allSupDepartment = departmentComInfo.getAllSupDepartment(String.valueOf(param.getDepartment()));
if ("".equals(allSupDepartment)) { if (!"".equals(allSupDepartment)) {
Collection<Integer> subDepartments = Arrays.stream(allSupDepartment.split(",")) Collection<Integer> subDepartments = Arrays.stream(allSupDepartment.split(","))
.map(Integer::parseInt) .map(Integer::parseInt)
.collect(Collectors.toList()); .collect(Collectors.toList());

@ -367,7 +367,7 @@ public class StaffServiceImpl extends Service implements StaffService {
String sqlWhere = " where t.delete_type ='0' "; String sqlWhere = " where t.delete_type ='0' ";
String planId = param.getPlanId(); String planId = param.getPlanId();
if ("".equals(planId)) { if (!"".equals(planId)) {
sqlWhere += " AND t.plan_id in (" + planId + ")"; sqlWhere += " AND t.plan_id in (" + planId + ")";
} else { } else {
sqlWhere = " where 1 = 2 "; sqlWhere = " where 1 = 2 ";

Loading…
Cancel
Save