改的多,就不愿意描述

This commit is contained in:
wulin 2020-10-23 18:12:10 +08:00
parent 6a5f7c63e4
commit 474adeb112
26 changed files with 637 additions and 150 deletions

View File

@ -51,4 +51,8 @@ public interface DepartmentsDao extends BaseMapper<DepartmentsEntity> {
List<String> selectDepartmentIdsByparentIds(@Param("parentIds") List parentIds, @Param("page") IPage page);
List<DepartmentsEntity> selectDeparmentLevel1();
List<DepartmentsEntity> selectEntityByDepartmentIds(@Param("dIds") List<String> dIds);
List<DepartmentsEntity> selectEntityByParentDepartmentIds(@Param("dIds") List<DepartmentsEntity> dIds);
}

View File

@ -3,7 +3,9 @@ package com.lz.modules.app.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.lz.modules.app.dto.*;
import com.lz.modules.app.entity.DepartmentsEntity;
import com.lz.modules.app.entity.StaffEntity;
import com.lz.modules.app.entity.StaffSimpleInfo;
import com.lz.modules.app.req.ReportListReq;
import com.lz.modules.equipment.entity.model.FindByNameModel;
import org.apache.ibatis.annotations.Mapper;
@ -84,4 +86,8 @@ public interface StaffDao extends BaseMapper<StaffEntity> {
List<StaffSimpleDto> selectStaffSimpleInfoByIds(@Param("ids") List<Long> ids);
List<StaffDto> getDepatAllStaffInfos(@Param("departmentId") String departmentId);
List<StaffSimpleInfo> selectAllStaffSimpleInfos(@Param("depart") DepartmentsEntity depart);
List<StaffSimpleInfo> selectStaffSimpleInfos(@Param("sIds") List<Long> sIds);
}

View File

@ -46,6 +46,8 @@ public class DepartmentsEntity implements Serializable {
private Integer status;
//第几级部门
private Integer level;
/**
* 自增主键
* @return

View File

@ -0,0 +1,47 @@
package com.lz.modules.app.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 员工基本信息表
*
* @author fumeiai
* @email fumeiai@linzikg.com
* @date 2020-04-29 20:59:20
*/
@Data
public class StaffSimpleInfo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 自增主键
*/
@TableId
private Long id;
/**
* 员工姓名
*/
private String name;
/**
* 工号
*/
private String jobNumber;
//职位
private String position;
//部门名称
private String departmentName;
//部门id
private String departmentId;
}

View File

@ -53,5 +53,6 @@ public interface DepartmentsService extends IService<DepartmentsEntity> {
*/
List<DepartmentsDto> getDepartmentTreeByStaffId(String staffId,boolean containSelf);
List<DepartmentsEntity> selectAllDepartmentIds(List<String> dIds);
}

View File

@ -4,7 +4,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.lz.common.utils.PageUtils;
import com.lz.modules.app.dto.*;
import com.lz.modules.app.entity.DepartmentsEntity;
import com.lz.modules.app.entity.StaffEntity;
import com.lz.modules.app.entity.StaffSimpleInfo;
import com.lz.modules.equipment.entity.model.FindByNameModel;
import com.lz.modules.job.model.responseBo.DepartmentStaffBo;
import com.lz.modules.sys.entity.SysUserEntity;
@ -86,5 +88,9 @@ public interface StaffService extends IService<StaffEntity> {
List<StaffSimpleDto> selectStaffSimpleInfoByIds(List<Long> ids);
List<StaffDto> getDepatAllStaffInfos(String departmentId);
List<StaffSimpleInfo> selectAllStaffSimpleInfos(DepartmentsEntity depart);
List<StaffSimpleInfo> selectStaffSimpleInfos(List<Long> sIds);
}

View File

@ -265,5 +265,30 @@ public class DepartmentsServiceImpl extends ServiceImpl<DepartmentsDao, Departme
}
return departmentsParentsList;
}
@Override
public List<DepartmentsEntity> selectAllDepartmentIds(List<String> dIds){
List<DepartmentsEntity> departmentsEntities = departmentsDao.selectEntityByDepartmentIds(dIds);
List<DepartmentsEntity> childs = selectAllChildDepartmentIds(departmentsEntities);
if(childs != null){
departmentsEntities.addAll(childs);
}
return departmentsEntities;
}
public List<DepartmentsEntity> selectAllChildDepartmentIds(List<DepartmentsEntity> departmentsEntities){
List<DepartmentsEntity> departments = departmentsDao.selectEntityByParentDepartmentIds(departmentsEntities);
if(departments.size() > 0){
List<DepartmentsEntity> childs = selectAllChildDepartmentIds(departments);
if(childs != null){
departments.addAll(childs);
}
return departments;
}
return null;
}
}

View File

@ -453,6 +453,15 @@ public class StaffServiceImpl extends ServiceImpl<StaffDao, StaffEntity> impleme
return staffDao.getDepatAllStaffInfos(departmentId);
}
@Override
public List<StaffSimpleInfo> selectAllStaffSimpleInfos(DepartmentsEntity depart){
return staffDao.selectAllStaffSimpleInfos(depart);
}
@Override
public List<StaffSimpleInfo> selectStaffSimpleInfos(List<Long> sIds){
return staffDao.selectStaffSimpleInfos(sIds);
}
}

View File

@ -10,7 +10,7 @@ import java.util.Date;
* <p>
* </p>*发起考核考核组人员对应关系表
* @author quyixiao
* @since 2020-10-22
* @since 2020-10-23
*/
@Data
@ -44,6 +44,9 @@ public class EvaluationStartStaff implements java.io.Serializable {
//0: 未通知评分 1 已通知评分
@ApiModelProperty(value = "0: 未通知评分 1 已通知评分", name = "score")
private Integer score;
//考核组名称
@ApiModelProperty(value = "考核组名称", name = "evaluationName")
private String evaluationName;
/**
*
* @return
@ -179,6 +182,21 @@ public class EvaluationStartStaff implements java.io.Serializable {
this.score = score;
}
/**
* 考核组名称
* @return
*/
public String getEvaluationName() {
return evaluationName;
}
/**
* 考核组名称
* @param evaluationName
*/
public void setEvaluationName(String evaluationName) {
this.evaluationName = evaluationName;
}
@Override
public String toString() {
return "EvaluationStartStaff{" +
@ -191,6 +209,7 @@ public class EvaluationStartStaff implements java.io.Serializable {
",staffId=" + staffId +
",type=" + type +
",score=" + score +
",evaluationName=" + evaluationName +
"}";
}
}

View File

@ -10,7 +10,7 @@ import java.util.Date;
* <p>
* </p>*流程审批表
* @author quyixiao
* @since 2020-10-21
* @since 2020-10-23
*/
@Data
@ -47,6 +47,9 @@ public class FlowApprovalRole implements java.io.Serializable {
//-1考核人员自己0指定人员id此时approval_id有值1一级主管2二级主管....
@ApiModelProperty(value = "-1考核人员自己0指定人员id此时approval_id有值1一级主管2二级主管....", name = "approvalType")
private Integer approvalType;
//小结点的第几步从0开始如果是多人步数相同
@ApiModelProperty(value = "小结点的第几步从0开始如果是多人步数相同", name = "stepIndex")
private Integer stepIndex;
/**
*
* @return
@ -197,6 +200,21 @@ public class FlowApprovalRole implements java.io.Serializable {
this.approvalType = approvalType;
}
/**
* 小结点的第几步从0开始如果是多人步数相同
* @return
*/
public Integer getStepIndex() {
return stepIndex;
}
/**
* 小结点的第几步从0开始如果是多人步数相同
* @param stepIndex
*/
public void setStepIndex(Integer stepIndex) {
this.stepIndex = stepIndex;
}
@Override
public String toString() {
return "FlowApprovalRole{" +
@ -210,6 +228,7 @@ public class FlowApprovalRole implements java.io.Serializable {
",flowId=" + flowId +
",stepType=" + stepType +
",approvalType=" + approvalType +
",stepIndex=" + stepIndex +
"}";
}
}

View File

@ -3,6 +3,7 @@ package com.lz.modules.flow.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.lz.common.utils.PageUtils;
import com.lz.common.utils.R;
import com.lz.modules.app.entity.StaffSimpleInfo;
import com.lz.modules.flow.entity.EvaluationGroup;
import com.lz.modules.flow.req.EvaluationGroupReq;
@ -43,4 +44,6 @@ public interface EvaluationGroupService extends IService<EvaluationGroup> {
List<EvaluationGroup> selectEvaluationGroupByIds(List<Long> ids);
EvaluationGroup selectEvaluationGroupByName(String name);
//获取考核组里面所有参与的人员信息去除重复去除离职
List<StaffSimpleInfo> selectAllStaffSimpleInfoByGroupId(EvaluationGroup evaluationGroup);
}

View File

@ -5,6 +5,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lz.common.utils.ISelect;
import com.lz.common.utils.PageUtils;
import com.lz.common.utils.R;
import com.lz.common.utils.StringUtil;
import com.lz.modules.app.entity.DepartmentsEntity;
import com.lz.modules.app.entity.StaffSimpleInfo;
import com.lz.modules.app.service.DepartmentsService;
import com.lz.modules.app.service.StaffOccupationService;
import com.lz.modules.app.service.StaffService;
import com.lz.modules.flow.dao.EvaluationGroupMapper;
@ -16,6 +20,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Collectors;
/**
* <p>
@ -40,6 +47,9 @@ public class EvaluationGroupServiceImpl extends ServiceImpl<EvaluationGroupMappe
@Autowired
private EvaluationGroupService evaluationGroupService;
@Autowired
private DepartmentsService departmentsService;
@Override
@ -130,4 +140,70 @@ public class EvaluationGroupServiceImpl extends ServiceImpl<EvaluationGroupMappe
public EvaluationGroup selectEvaluationGroupByName(String name){
return evaluationGroupMapper.selectEvaluationGroupByName(name);
}
@Override
public List<StaffSimpleInfo> selectAllStaffSimpleInfoByGroupId(EvaluationGroup evaluationGroup){
List<StaffSimpleInfo> staffSimpleInfos = new ArrayList<>();
if(!StringUtil.isEmpty(evaluationGroup.getDepIds())){
List<String> dIds = Arrays.stream(evaluationGroup.
getDepIds().split(",")).map(new Function<String, String>() {
@Override
public String apply(String s) {
return s;
}
}).collect(Collectors.toList());
//获取所有部门信息包括子部门
List<DepartmentsEntity> departmentsEntities = departmentsService.selectAllDepartmentIds(dIds);
//下面获取部门下面的所有在职人员
for (DepartmentsEntity depart:departmentsEntities
) {
List<StaffSimpleInfo> staffSimpleInfos1 = staffService.selectAllStaffSimpleInfos(depart);
if(staffSimpleInfos1 != null){
staffSimpleInfos.addAll(staffSimpleInfos1);
}
}
}
if(!StringUtil.isEmpty(evaluationGroup.getStaffIds())){
List<Long> sIds = Arrays.stream(evaluationGroup.getStaffIds()
.split(",")).map(new Function<String, Long>() {
@Override
public Long apply(String s) {
return Long.parseLong(s);
}
}).collect(Collectors.toList());
List<StaffSimpleInfo> staffSimpleInfos1 = staffService.selectStaffSimpleInfos(sIds);
if(staffSimpleInfos1 != null){
staffSimpleInfos.addAll(staffSimpleInfos1);
}
}
//下面去重
if(staffSimpleInfos.size() > 1){
//下面去除跨部门的人员只保留第一次添加进来的人员
Map<Long, StaffSimpleInfo> staffSimpleInfoMap =
staffSimpleInfos.stream().collect(Collectors.toMap(StaffSimpleInfo::getId, Function.identity(), (e, replace) -> e));
//下面删除排除人员信息
if(!StringUtil.isEmpty(evaluationGroup.getOutIds())){
List<Long> oIds = Arrays.stream(evaluationGroup.getOutIds().split(",")).map(new Function<String, Long>() {
@Override
public Long apply(String s) {
return Long.parseLong(s);
}
}).collect(Collectors.toList());
for (Long id:oIds
) {
staffSimpleInfoMap.remove(id);
}
}
staffSimpleInfos = staffSimpleInfoMap.values().stream().collect(Collectors.toList());
}
return staffSimpleInfos;
}
}

View File

@ -67,7 +67,7 @@ public class EvaluationStartStaffServiceImpl extends ServiceImpl<EvaluationStart
return evaluationStartStaffMapper.insertEvaluationStartStaffs(evaluationStartStaffs);
}
//下面防止sql语句过大
Long count = Long.getLong("0");
Long count = Long.parseLong("0");
int insert = 0;
List<EvaluationStartStaff> startStaffs = new ArrayList<>();
for (EvaluationStartStaff startStaff:evaluationStartStaffs

View File

@ -68,7 +68,7 @@ public class FlowApprovalRoleServiceImpl extends ServiceImpl<FlowApprovalRoleMap
return flowApprovalRoleMapper.insertFlowApprovalRoles(flowApprovalRoles);
}
//下面防止sql语句过大
Long count = Long.getLong("0");
Long count = Long.parseLong("0");
int insert = 0;
List<FlowApprovalRole> approvalRoles = new ArrayList<>();
for (FlowApprovalRole role:flowApprovalRoles

View File

@ -7,19 +7,21 @@ import com.lz.common.emun.CheckStaffType;
import com.lz.common.utils.PageUtils;
import com.lz.common.utils.R;
import com.lz.common.utils.StringUtil;
import com.lz.modules.app.entity.StaffSimpleInfo;
import com.lz.modules.flow.entity.*;
import com.lz.modules.flow.model.ResultModelDto;
import com.lz.modules.flow.model.ResultTagetLibDto;
import com.lz.modules.flow.service.*;
import com.lz.modules.sys.entity.app.ResultDetail;
import com.lz.modules.sys.entity.app.ResultRecord;
import com.lz.modules.sys.service.app.ResultDetailService;
import com.lz.modules.sys.service.app.ResultRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.collections.map.HashedMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.*;
import java.util.function.Function;
@ -54,16 +56,26 @@ public class FlowStartController {
@Autowired
private FlowApprovalRoleService flowApprovalRoleService;
@Autowired
private FlowChartService flowChartService;
@Autowired
private ResultRecordService resultRecordService;
@Autowired
private ResultDetailService resultDetailService;
@RequestMapping("/getById")
public R getById(@RequestBody FlowStart flowStart) {
flowStart = flowStartService.selectFlowStartById(flowStart.getId());
return R.ok().put("flowStart",flowStart);
@GetMapping("/getById")
public R getById(@RequestParam Long id) {
EvaluationGroup evaluationGroup = evaluationGroupService.selectEvaluationGroupById(id);
List<StaffSimpleInfo> staffIds = evaluationGroupService.selectAllStaffSimpleInfoByGroupId(evaluationGroup);
//flowStart = flowStartService.selectFlowStartById(flowStart.getId());
return R.ok().put("data",staffIds);
}
@ -78,12 +90,12 @@ public class FlowStartController {
@ApiOperation("发起新的考核任务")
public R save(@RequestBody @ApiParam FlowStart flowStart) {
flowStartService.insertFlowStart(flowStart);
Map<Integer, String> chartNameMaps = new HashedMap();
Map<Long, String> chartNameMaps = new HashedMap();
//下面开始初始化流程
List<Long> ids = Arrays.stream(flowStart.getGroupIds().split(",")).map(new Function<String, Long>() {
@Override
public Long apply(String s) {
return Long.getLong(s);
return Long.parseLong(s);
}
}).collect(Collectors.toList());
List<EvaluationGroup> evaluationGroups = evaluationGroupService.selectEvaluationGroupByIds(ids);
@ -91,15 +103,16 @@ public class FlowStartController {
for (EvaluationGroup evaluationGroup:evaluationGroups
) {
//下面初始化员工考核流程
List<String> staffIds = evaluationGroupService.selectAllStaffIdsByGroupId(evaluationGroup.getId());
List<StaffSimpleInfo> staffIds = evaluationGroupService.selectAllStaffSimpleInfoByGroupId(evaluationGroup);
Map<Long, StaffSimpleInfo> staffSimpleInfoMap =
staffIds.stream().collect(Collectors.toMap(StaffSimpleInfo::getId, Function.identity(), (e, replacement) -> e));
if(staffIds.size() == 0){
return R.error(evaluationGroup.getName() + "——无有效考核人员");
}
List<ResultModel> resultModels = resultModelService.selectResultModelByGroupId(evaluationGroup.getId());
if(resultModels.size() == 0){
List<ResultModelDto> resultModelDtos = resultModelService.selectResultDtoByGroupId(evaluationGroup.getId());
if(resultModelDtos.size() == 0){
return R.error(evaluationGroup.getName() + "——没有设置考核模板");
}
@ -109,107 +122,165 @@ public class FlowStartController {
return R.error(evaluationGroup.getName() + "——没有设置考核流程");
}
//初始化lz_result_records数据
List<ResultRecord> resultRecords = new ArrayList<>();
//初始化lz_result_details数据
List<ResultDetail> resultDetails = new ArrayList<>();
//下面初始化lz_flow流程表 lz_flow_approval_role流程审批表
List<FlowApprovalRole> flowApprovalRoles = new ArrayList<>();
int stepIndex = 0;
for (FlowChartDetailRecord flowChartDetailRecord:flowChartDetailRecords
) {
Flow flow = new Flow();
flow.setFlowId(evaluationGroup.getId());
flow.setOpt("+");
flow.setStartId(flowStart.getId());
flow.setChartId(flowChartDetailRecord.getChartId());
String optName = chartNameMaps.get(flowChartDetailRecord.getChartId());
if(optName == null){
FlowChart flowChart = flowChartService.selectFlowChartById(flowChartDetailRecord.getChartId());
chartNameMaps.put(flowChart.getId(), flowChart.getName());
optName = flowChart.getName();
}
flow.setOpt(optName);
flowService.insertFlow(flow);
List<EvaluationStartStaff> evaluationStartStaffs = new ArrayList<>();
//下面初始化参与人员
for (String staffId:staffIds
) {
EvaluationStartStaff evaluationStartStaff = new EvaluationStartStaff();
evaluationStartStaff.setEvaluationId(evaluationGroup.getId());
evaluationStartStaff.setStaffId(Long.getLong(staffId));
evaluationStartStaff.setStaffId(flowStart.getId());
evaluationStartStaff.setType(CheckStaffType.STAFF.getCode());
evaluationStartStaffs.add(evaluationStartStaff);
for (ResultModel resultModel:resultModels
) {
ResultRecord resultRecord = new ResultRecord();
if(flowChartDetailRecord.getOptType().intValue() == ChartOptType.APPOINT.getCode()){//指定人员的
String[] optIds = flowChartDetailRecord.getOptIds().split(",");
for (String id:optIds
) {
String[] roleIds = flowChartDetailRecord.getRoleIds().split(",");
for (String roleId:roleIds
) {
FlowApprovalRole flowApprovalRole = new FlowApprovalRole();
flowApprovalRole.setFlowId(flow.getId());
flowApprovalRole.setApprovalId(Long.parseLong(id));
flowApprovalRole.setStepType(flowChartDetailRecord.getStepType());
flowApprovalRole.setRoleId(Long.parseLong(roleId));
flowApprovalRole.setApprovalType(flowChartDetailRecord.getOptType());
flowApprovalRoles.add(flowApprovalRole);
flowApprovalRole.setStepType(stepIndex);
}
stepIndex++;
}
}else{
String[] roleIds = flowChartDetailRecord.getRoleIds().split(",");
for (String roleId:roleIds
) {
FlowApprovalRole flowApprovalRole = new FlowApprovalRole();
flowApprovalRole.setFlowId(flow.getId());
flowApprovalRole.setStepType(flowChartDetailRecord.getStepType());
flowApprovalRole.setRoleId(Long.parseLong(roleId));
flowApprovalRole.setApprovalType(flowChartDetailRecord.getOptType());
flowApprovalRoles.add(flowApprovalRole);
flowApprovalRole.setStepType(stepIndex);
stepIndex++;
}
}
}
if(evaluationStartStaffs.size() == 0){
//插入记录
if(flowApprovalRoles.size() > 0){
flowApprovalRoleService.insertFlowApprovalRoles(flowApprovalRoles);
return R.error(evaluationGroup.getName() + "——未指定考核参与人员");
//初始化lz_result_details数据
List<ResultDetail> resultDetails = new ArrayList<>();
}
//下面初始化管理人员
if(evaluationGroup.getManagerIds() != null && evaluationGroup.getManagerIds().length() > 0){
String[] managerIds = evaluationGroup.getManagerIds().split(",");
for (String staffId:managerIds
) {
List<EvaluationStartStaff> evaluationStartStaffs = new ArrayList<>();
//下面初始化参与人员
for (StaffSimpleInfo staffInfo:staffIds
) {
EvaluationStartStaff evaluationStartStaff = new EvaluationStartStaff();
evaluationStartStaff.setEvaluationId(evaluationGroup.getId());
evaluationStartStaff.setStaffId(Long.getLong(staffId));
evaluationStartStaff.setEvaluationName(evaluationGroup.getName());
evaluationStartStaff.setStaffId(staffInfo.getId());
evaluationStartStaff.setStaffId(flowStart.getId());
evaluationStartStaff.setType(CheckStaffType.MANAGER.getCode());
evaluationStartStaff.setType(CheckStaffType.STAFF.getCode());
evaluationStartStaffs.add(evaluationStartStaff);
}
}
if(evaluationStartStaffs.size() > 0){
evaluationStartStaffService.insertEvaluationStartStaffs(evaluationStartStaffs);
//下面初始化lz_flow流程表 lz_flow_approval_role流程审批表
List<FlowApprovalRole> flowApprovalRoles = new ArrayList<>();
for (FlowChartDetailRecord flowChartDetailRecord:flowChartDetailRecords
//初始化lz_result_records数据
ResultRecord resultRecord = new ResultRecord();
resultRecord.setDepartmentId(staffInfo.getDepartmentId());
resultRecord.setDepartmentName(staffInfo.getDepartmentName());
resultRecord.setStaffId(staffInfo.getId());
resultRecord.setStaffName(staffInfo.getName());
resultRecord.setType(1);//设置为提交目标
resultRecord.setStatus(0);//设置为新建
resultRecord.setStartId(flowStart.getId());
resultRecord.setEvaluationId(evaluationGroup.getId());
resultRecord.setFlowProcess(0);//设置为目标制定
//下面初始化flow_staff_id_role字段步骤为0的
String roleJSON = "[";
for (int i = 0; i < flowApprovalRoles.size() ;i++){
FlowApprovalRole approvalRole = flowApprovalRoles.get(i);
if(approvalRole.getStepIndex().intValue() == 0){
if(i == 0){
//设置当前审批员工id current_approval_staff_id
resultRecord.setCurrentApprovalStaffId(approvalRole.getApprovalId());
//设置当前审批员工姓名 current_approval_staff_name
resultRecord.setCurrentApprovalStaffName("");
roleJSON += ("{\"roleId\":"+ approvalRole.getRoleId() +
",\"staffId\":" + approvalRole.getApprovalId() + "}");
}else{
roleJSON += (",{\"roleId\":"+ approvalRole.getRoleId() +
",\"staffId\":" + approvalRole.getApprovalId() + "}");
}
}
}
roleJSON += "]";
resultRecord.setFlowStaffIdRole(roleJSON);
resultRecordService.insertResultRecord(resultRecord);
//下面生成ResultDetail对象
for (ResultModelDto modelDto:resultModelDtos
) {
Flow flow = new Flow();
flow.setFlowId(evaluationGroup.getId());
flow.setOpt("+");
flow.setStartId(flowStart.getId());
flow.setChartId(flowChartDetailRecord.getChartId());
String optName = chartNameMaps.get(flowChartDetailRecord.getChartId());
if(optName == null){
if(modelDto.getTagetLibs().size() > 0){//模板里面有添加指标
for (ResultTagetLibDto libDto:
modelDto.getTagetLibs()) {
ResultDetail resultDetail = new ResultDetail();
resultDetail.setRecordId(resultRecord.getId());
resultDetail.setTarget(libDto.getName());
resultDetail.setType(modelDto.getType());
resultDetail.setKeyResult(libDto.getKeyResult());
resultDetail.setCheckWeight(libDto.getWeight());
resultDetail.setStaffId(staffInfo.getId());
resultDetail.setPriority(libDto.getOrderBy());
resultDetails.add(resultDetail);
}
}
}
}
//如果有数据插入lz_result_detail表
if(resultDetails.size() > 0){
//
resultDetailService.insertResultDetails(resultDetails);
}
//下面初始化管理人员
if(!StringUtil.isEmpty(evaluationGroup.getManagerIds())){
String[] managerIds = evaluationGroup.getManagerIds().split(",");
for (String staffId:managerIds
) {
EvaluationStartStaff evaluationStartStaff = new EvaluationStartStaff();
evaluationStartStaff.setEvaluationId(evaluationGroup.getId());
evaluationStartStaff.setEvaluationName(evaluationGroup.getName());
evaluationStartStaff.setStaffId(Long.parseLong(staffId));
evaluationStartStaff.setStaffId(flowStart.getId());
evaluationStartStaff.setType(CheckStaffType.MANAGER.getCode());
evaluationStartStaffs.add(evaluationStartStaff);
}
}
evaluationStartStaffService.insertEvaluationStartStaffs(evaluationStartStaffs);
}else{
return R.error(evaluationGroup.getName() + "——初始化考核流程失败");
}
}
flow.setOpt(optName);
flowService.insertFlow(flow);
if(flowChartDetailRecord.getOptType().intValue() == ChartOptType.APPOINT.getCode()){//指定人员的
String[] optIds = flowChartDetailRecord.getOptIds().split(",");
for (String id:optIds
) {
String[] roleIds = flowChartDetailRecord.getRoleIds().split(",");
for (String roleId:roleIds
) {
FlowApprovalRole flowApprovalRole = new FlowApprovalRole();
flowApprovalRole.setFlowId(flow.getId());
flowApprovalRole.setApprovalId(Long.getLong(id));
flowApprovalRole.setStepType(flowChartDetailRecord.getStepType());
flowApprovalRole.setRoleId(Long.getLong(roleId));
flowApprovalRole.setApprovalType(flowChartDetailRecord.getOptType());
flowApprovalRoles.add(flowApprovalRole);
}
}
}else{
String[] roleIds = flowChartDetailRecord.getRoleIds().split(",");
for (String roleId:roleIds
) {
FlowApprovalRole flowApprovalRole = new FlowApprovalRole();
flowApprovalRole.setFlowId(flow.getId());
flowApprovalRole.setStepType(flowChartDetailRecord.getStepType());
flowApprovalRole.setRoleId(Long.getLong(roleId));
flowApprovalRole.setApprovalType(flowChartDetailRecord.getOptType());
flowApprovalRoles.add(flowApprovalRole);
}
}
//插入记录
}
if(flowApprovalRoles.size() > 0){
flowApprovalRoleService.insertFlowApprovalRoles(flowApprovalRoles);
}
//下面初始化lz_result_record表和lz_result_detail表
}

View File

@ -41,4 +41,6 @@ public interface ResultDetailMapper extends BaseMapper<ResultDetail> {
//计算业务/价值观得分
BigDecimal calculateScore(@Param("recordId") Long recordId, @Param("staffId") Long staffId,@Param("type") Integer type);
Long insertResultDetails(List<ResultDetail> resultDetails);
}

View File

@ -1,59 +1,87 @@
package com.lz.modules.sys.entity.app;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* <p>
* 菜单权限表
* </p>*业绩记录表
* @author quyixiao
* @since 2020-09-15
* @since 2020-10-23
*/
@Data
@TableName("lz_result_record")
@ApiModel(value = "业绩记录表")
public class ResultRecord implements java.io.Serializable {
//
@TableId(value = "id", type = IdType.AUTO)
private Long id;
//是否删除状态1删除0有效
@ApiModelProperty(value = "是否删除状态1删除0有效", name = "isDelete")
private Integer isDelete;
//创建时间
@ApiModelProperty(value = "创建时间", name = "gmtCreate")
private Date gmtCreate;
//最后修改时间
@ApiModelProperty(value = "最后修改时间", name = "gmtModified")
private Date gmtModified;
//月份
@ApiModelProperty(value = "月份", name = "monthTime")
private Date monthTime;
//0.新建1 提交审批中2 拒绝, 3 侍提交 4 审批通过,5 驳回6申述7 流程终止
@ApiModelProperty(value = "0.新建1 提交审批中2 拒绝, 3 侍提交 4 审批通过,5 驳回6申述7 流程终止", name = "status")
private Integer status;
//最后得分
@ApiModelProperty(value = "最后得分", name = "lastScore")
private BigDecimal lastScore;
//总分
@ApiModelProperty(value = "总分", name = "allScore")
private BigDecimal allScore;
//备注
@ApiModelProperty(value = "备注", name = "remark")
private String remark;
//员工id
@ApiModelProperty(value = "员工id", name = "staffId")
private Long staffId;
//类型 ,1 表示提交目标2 表示提交结果
@ApiModelProperty(value = "类型 ,1 表示提交目标2 表示提交结果", name = "type")
private Integer type;
//当前审批流转所在员工 id
@ApiModelProperty(value = "当前审批流转所在员工 id", name = "flowStaffIdRole")
private String flowStaffIdRole;
//员工所在部门 id
@ApiModelProperty(value = "员工所在部门 id", name = "departmentId")
private String departmentId;
//员工所在部门名称
@ApiModelProperty(value = "员工所在部门名称", name = "departmentName")
private String departmentName;
//员工姓名
@ApiModelProperty(value = "员工姓名", name = "staffName")
private String staffName;
//当前审批的员工 id
@ApiModelProperty(value = "当前审批的员工 id", name = "currentApprovalStaffId")
private Long currentApprovalStaffId;
//当前审批的员工名以逗号隔开
@ApiModelProperty(value = "当前审批的员工名,以逗号隔开", name = "currentApprovalStaffName")
private String currentApprovalStaffName;
//等级
@ApiModelProperty(value = "等级", name = "scoreLevel")
private String scoreLevel;
//发起考核次数
@ApiModelProperty(value = "发起考核次数", name = "startId")
private Long startId;
//当前是目标确认还是评分0目标制定1目标确认2执行中3结果值录入4评分5考核结束
@ApiModelProperty(value = "当前是目标确认还是评分0目标制定1目标确认2执行中3结果值录入4评分5考核结束", name = "flowProcess")
private Integer flowProcess;
//考核组id
@ApiModelProperty(value = "考核组id", name = "evaluationId")
private Long evaluationId;
/**
*
* @return
@ -130,14 +158,14 @@ public class ResultRecord implements java.io.Serializable {
}
/**
* 0.新建1 提交审批中2 拒绝, 3 侍提交 4 审批通过,5 驳回
* 0.新建1 提交审批中2 拒绝, 3 侍提交 4 审批通过,5 驳回6申述7 流程终止
* @return
*/
public Integer getStatus() {
return status;
}
/**
* 0.新建1 提交审批中2 拒绝, 3 侍提交 4 审批通过,5 驳回
* 0.新建1 提交审批中2 拒绝, 3 侍提交 4 审批通过,5 驳回6申述7 流程终止
* @param status
*/
public void setStatus(Integer status) {
@ -324,6 +352,51 @@ public class ResultRecord implements java.io.Serializable {
this.scoreLevel = scoreLevel;
}
/**
* 发起考核次数
* @return
*/
public Long getStartId() {
return startId;
}
/**
* 发起考核次数
* @param startId
*/
public void setStartId(Long startId) {
this.startId = startId;
}
/**
* 当前是目标确认还是评分0目标制定1目标确认2执行中3结果值录入4评分5考核结束
* @return
*/
public Integer getFlowProcess() {
return flowProcess;
}
/**
* 当前是目标确认还是评分0目标制定1目标确认2执行中3结果值录入4评分5考核结束
* @param flowProcess
*/
public void setFlowProcess(Integer flowProcess) {
this.flowProcess = flowProcess;
}
/**
* 考核组id
* @return
*/
public Long getEvaluationId() {
return evaluationId;
}
/**
* 考核组id
* @param evaluationId
*/
public void setEvaluationId(Long evaluationId) {
this.evaluationId = evaluationId;
}
@Override
public String toString() {
return "ResultRecord{" +
@ -345,6 +418,9 @@ public class ResultRecord implements java.io.Serializable {
",currentApprovalStaffId=" + currentApprovalStaffId +
",currentApprovalStaffName=" + currentApprovalStaffName +
",scoreLevel=" + scoreLevel +
",startId=" + startId +
",flowProcess=" + flowProcess +
",evaluationId=" + evaluationId +
"}";
}
}

View File

@ -65,4 +65,6 @@ public interface ResultDetailService extends IService<ResultDetail> {
String getScoreLevel(double doubleValue);
List<ResultDetail> selectByRecordIdAndType(Long id, int i);
Long insertResultDetails(List<ResultDetail> resultDetails);
}

View File

@ -81,6 +81,8 @@ public class ResultDetailServiceImpl extends ServiceImpl<ResultDetailMapper, Res
private FlowRecordService flowRecordService;
static int maxInsertSQL = 100;
@Override
public Long insertResultDetail(ResultDetail resultDetail){
return resultDetailMapper.insertResultDetail(resultDetail);
@ -306,4 +308,11 @@ public class ResultDetailServiceImpl extends ServiceImpl<ResultDetailMapper, Res
return resultDetailMapper.selectByRecordIdType(id,type);
}
@Override
public Long insertResultDetails(List<ResultDetail> resultDetails){
if(resultDetails.size() <= maxInsertSQL){
return resultDetailMapper.insertResultDetails(resultDetails);
}
}
}

View File

@ -145,5 +145,35 @@
and record_id = #{recordId} and staff_id = #{staffId} and type = #{type}
</select>
<insert id="insertResultDetails" parameterType="ResultDetail" useGeneratedKeys="true" keyProperty="id" >
insert into lz_result_detail(
type,
target,
key_result,
check_weight,
check_result,
super_score,
acquire_score,
score_comment,
record_id,
staff_id,
priority,
is_delete
)values(
#{ type},
#{ target},
#{ keyResult},
#{ checkWeight},
#{ checkResult},
#{ superScore},
#{ acquireScore},
#{ scoreComment},
#{ recordId},
#{ staffId},
#{ priority},
0
)
</insert>
</mapper>

View File

@ -1,6 +1,6 @@
<?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.lz.modules.sys.dao.app.ResultRecordMapper">
<mapper namespace="com.lz.modules.app.dao.ResultRecordMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.lz.modules.sys.entity.app.ResultRecord">
@ -22,12 +22,15 @@
<result column="current_approval_staff_id" property="currentApprovalStaffId"/>
<result column="current_approval_staff_name" property="currentApprovalStaffName"/>
<result column="score_level" property="scoreLevel"/>
<result column="start_id" property="startId"/>
<result column="flow_process" property="flowProcess"/>
<result column="evaluation_id" property="evaluationId"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, month_time AS monthTime, status AS status, last_score AS lastScore, all_score AS allScore, remark AS remark, staff_id AS staffId, type AS type, flow_staff_id_role AS flowStaffIdRole, department_id AS departmentId, department_name AS departmentName, staff_name AS staffName, current_approval_staff_id AS currentApprovalStaffId, current_approval_staff_name AS currentApprovalStaffName, score_level AS scoreLevel
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, month_time AS monthTime, status AS status, last_score AS lastScore, all_score AS allScore, remark AS remark, staff_id AS staffId, type AS type, flow_staff_id_role AS flowStaffIdRole, department_id AS departmentId, department_name AS departmentName, staff_name AS staffName, current_approval_staff_id AS currentApprovalStaffId, current_approval_staff_name AS currentApprovalStaffName, score_level AS scoreLevel, start_id AS startId, flow_process AS flowProcess, evaluation_id AS evaluationId
</sql>
@ -54,6 +57,9 @@
<if test="currentApprovalStaffId != null">current_approval_staff_id, </if>
<if test="currentApprovalStaffName != null">current_approval_staff_name, </if>
<if test="scoreLevel != null">score_level, </if>
<if test="startId != null">start_id, </if>
<if test="flowProcess != null">flow_process, </if>
<if test="evaluationId != null">evaluation_id, </if>
is_delete,
gmt_create,
gmt_modified
@ -72,6 +78,9 @@
<if test="currentApprovalStaffId != null">#{ currentApprovalStaffId}, </if>
<if test="currentApprovalStaffName != null">#{ currentApprovalStaffName}, </if>
<if test="scoreLevel != null">#{ scoreLevel}, </if>
<if test="startId != null">#{ startId}, </if>
<if test="flowProcess != null">#{ flowProcess}, </if>
<if test="evaluationId != null">#{ evaluationId}, </if>
0,
now(),
now()
@ -98,7 +107,10 @@
<if test="staffName != null">staff_name = #{staffName},</if>
<if test="currentApprovalStaffId != null">current_approval_staff_id = #{currentApprovalStaffId},</if>
<if test="currentApprovalStaffName != null">current_approval_staff_name = #{currentApprovalStaffName},</if>
<if test="scoreLevel != null">score_level = #{scoreLevel}</if>
<if test="scoreLevel != null">score_level = #{scoreLevel},</if>
<if test="startId != null">start_id = #{startId},</if>
<if test="flowProcess != null">flow_process = #{flowProcess},</if>
<if test="evaluationId != null">evaluation_id = #{evaluationId}</if>
</trim>
,gmt_modified = now()
where id = #{id}
@ -124,7 +136,10 @@
staff_name = #{staffName},
current_approval_staff_id = #{currentApprovalStaffId},
current_approval_staff_name = #{currentApprovalStaffName},
score_level = #{scoreLevel}
score_level = #{scoreLevel},
start_id = #{startId},
flow_process = #{flowProcess},
evaluation_id = #{evaluationId}
,gmt_modified = now()
where id = #{id}
</update>
@ -134,7 +149,6 @@
update lz_result_record set is_delete = 1 where id=#{id} limit 1
</update>
<update id="deleteResultRecordById2" parameterType="java.lang.Long">
update lz_result_record set is_delete = 2 where id=#{id} limit 1
</update>
@ -244,10 +258,10 @@
a GROUP by id
<choose>
<when test="req.statusList != null and req.statusList.size() > 0">
order by department_id desc
order by department_id desc
</when>
<otherwise>
order by id desc
order by id desc
</otherwise>
</choose>

View File

@ -13,19 +13,20 @@
<result column="staff_id" property="staffId"/>
<result column="type" property="type"/>
<result column="score" property="score"/>
<result column="evaluation_name" property="evaluationName"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, evaluation_id AS evaluationId, start_id AS startId, staff_id AS staffId, type AS type, score AS score
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, evaluation_id AS evaluationId, start_id AS startId, staff_id AS staffId, type AS type, score AS score, evaluation_name AS evaluationName
</sql>
<select id="selectEvaluationStartStaffById" resultType="EvaluationStartStaff" >
select * from lz_evaluation_start_staff where id=#{id} and is_delete = 0 limit 1
select * from lz_evaluation_start_staff where id=#{id} and is_delete = 0 limit 1
</select>
@ -36,6 +37,7 @@
<if test="staffId != null">staff_id, </if>
<if test="type != null">type, </if>
<if test="score != null">score, </if>
<if test="evaluationName != null">evaluation_name, </if>
is_delete,
gmt_create,
gmt_modified
@ -45,6 +47,7 @@
<if test="staffId != null">#{ staffId}, </if>
<if test="type != null">#{ type}, </if>
<if test="score != null">#{ score}, </if>
<if test="evaluationName != null">#{ evaluationName}, </if>
0,
now(),
now()
@ -62,7 +65,8 @@
<if test="startId != null">start_id = #{startId},</if>
<if test="staffId != null">staff_id = #{staffId},</if>
<if test="type != null">type = #{type},</if>
<if test="score != null">score = #{score}</if>
<if test="score != null">score = #{score},</if>
<if test="evaluationName != null">evaluation_name = #{evaluationName}</if>
</trim>
,gmt_modified = now()
where id = #{id}
@ -71,22 +75,25 @@
<update id="updateCoverEvaluationStartStaffById" parameterType="EvaluationStartStaff" >
update
lz_evaluation_start_staff
lz_evaluation_start_staff
set
is_delete = #{isDelete},
gmt_create = #{gmtCreate},
evaluation_id = #{evaluationId},
start_id = #{startId},
staff_id = #{staffId},
type = #{type},
score = #{score}
is_delete = #{isDelete},
gmt_create = #{gmtCreate},
evaluation_id = #{evaluationId},
start_id = #{startId},
staff_id = #{staffId},
type = #{type},
score = #{score},
evaluation_name = #{evaluationName}
,gmt_modified = now()
where id = #{id}
</update>
<update id="deleteEvaluationStartStaffById" parameterType="java.lang.Long">
update lz_evaluation_start_staff set is_delete = 1 where id=#{id} limit 1
update lz_evaluation_start_staff set is_delete = 1 where id=#{id} limit 1
</update>
<insert id="insertEvaluationStartStaffs" parameterType="EvaluationStartStaff" useGeneratedKeys="true" keyProperty="id" >
insert into lz_evaluation_start_staff(
@ -94,6 +101,7 @@
start_id,
staff_id,
type,
evaluation_name,
is_delete
)values
<foreach collection="list" item="item" separator=",">(
@ -101,6 +109,7 @@
#{ item.startId},
#{ item.staffId},
#{ item.type},
#{ item.evaluationName},
0
)
</foreach>

View File

@ -14,50 +14,53 @@
<result column="flow_id" property="flowId"/>
<result column="step_type" property="stepType"/>
<result column="approval_type" property="approvalType"/>
<result column="step_index" property="stepIndex"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, approval_id AS approvalId, type AS type, role_id AS roleId, flow_id AS flowId, step_type AS stepType, approval_type AS approvalType
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, approval_id AS approvalId, type AS type, role_id AS roleId, flow_id AS flowId, step_type AS stepType, approval_type AS approvalType, step_index AS stepIndex
</sql>
<select id="selectFlowApprovalRoleById" resultType="FlowApprovalRole" >
select * from lz_flow_approval_role where id=#{id} and is_delete = 0 limit 1
select * from lz_flow_approval_role where id=#{id} and is_delete = 0 limit 1
</select>
<insert id="insertFlowApprovalRole" parameterType="FlowApprovalRole" useGeneratedKeys="true" keyProperty="id" >
insert into lz_flow_approval_role(
<if test="approvalId != null">approval_id, </if>
<if test="type != null">type, </if>
<if test="roleId != null">role_id, </if>
<if test="flowId != null">flow_id, </if>
<if test="stepType != null">step_type, </if>
<if test="approvalType != null">approval_type, </if>
is_delete,
gmt_create,
gmt_modified
<if test="approvalId != null">approval_id, </if>
<if test="type != null">type, </if>
<if test="roleId != null">role_id, </if>
<if test="flowId != null">flow_id, </if>
<if test="stepType != null">step_type, </if>
<if test="approvalType != null">approval_type, </if>
<if test="stepIndex != null">step_index, </if>
is_delete,
gmt_create,
gmt_modified
)values(
<if test="approvalId != null">#{ approvalId}, </if>
<if test="type != null">#{ type}, </if>
<if test="roleId != null">#{ roleId}, </if>
<if test="flowId != null">#{ flowId}, </if>
<if test="stepType != null">#{ stepType}, </if>
<if test="approvalType != null">#{ approvalType}, </if>
0,
now(),
now()
<if test="approvalId != null">#{ approvalId}, </if>
<if test="type != null">#{ type}, </if>
<if test="roleId != null">#{ roleId}, </if>
<if test="flowId != null">#{ flowId}, </if>
<if test="stepType != null">#{ stepType}, </if>
<if test="approvalType != null">#{ approvalType}, </if>
<if test="stepIndex != null">#{ stepIndex}, </if>
0,
now(),
now()
)
</insert>
<update id="updateFlowApprovalRoleById" parameterType="FlowApprovalRole" >
update
lz_flow_approval_role
lz_flow_approval_role
<trim prefix="set" suffixOverrides=",">
<if test="isDelete != null">is_delete = #{isDelete},</if>
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if>
@ -66,7 +69,8 @@
<if test="roleId != null">role_id = #{roleId},</if>
<if test="flowId != null">flow_id = #{flowId},</if>
<if test="stepType != null">step_type = #{stepType},</if>
<if test="approvalType != null">approval_type = #{approvalType}</if>
<if test="approvalType != null">approval_type = #{approvalType},</if>
<if test="stepIndex != null">step_index = #{stepIndex}</if>
</trim>
,gmt_modified = now()
where id = #{id}
@ -75,8 +79,8 @@
<update id="updateCoverFlowApprovalRoleById" parameterType="FlowApprovalRole" >
update
lz_flow_approval_role
set
lz_flow_approval_role
set
is_delete = #{isDelete},
gmt_create = #{gmtCreate},
approval_id = #{approvalId},
@ -84,7 +88,8 @@
role_id = #{roleId},
flow_id = #{flowId},
step_type = #{stepType},
approval_type = #{approvalType}
approval_type = #{approvalType},
step_index = #{stepIndex}
,gmt_modified = now()
where id = #{id}
</update>
@ -103,6 +108,7 @@
flow_id,
step_type,
approval_type,
step_index,
is_delete
)values
<foreach collection="list" item="item" separator=",">(
@ -112,6 +118,7 @@
#{ item.flowId},
#{ item.stepType},
#{ item.approvalType},
#{ item.stepIndex},
0
)
</foreach>

View File

@ -154,7 +154,21 @@
where d1.department_id = #{departmentId}
</select>
<select id="selectEntityByDepartmentIds" resultType="com.lz.modules.app.entity.DepartmentsEntity">
select * from lz_departments where department_id in (
<foreach collection="dIds" item="item" separator=",">
#{item}
</foreach>
)
</select>
<select id="selectEntityByParentDepartmentIds" resultType="com.lz.modules.app.entity.DepartmentsEntity">
select * from lz_departments where department_parent_id in (
<foreach collection="dIds" item="item" separator=",">
#{item.departmentId}
</foreach>
)
</select>
</mapper>

View File

@ -479,4 +479,26 @@
join lz_staff_occupation occ on jj.staff_id=occ.staff_id where occ.staff_status=0 and occ.is_delete=0
</select>
<select id="selectAllStaffSimpleInfos" resultType="com.lz.modules.app.entity.StaffSimpleInfo">
select staff.id as id, staff.job_number as job_number, staff.name as name, occupation.position as position
, #{depart.departmentId} as department_id, #{depart.departmentName} as department_name
from lz_staff staff join lz_staff_occupation occupation on staff.id=occupation.staff_id where staff.id in (
select staff_id from lz_departments_staff_relate where department_id = #{depart.departmentId}
) and occupation.staff_status=0
</select>
<select id="selectStaffSimpleInfos" resultType="com.lz.modules.app.entity.StaffSimpleInfo">
select info.id as id, info.job_number as job_number, info.name as name, info.position,
info.department_id as department_id, dep.department_name as department_name from (
select staffinfo.id as id, staffinfo.job_number as job_number, staffinfo.name as name,
staffinfo.position, relate.department_id as department_id from (
select staff.id as id, staff.job_number as job_number, staff.name as name, occupation.position as position
from lz_staff staff join lz_staff_occupation occupation on staff.id=occupation.staff_id where staff.id in (
<foreach collection="sIds" item="item" separator=",">
#{item}
</foreach>
) and occupation.staff_status=0
) as staffinfo left join lz_departments_staff_relate relate on staffinfo.id = relate.staff_id
) as info left join lz_departments dep on info.department_id = dep.department_id GROUP BY info.id
</select>
</mapper>

View File

@ -5,9 +5,9 @@ import org.springframework.util.ResourceUtils;
import java.io.File;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class MysqlMain {
@ -51,6 +51,20 @@ public class MysqlMain {
*/
public static void main(String[] args) throws Exception {
/*List<TestMap> testMaps = new ArrayList<>();
TestMap test = new TestMap();
test.setName("123");
test.setMobile("18969093321");
testMaps.add(test);
test = new TestMap();
test.setName("123");
test.setMobile("18969093321");
testMaps.add(test);
Map<String, TestMap> t = testMaps.stream().collect(Collectors.toMap(TestMap::getName, testMap -> testMap));*/
String path = ResourceUtils.getURL("classpath:").getPath();
System.out.println(path);
String dir = null;
@ -82,7 +96,7 @@ public class MysqlMain {
//list.add(new TablesBean("lz_flow_chart_detail_record"));
//list.add(new TablesBean("lz_flow_approval_role"));
list.add(new TablesBean("lz_flow"));
list.add(new TablesBean("lz_evaluation_start_staff"));
List<TablesBean> list2 = new ArrayList<TablesBean>();
Map<String, String> map = MysqlUtil2ShowCreateTable.getComments();