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

@ -373,27 +373,25 @@
</select>
<select id="selectByEcCompany" resultMap="BaseResultMap">
select
<include refid="baseColumns"/>
from jcl_org_staff t
WHERE delete_type = 0
AND control_policy = 1
AND ec_company IN
SELECT <include refid="baseColumns"/>
FROM jcl_org_staff t
where t.delete_type = 0
AND t.ec_company IN
<foreach collection="companyIds" open="(" item="companyId" separator="," close=")">
#{companyId}
</foreach>
AND t.plan_id IN (SELECT id from jcl_org_staffplan s where s.control_dimension = 1)
</select>
<select id="selectByEcDepartment" resultMap="BaseResultMap">
select
<include refid="baseColumns"/>
from jcl_org_staff t
WHERE delete_type = 0
AND control_policy = 2
AND ec_department IN
SELECT <include refid="baseColumns"/>
FROM jcl_org_staff t
where t.delete_type = 0
AND t.ec_department IN
<foreach collection="departmentIds" open="(" item="departmentId" separator="," close=")">
#{departmentIds}
</foreach>
AND t.plan_id IN (SELECT id from jcl_org_staffplan s where s.control_dimension = 2)
</select>
</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.po.StaffPO;
import com.engine.organization.enums.StaffChangeEnum;
import com.engine.organization.exception.OrganizationRunTimeException;
import com.engine.organization.mapper.staff.StaffMapper;
import com.engine.organization.util.OrganizationAssert;
import com.engine.organization.util.db.MapperProxyFactory;
@ -62,7 +63,7 @@ public class FunctionOutStaffServiceImpl {
if (staffPO.getControlPolicy().equals(HARDCONTROLLER)) {
OrganizationAssert.isFalse(difference.compareTo(sums) < 0,"存在编制超编风险,请先修改控制策略");
}
staffPO.setStaffNum(difference);
staffPO.setStaffNum(difference < 0 ? 0 :difference);
buildStaffPO(staffPO);
return staffMapper().updateStaff(staffPO);
}
@ -172,7 +173,7 @@ public class FunctionOutStaffServiceImpl {
//2.部门
if (param.getDepartment() != null) {
String allSupDepartment = departmentComInfo.getAllSupDepartment(String.valueOf(param.getDepartment()));
if ("".equals(allSupDepartment)) {
if (!"".equals(allSupDepartment)) {
Collection<Integer> subDepartments = Arrays.stream(allSupDepartment.split(","))
.map(Integer::parseInt)
.collect(Collectors.toList());

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

Loading…
Cancel
Save