Merge branch 'version_performance_2.0' of http://gitlab.ldxinyong.com/enterpriseManagement/lz_management into version_performance_2.0

This commit is contained in:
杜建超 2020-11-02 18:16:24 +08:00
commit 1bc0cc2495
30 changed files with 497 additions and 40 deletions

View File

@ -683,4 +683,34 @@ public class StringUtil extends StringUtils {
} }
return list; return list;
} }
public static List<Long> getLongList(String evaluationGroupInfoStr) {
List<Long> longList = new ArrayList<>();
if (StringUtil.isNotBlank(evaluationGroupInfoStr)) {
String[] ids = evaluationGroupInfoStr.split(",");
if (ids != null && ids.length > 0) {
for (String id : ids) {
if (StringUtil.isNotBlank(id)) {
longList.add(NumberUtil.objToLongDefault(id, 0l));
}
}
}
}
return longList;
}
public static List<String> getStringList(String evaluationGroupInfoStr) {
List<String> longList = new ArrayList<>();
if (StringUtil.isNotBlank(evaluationGroupInfoStr)) {
String[] ids = evaluationGroupInfoStr.split(",");
if (ids != null && ids.length > 0) {
for (String id : ids) {
if (StringUtil.isNotBlank(id)) {
longList.add(id);
}
}
}
}
return longList;
}
} }

View File

@ -210,10 +210,30 @@ public class StaffRoleController {
return staffRoleService.selectRoleInfoBy(roleModel); return staffRoleService.selectRoleInfoBy(roleModel);
} }
// http://localhost:8080/lz_management/user/lzstaffrole/role/detail // http://localhost:8080/lz_management/user/lzstaffrole/role/detail?id=4
@RequestMapping("/role/detail") @RequestMapping("/role/detail")
public R roleDetail(RoleModel roleModel) { public R roleDetail(RoleModel roleModel) {
return staffRoleService.selectRoleDetail(roleModel); return staffRoleService.selectRoleDetail(roleModel);
} }
// 老板add :http://localhost:8080/lz_management/user/lzstaffrole/role/addOrUpdate?departmentLevel=BOSS&staffId=294
// 老板edit :http://localhost:8080/lz_management/user/lzstaffrole/role/addOrUpdate?id=24&staffId=294
// 普通add: http://localhost:8080/lz_management/user/lzstaffrole/role/addOrUpdate?departmentLevel=CHILD_PM&staffId=28&evaluationGroupId=1&evaluationGroupInfoStr=2,3&departmentId=2&departmentInfoStr=154332270,379635019&selectStaffMenuInfoStr=15,17
// 普通add: http://localhost:8080/lz_management/user/lzstaffrole/role/addOrUpdate?id=26&evaluationGroupId=1&evaluationGroupInfoStr=2,4&departmentId=2&departmentInfoStr=154332270,379635019&selectStaffMenuInfoStr=15,17
// 主管理员add:http://localhost:8080/lz_management/user/lzstaffrole/role/addOrUpdate?departmentLevel=MASTER_PM&staffId=294
// 主管理员edit:http://localhost:8080/lz_management/user/lzstaffrole/role/addOrUpdate?id=19&staffId=303
@RequestMapping("/role/addOrUpdate")
public R roleAddOrUpdate(RoleModel roleModel) {
return staffRoleService.roleAddOrUpdate(roleModel);
}
// http://localhost:8080/lz_management/user/lzstaffrole/role/delete?id=26
@RequestMapping("/role/delete")
public R roleDelete(RoleModel roleModel) {
return staffRoleService.delete(roleModel);
}
} }

View File

@ -0,0 +1,4 @@
package com.lz.modules.app.dto;
public class DepartmentInfo {
}

View File

@ -0,0 +1,10 @@
package com.lz.modules.app.dto;
import lombok.Data;
@Data
public class EvaluationGroupInfo {
private int id ;
private String name;
private int isSelect;
}

View File

@ -0,0 +1,4 @@
package com.lz.modules.app.dto;
public class StaffMenuInfo {
}

View File

@ -0,0 +1,19 @@
package com.lz.modules.app.dto;
import com.lz.modules.flow.entity.StaffMenu;
import com.lz.modules.flow.entity.StaffRoleDepartment;
import lombok.Data;
import java.util.List;
@Data
public class StaffRoleDetailInfo {
private Long staffId;
//0表示全部组1表示特定组
private Long evaluationGroupId;
private List<EvaluationGroupInfo> evaluationGroupInfos;
private Long departmentId;
private List<StaffRoleDepartment> departmentInfos;
private List<StaffMenu> staffMenuInfos;
private List<Long> selectStaffMenuInfos;
}

View File

@ -0,0 +1,32 @@
package com.lz.modules.app.enums;
public enum DepartmentPMEnums {
ALL(0l,"全公司"),
SELF_DEPARTMENT(1l,"所在部门及以下部门"),
SPECIAL_DEPARTMENT(2l,"特定部门");
private Long type ;
private String desc;
DepartmentPMEnums(Long type, String desc) {
this.type = type;
this.desc = desc;
}
public Long getType() {
return type;
}
public void setType(Long type) {
this.type = type;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
}

View File

@ -0,0 +1,32 @@
package com.lz.modules.app.enums;
public enum EvaluationGroupEnums {
ALL(0l,"全部考评组"),
SELF_DEPARTMENT(1l,"特定考评组");
private Long type ;
private String desc;
EvaluationGroupEnums(Long type, String desc) {
this.type = type;
this.desc = desc;
}
public Long getType() {
return type;
}
public void setType(Long type) {
this.type = type;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
}

View File

@ -0,0 +1,34 @@
package com.lz.modules.app.enums;
public enum RoleMenuEnums {
MASTER_PM(-1l,"绩效管理员"),
BOSS(-2l,"企业负责人"),
DEPARTMENT_PM(-3l,"部门主管"),
COMMON_STAFF(-4l,"普通员工");
private Long type ;
private String desc;
RoleMenuEnums(Long type, String desc) {
this.type = type;
this.desc = desc;
}
public Long getType() {
return type;
}
public void setType(Long type) {
this.type = type;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
}

View File

@ -7,5 +7,11 @@ public class RoleModel {
private int currPage = 1; private int currPage = 1;
private int pageSize = 10; private int pageSize = 10;
private Long id; private Long id;
private Long staffId;
private Long evaluationGroupId;
private String evaluationGroupInfoStr;
private Long departmentId;
private String departmentInfoStr;
private String selectStaffMenuInfoStr;
private String departmentLevel;
} }

View File

@ -11,6 +11,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lz.modules.flow.entity.StaffMenu; import com.lz.modules.flow.entity.StaffMenu;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper @Mapper
public interface StaffMenuMapper extends BaseMapper<StaffMenu> { public interface StaffMenuMapper extends BaseMapper<StaffMenu> {
@ -30,4 +33,7 @@ public interface StaffMenuMapper extends BaseMapper<StaffMenu> {
int deleteStaffMenuById(@Param("id") Long id); int deleteStaffMenuById(@Param("id") Long id);
List<StaffMenu> selctAll();
List<StaffMenu> selectByParentId(@Param("parentId") Long parentId);
} }

View File

@ -45,4 +45,6 @@ public interface StaffRoleDepartmentMapper extends BaseMapper<StaffRoleDepartmen
List<StaffRoleDepartment> selectStaffRoleDepartmentByStaffRoleIdDepartments(@Param("staffRoleId") Long staffRoleId, @Param("departments") List<String> departments); List<StaffRoleDepartment> selectStaffRoleDepartmentByStaffRoleIdDepartments(@Param("staffRoleId") Long staffRoleId, @Param("departments") List<String> departments);
List<DepartmentsSimpleDto> selectDepartmentSimpleInfos(@Param("ids") List<String> ids); List<DepartmentsSimpleDto> selectDepartmentSimpleInfos(@Param("ids") List<String> ids);
void deleteStaffRoleDepartmentByRoleId(@Param("roleId") Long roleId);
} }

View File

@ -8,6 +8,7 @@ package com.lz.modules.flow.dao;
* @since 2020-11-02 * @since 2020-11-02
*/ */
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lz.modules.app.dto.EvaluationGroupInfo;
import com.lz.modules.flow.entity.StaffRoleEvaluationGroup; import com.lz.modules.flow.entity.StaffRoleEvaluationGroup;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -32,7 +33,10 @@ public interface StaffRoleEvaluationGroupMapper extends BaseMapper<StaffRoleEval
int deleteStaffRoleEvaluationGroupById(@Param("id") Long id); int deleteStaffRoleEvaluationGroupById(@Param("id") Long id);
List<EvaluationGroupInfo> selectStaffRoleEvaluationGroupBy(@Param("roleId") Long roleId);
List<Long> selectEvaluationGroupIdsByRoleId(@Param("roleId")Long roleId); List<Long> selectEvaluationGroupIdsByRoleId(@Param("roleId")Long roleId);
void deleteStaffRoleEvaluationGroupByRoleId(@Param("roleId") Long roleId);
} }

View File

@ -35,4 +35,6 @@ public interface StaffRoleMenuMapper extends BaseMapper<StaffRoleMenu> {
List<StaffMenu> selectByRoleId(@Param("roleId") Long roleId); List<StaffMenu> selectByRoleId(@Param("roleId") Long roleId);
void deleteStaffRoleMenuByRoleId(@Param("roleId") Long roleId);
} }

View File

@ -1,11 +1,16 @@
package com.lz.modules.flow.entity; package com.lz.modules.flow.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* <p> * <p>
* </p>*绩效管理菜单表 * </p>*绩效管理菜单表
@ -38,6 +43,8 @@ public class StaffMenu implements java.io.Serializable {
//授权 id //授权 id
@ApiModelProperty(value = "授权 id", name = "authIds") @ApiModelProperty(value = "授权 id", name = "authIds")
private Long authIds; private Long authIds;
@TableField(exist=false)
private List<StaffMenu> childs;
/** /**
* *
* @return * @return

View File

@ -1,33 +1,43 @@
package com.lz.modules.flow.entity; package com.lz.modules.flow.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; 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 lombok.Data;
import java.util.Date; import java.util.Date;
/** /**
* <p> * <p>
* 菜单权限表
* </p>*流转关系表 * </p>*流转关系表
* @author quyixiao * @author quyixiao
* @since 2020-08-18 * @since 2020-11-02
*/ */
@Data @Data
@TableName("lz_staff_role_department") @TableName("lz_staff_role_department")
@ApiModel(value = "流转关系表")
public class StaffRoleDepartment implements java.io.Serializable { public class StaffRoleDepartment implements java.io.Serializable {
// //
@TableId(value = "id", type = IdType.AUTO) @TableId(value = "id", type = IdType.AUTO)
private Long id; private Long id;
//是否删除状态1删除0有效 //是否删除状态1删除0有效
@ApiModelProperty(value = "是否删除状态1删除0有效", name = "isDelete")
private Integer isDelete; private Integer isDelete;
//创建时间 //创建时间
@ApiModelProperty(value = "创建时间", name = "gmtCreate")
private Date gmtCreate; private Date gmtCreate;
//最后修改时间 //最后修改时间
@ApiModelProperty(value = "最后修改时间", name = "gmtModified")
private Date gmtModified; private Date gmtModified;
// //角色 id
@ApiModelProperty(value = "角色 id", name = "staffRoleId")
private Long staffRoleId; private Long staffRoleId;
// //部门 id
@ApiModelProperty(value = "部门 id", name = "departmentId")
private String departmentId; private String departmentId;
//部门名称
@ApiModelProperty(value = "部门名称", name = "departmentName")
private String departmentName;
/** /**
* *
* @return * @return
@ -89,14 +99,14 @@ public class StaffRoleDepartment implements java.io.Serializable {
} }
/** /**
* * 角色 id
* @return * @return
*/ */
public Long getStaffRoleId() { public Long getStaffRoleId() {
return staffRoleId; return staffRoleId;
} }
/** /**
* * 角色 id
* @param staffRoleId * @param staffRoleId
*/ */
public void setStaffRoleId(Long staffRoleId) { public void setStaffRoleId(Long staffRoleId) {
@ -104,20 +114,35 @@ public class StaffRoleDepartment implements java.io.Serializable {
} }
/** /**
* * 部门 id
* @return * @return
*/ */
public String getDepartmentId() { public String getDepartmentId() {
return departmentId; return departmentId;
} }
/** /**
* * 部门 id
* @param departmentId * @param departmentId
*/ */
public void setDepartmentId(String departmentId) { public void setDepartmentId(String departmentId) {
this.departmentId = departmentId; this.departmentId = departmentId;
} }
/**
* 部门名称
* @return
*/
public String getDepartmentName() {
return departmentName;
}
/**
* 部门名称
* @param departmentName
*/
public void setDepartmentName(String departmentName) {
this.departmentName = departmentName;
}
@Override @Override
public String toString() { public String toString() {
return "StaffRoleDepartment{" + return "StaffRoleDepartment{" +
@ -127,6 +152,7 @@ public class StaffRoleDepartment implements java.io.Serializable {
",gmtModified=" + gmtModified + ",gmtModified=" + gmtModified +
",staffRoleId=" + staffRoleId + ",staffRoleId=" + staffRoleId +
",departmentId=" + departmentId + ",departmentId=" + departmentId +
",departmentName=" + departmentName +
"}"; "}";
} }
} }

View File

@ -3,6 +3,8 @@ package com.lz.modules.flow.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.lz.modules.flow.entity.StaffMenu; import com.lz.modules.flow.entity.StaffMenu;
import java.util.List;
/** /**
* <p> * <p>
* 绩效管理菜单表 服务类 * 绩效管理菜单表 服务类
@ -30,4 +32,7 @@ public interface StaffMenuService extends IService<StaffMenu> {
int deleteStaffMenuById(Long id); int deleteStaffMenuById(Long id);
List<StaffMenu> selectAll();
List<StaffMenu> selectByParentId(Long parentId);
} }

View File

@ -42,4 +42,6 @@ public interface StaffRoleDepartmentService extends IService<StaffRoleDepartment
void deleteStaffRoleDepartment(Long id); void deleteStaffRoleDepartment(Long id);
List<DepartmentsSimpleDto> selectDepartmentSimpleInfos(List<String> ids); List<DepartmentsSimpleDto> selectDepartmentSimpleInfos(List<String> ids);
void deleteStaffRoleDepartmentByRoleId(Long roleId);
} }

View File

@ -1,6 +1,7 @@
package com.lz.modules.flow.service; package com.lz.modules.flow.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.lz.modules.app.dto.EvaluationGroupInfo;
import com.lz.modules.flow.entity.StaffRoleEvaluationGroup; import com.lz.modules.flow.entity.StaffRoleEvaluationGroup;
import java.util.List; import java.util.List;
@ -34,4 +35,7 @@ public interface StaffRoleEvaluationGroupService extends IService<StaffRoleEvalu
List<Long> selectEvaluationGroupIdsByRoleId(Long roleId); List<Long> selectEvaluationGroupIdsByRoleId(Long roleId);
List<EvaluationGroupInfo> selectStaffRoleEvaluationGroupBy(Long id);
void deleteStaffRoleEvaluationGroupByRoleId(Long roleId);
} }

View File

@ -34,4 +34,6 @@ public interface StaffRoleMenuService extends IService<StaffRoleMenu> {
List<StaffMenu> selectByRoleId(Long id); List<StaffMenu> selectByRoleId(Long id);
void deleteStaffRoleMenuByRoleId(Long roleId);
} }

View File

@ -57,4 +57,8 @@ public interface StaffRoleService extends IService<StaffRole> {
R selectRoleInfoBy(RoleModel roleModel); R selectRoleInfoBy(RoleModel roleModel);
R selectRoleDetail(RoleModel roleModel); R selectRoleDetail(RoleModel roleModel);
R roleAddOrUpdate(RoleModel roleModel);
R delete(RoleModel roleModel);
} }

View File

@ -7,6 +7,8 @@ import com.lz.modules.flow.service.StaffMenuService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* <p> * <p>
* 绩效管理菜单表 服务类 * 绩效管理菜单表 服务类
@ -58,6 +60,15 @@ public class StaffMenuServiceImpl extends ServiceImpl<StaffMenuMapper, StaffMenu
return staffMenuMapper.deleteStaffMenuById(id); return staffMenuMapper.deleteStaffMenuById(id);
} }
@Override
public List<StaffMenu> selectAll() {
return staffMenuMapper.selctAll();
}
@Override
public List<StaffMenu> selectByParentId(Long parentId) {
return staffMenuMapper.selectByParentId(parentId);
}
} }

View File

@ -86,5 +86,10 @@ public class StaffRoleDepartmentServiceImpl extends ServiceImpl<StaffRoleDepartm
return staffRoleDepartmentMapper.selectDepartmentSimpleInfos(ids); return staffRoleDepartmentMapper.selectDepartmentSimpleInfos(ids);
} }
@Override
public void deleteStaffRoleDepartmentByRoleId(Long roleId) {
staffRoleDepartmentMapper.deleteStaffRoleDepartmentByRoleId(roleId);
}
} }

View File

@ -1,6 +1,7 @@
package com.lz.modules.flow.service.impl; package com.lz.modules.flow.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lz.modules.app.dto.EvaluationGroupInfo;
import com.lz.modules.flow.dao.StaffRoleEvaluationGroupMapper; import com.lz.modules.flow.dao.StaffRoleEvaluationGroupMapper;
import com.lz.modules.flow.entity.StaffRoleEvaluationGroup; import com.lz.modules.flow.entity.StaffRoleEvaluationGroup;
import com.lz.modules.flow.service.StaffRoleEvaluationGroupService; import com.lz.modules.flow.service.StaffRoleEvaluationGroupService;
@ -60,6 +61,15 @@ public class StaffRoleEvaluationGroupServiceImpl extends ServiceImpl<StaffRoleEv
return staffRoleEvaluationGroupMapper.deleteStaffRoleEvaluationGroupById(id); return staffRoleEvaluationGroupMapper.deleteStaffRoleEvaluationGroupById(id);
} }
@Override
public List<EvaluationGroupInfo> selectStaffRoleEvaluationGroupBy(Long roleId) {
return staffRoleEvaluationGroupMapper.selectStaffRoleEvaluationGroupBy(roleId);
}
@Override
public void deleteStaffRoleEvaluationGroupByRoleId(Long roleId) {
staffRoleEvaluationGroupMapper.deleteStaffRoleEvaluationGroupByRoleId(roleId);
}
@Override @Override
public List<Long> selectEvaluationGroupIdsByRoleId(Long roleId) { public List<Long> selectEvaluationGroupIdsByRoleId(Long roleId) {

View File

@ -66,5 +66,10 @@ public class StaffRoleMenuServiceImpl extends ServiceImpl<StaffRoleMenuMapper, S
return staffRoleMenuMapper.selectByRoleId(roleId); return staffRoleMenuMapper.selectByRoleId(roleId);
} }
@Override
public void deleteStaffRoleMenuByRoleId(Long roleId) {
staffRoleMenuMapper.deleteStaffRoleMenuByRoleId(roleId);
}
} }

View File

@ -9,25 +9,25 @@ import com.lz.common.utils.R;
import com.lz.common.utils.StringUtil; import com.lz.common.utils.StringUtil;
import com.lz.modules.app.dao.DepartmentsDao; import com.lz.modules.app.dao.DepartmentsDao;
import com.lz.modules.app.dao.StaffDao; import com.lz.modules.app.dao.StaffDao;
import com.lz.modules.app.dto.EvaluationGroupInfo;
import com.lz.modules.app.dto.StaffRoleDetailInfo;
import com.lz.modules.app.dto.StaffRoleInfo; import com.lz.modules.app.dto.StaffRoleInfo;
import com.lz.modules.app.dto.StaffRoleResp; import com.lz.modules.app.dto.StaffRoleResp;
import com.lz.modules.app.entity.DepartmentsEntity; import com.lz.modules.app.entity.DepartmentsEntity;
import com.lz.modules.app.entity.DepartmentsStaffRelateEntity; import com.lz.modules.app.entity.DepartmentsStaffRelateEntity;
import com.lz.modules.app.entity.StaffEntity; import com.lz.modules.app.entity.StaffEntity;
import com.lz.modules.app.enums.DepartmentPMEnums;
import com.lz.modules.app.enums.EvaluationGroupEnums;
import com.lz.modules.app.enums.RoleEnums; import com.lz.modules.app.enums.RoleEnums;
import com.lz.modules.app.enums.RoleMenuEnums;
import com.lz.modules.app.model.RoleModel; import com.lz.modules.app.model.RoleModel;
import com.lz.modules.app.service.DepartmentsService; import com.lz.modules.app.service.DepartmentsService;
import com.lz.modules.app.service.DepartmentsStaffRelateService; import com.lz.modules.app.service.DepartmentsStaffRelateService;
import com.lz.modules.flow.dao.RecordRoleMapper; import com.lz.modules.flow.dao.RecordRoleMapper;
import com.lz.modules.flow.dao.StaffRoleDepartmentMapper; import com.lz.modules.flow.dao.StaffRoleDepartmentMapper;
import com.lz.modules.flow.dao.StaffRoleMapper; import com.lz.modules.flow.dao.StaffRoleMapper;
import com.lz.modules.flow.entity.RecordRole; import com.lz.modules.flow.entity.*;
import com.lz.modules.flow.entity.StaffMenu; import com.lz.modules.flow.service.*;
import com.lz.modules.flow.entity.StaffRole;
import com.lz.modules.flow.entity.StaffRoleDepartment;
import com.lz.modules.flow.service.RecordRoleService;
import com.lz.modules.flow.service.StaffRoleMenuService;
import com.lz.modules.flow.service.StaffRoleService;
import com.lz.modules.sys.entity.SysMenuEntity; import com.lz.modules.sys.entity.SysMenuEntity;
import com.lz.modules.sys.entity.SysRoleEntity; import com.lz.modules.sys.entity.SysRoleEntity;
import com.lz.modules.sys.service.app.ResultRecordService; import com.lz.modules.sys.service.app.ResultRecordService;
@ -86,6 +86,15 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
@Autowired @Autowired
private StaffRoleMenuService staffRoleMenuService; private StaffRoleMenuService staffRoleMenuService;
@Autowired
private StaffRoleEvaluationGroupService staffRoleEvaluationGroupService;
@Autowired
private StaffMenuService staffMenuService;
@Autowired
private StaffRoleDepartmentService staffRoleDepartmentService;
@Override @Override
public StaffRole selectStaffRoleById(Long id) { public StaffRole selectStaffRoleById(Long id) {
return staffRoleMapper.selectStaffRoleById(id); return staffRoleMapper.selectStaffRoleById(id);
@ -337,10 +346,132 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
@Override @Override
public R selectRoleDetail(RoleModel roleModel) { public R selectRoleDetail(RoleModel roleModel) {
if(roleModel.getId() == null){ if (roleModel.getId() == null) {
return R.error("必需传入id"); return R.error("必需传入id");
} }
return null; StaffRole staffRole = staffRoleMapper.selectById(roleModel.getId());
StaffRoleDetailInfo info = new StaffRoleDetailInfo();
BeanUtils.copyProperties(staffRole, info);
List<StaffRoleDepartment> staffRoleDepartments = staffRoleDepartmentMapper.selectStaffRoleDepartmentByStaffRoleId(staffRole.getId());
info.setDepartmentInfos(staffRoleDepartments);
List<EvaluationGroupInfo> evaluationGroupInfos = staffRoleEvaluationGroupService.selectStaffRoleEvaluationGroupBy(roleModel.getId());
info.setEvaluationGroupInfos(evaluationGroupInfos);
List<StaffMenu> all = staffMenuService.selectAll();
List<StaffMenu> roots = staffMenuService.selectByParentId(0l);
for (StaffMenu root : roots) {
getStaffMenuInfo(root, all);
}
info.setStaffMenuInfos(roots);
List<StaffMenu> staffMenus = staffRoleMenuService.selectByRoleId(staffRole.getId());
List<Long> selectStaffMenuInfos = new ArrayList<>();
for (StaffMenu staffMenu : staffMenus) {
selectStaffMenuInfos.add(staffMenu.getId());
}
info.setSelectStaffMenuInfos(selectStaffMenuInfos);
return R.ok().put("data", info);
} }
@Override
public R roleAddOrUpdate(RoleModel roleModel) {
if (roleModel.getId() == null && roleModel.getStaffId() == null) {
return R.error("请传入 id 或 员工 id ");
}
List<Long> evaluationGroupInfoIds = StringUtil.getLongList(roleModel.getEvaluationGroupInfoStr());
List<String> departmentInfoIds = StringUtil.getStringList(roleModel.getDepartmentInfoStr());
List<Long> selectStaffMenuInfoIdIds = StringUtil.getLongList(roleModel.getSelectStaffMenuInfoStr());
StaffEntity staffEntity = staffDao.selectStaffById(roleModel.getStaffId());
StaffRole staffRole = null;
if (roleModel.getId() != null) {
staffRole = staffRoleMapper.selectStaffRoleById(roleModel.getId());
//删除之前的数据
staffRoleDepartmentService.deleteStaffRoleDepartmentByRoleId(staffRole.getId());
staffRoleMenuService.deleteStaffRoleMenuByRoleId(staffRole.getId());
staffRoleEvaluationGroupService.deleteStaffRoleEvaluationGroupByRoleId(staffRole.getId());
com.lz.modules.app.utils.BeanUtils.copyProperty(staffRole, roleModel);
staffEntity = staffDao.selectStaffById(staffRole.getStaffId());
staffRole.setStaffName(staffEntity.getName());
staffRoleMapper.updateStaffRoleById(staffRole);
if (RoleEnums.BOSS.getName().equals(staffRole.getDepartmentLevel()) ||
RoleEnums.MASTER_PM.getName().equals(staffRole.getDepartmentLevel())) {
return R.ok("更新成功");
}
} else if (roleModel.getStaffId() != null) { // 员工不为空
staffRole = new StaffRole();
com.lz.modules.app.utils.BeanUtils.copyProperty(staffRole, roleModel);
staffRole.setStaffName(staffEntity.getName());
staffRoleMapper.insertStaffRole(staffRole);
}
if (RoleEnums.BOSS.getName().equals(staffRole.getDepartmentLevel())) {
insertPM(staffRole, RoleMenuEnums.BOSS.getType(), staffEntity);
} else if (RoleEnums.MASTER_PM.getName().equals(staffRole.getDepartmentLevel())) {
insertPM(staffRole, RoleMenuEnums.MASTER_PM.getType(), staffEntity);
} else if (RoleEnums.CHILD_PM.getName().equals(staffRole.getDepartmentLevel())) { //如果是子管理员
for (Long evaluationGroupId : evaluationGroupInfoIds) {
StaffRoleEvaluationGroup evaluationGroup = new StaffRoleEvaluationGroup();
evaluationGroup.setIsSelect(1);
evaluationGroup.setRoleId(staffRole.getId());
evaluationGroup.setEvaluationGroupId(evaluationGroupId);
staffRoleEvaluationGroupService.insertStaffRoleEvaluationGroup(evaluationGroup);
}
if (roleModel.getDepartmentId().equals(DepartmentPMEnums.SELF_DEPARTMENT.getType().toString())) {//如果是自己所在部门
departmentInfoIds.clear();
DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateService.selectLastDepartmentByStaffId(staffEntity.getId());
departmentInfoIds.add(departmentsStaffRelateEntity.getDepartmentId());
}
for (String deparmentId : departmentInfoIds) {
StaffRoleDepartment staffRoleDepartment = new StaffRoleDepartment();
staffRoleDepartment.setDepartmentId(deparmentId);
staffRoleDepartment.setStaffRoleId(staffRole.getId());
DepartmentsEntity departmentsEntity = departmentsDao.selectByDepartmentId(deparmentId);
staffRoleDepartment.setDepartmentName(departmentsEntity.getDepartmentName());
staffRoleDepartmentService.insertStaffRoleDepartment(staffRoleDepartment);
}
for (Long staffMenuId : selectStaffMenuInfoIdIds) {
StaffRoleMenu staffRoleMenu = new StaffRoleMenu();
staffRoleMenu.setRoleId(staffRole.getId());
staffRoleMenu.setMenuId(staffMenuId);
staffRoleMenuService.insertStaffRoleMenu(staffRoleMenu);
}
}
return R.ok();
}
@Override
public R delete(RoleModel roleModel) {
staffRoleMapper.deleteStaffRoleById(roleModel.getId());
return R.ok();
}
public void insertPM(StaffRole staffRole, Long parentId, StaffEntity staffEntity) {
staffRole.setEvaluationGroupId(EvaluationGroupEnums.ALL.getType());//全部考评组
staffRole.setDepartmentId(DepartmentPMEnums.ALL.getType());//所有部门
staffRole.setStaffName(staffEntity.getName());
List<StaffMenu> roots = staffMenuService.selectByParentId(parentId);
for (StaffMenu staffMenu : roots) {
StaffRoleMenu staffRoleMenu = new StaffRoleMenu();
staffRoleMenu.setRoleId(staffRole.getId());
staffRoleMenu.setMenuId(staffMenu.getId());
staffRoleMenuService.insertStaffRoleMenu(staffRoleMenu);
}
if (parentId.equals(RoleMenuEnums.MASTER_PM.getType())) { //如果是绩效管理员
StaffRoleEvaluationGroup staffRoleEvaluationGroup = new StaffRoleEvaluationGroup();
staffRoleEvaluationGroup.setRoleId(staffRole.getId());
staffRoleEvaluationGroup.setIsSelect(1);
staffRoleEvaluationGroupService.insertStaffRoleEvaluationGroup(staffRoleEvaluationGroup);
}
}
public void getStaffMenuInfo(StaffMenu parent, List<StaffMenu> all) {
List<StaffMenu> childs = new ArrayList<>();
for (StaffMenu child : all) {
if (child.getParentId().equals(parent.getId())) {
childs.add(child);
getStaffMenuInfo(child, all);
}
}
parent.setChilds(childs);
}
} }

View File

@ -79,5 +79,15 @@
update lz_staff_menu set is_delete = 1 where id=#{id} limit 1 update lz_staff_menu set is_delete = 1 where id=#{id} limit 1
</update> </update>
<select id="selctAll" resultType="com.lz.modules.flow.entity.StaffMenu">
select * from lz_staff_menu where is_delete = 0
</select>
<select id="selectByParentId" resultType="com.lz.modules.flow.entity.StaffMenu">
select * from lz_staff_menu where is_delete = 0 and parent_id = #{parentId}
</select>
</mapper> </mapper>

View File

@ -10,46 +10,51 @@
<result column="gmt_modified" property="gmtModified"/> <result column="gmt_modified" property="gmtModified"/>
<result column="staff_role_id" property="staffRoleId"/> <result column="staff_role_id" property="staffRoleId"/>
<result column="department_id" property="departmentId"/> <result column="department_id" property="departmentId"/>
<result column="department_name" property="departmentName"/>
</resultMap> </resultMap>
<!-- 通用查询结果列 --> <!-- 通用查询结果列 -->
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, staff_role_id AS staffRoleId, department_id AS departmentId id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, staff_role_id AS staffRoleId, department_id AS departmentId, department_name AS departmentName
</sql> </sql>
<select id="selectStaffRoleDepartmentById" resultType="StaffRoleDepartment" > <select id="selectStaffRoleDepartmentById" resultType="StaffRoleDepartment" >
select * from lz_staff_role_department where id=#{id} and is_delete = 0 limit 1 select * from lz_staff_role_department where id=#{id} and is_delete = 0 limit 1
</select> </select>
<insert id="insertStaffRoleDepartment" parameterType="StaffRoleDepartment" useGeneratedKeys="true" keyProperty="id" > <insert id="insertStaffRoleDepartment" parameterType="StaffRoleDepartment" useGeneratedKeys="true" keyProperty="id" >
insert into lz_staff_role_department( insert into lz_staff_role_department(
<if test="staffRoleId != null">staff_role_id, </if> <if test="staffRoleId != null">staff_role_id, </if>
<if test="departmentId != null">department_id, </if> <if test="departmentId != null">department_id, </if>
is_delete, <if test="departmentName != null">department_name, </if>
gmt_create, is_delete,
gmt_modified gmt_create,
gmt_modified
)values( )values(
<if test="staffRoleId != null">#{ staffRoleId}, </if> <if test="staffRoleId != null">#{ staffRoleId}, </if>
<if test="departmentId != null">#{ departmentId}, </if> <if test="departmentId != null">#{ departmentId}, </if>
0, <if test="departmentName != null">#{ departmentName}, </if>
now(), 0,
now() now(),
now()
) )
</insert> </insert>
<update id="updateStaffRoleDepartmentById" parameterType="StaffRoleDepartment" > <update id="updateStaffRoleDepartmentById" parameterType="StaffRoleDepartment" >
update update
lz_staff_role_department lz_staff_role_department
<trim prefix="set" suffixOverrides=","> <trim prefix="set" suffixOverrides=",">
<if test="isDelete != null">is_delete = #{isDelete},</if> <if test="isDelete != null">is_delete = #{isDelete},</if>
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if> <if test="gmtCreate != null">gmt_create = #{gmtCreate},</if>
<if test="staffRoleId != null">staff_role_id = #{staffRoleId},</if> <if test="staffRoleId != null">staff_role_id = #{staffRoleId},</if>
<if test="departmentId != null">department_id = #{departmentId}</if> <if test="departmentId != null">department_id = #{departmentId},</if>
<if test="departmentName != null">department_name = #{departmentName}</if>
</trim> </trim>
,gmt_modified = now() ,gmt_modified = now()
where id = #{id} where id = #{id}
@ -58,12 +63,13 @@
<update id="updateCoverStaffRoleDepartmentById" parameterType="StaffRoleDepartment" > <update id="updateCoverStaffRoleDepartmentById" parameterType="StaffRoleDepartment" >
update update
lz_staff_role_department lz_staff_role_department
set set
is_delete = #{isDelete}, is_delete = #{isDelete},
gmt_create = #{gmtCreate}, gmt_create = #{gmtCreate},
staff_role_id = #{staffRoleId}, staff_role_id = #{staffRoleId},
department_id = #{departmentId} department_id = #{departmentId},
department_name = #{departmentName}
,gmt_modified = now() ,gmt_modified = now()
where id = #{id} where id = #{id}
</update> </update>
@ -101,7 +107,6 @@
delete from lz_staff_role_department where id = #{id} delete from lz_staff_role_department where id = #{id}
</delete> </delete>
<select id="selectStaffRoleDepartmentByStaffRoleIdDepartments" <select id="selectStaffRoleDepartmentByStaffRoleIdDepartments"
resultType="com.lz.modules.flow.entity.StaffRoleDepartment"> resultType="com.lz.modules.flow.entity.StaffRoleDepartment">
select * from lz_staff_role_department where staff_role_id=#{staffRoleId} and is_delete = 0 select * from lz_staff_role_department where staff_role_id=#{staffRoleId} and is_delete = 0
@ -120,5 +125,12 @@
</foreach> </foreach>
</select> </select>
<delete id="deleteStaffRoleDepartmentByRoleId">
delete from lz_staff_role_department where staff_role_id = #{roleId}
</delete>
</mapper> </mapper>

View File

@ -21,12 +21,12 @@
<select id="selectStaffRoleEvaluationGroupById" resultType="StaffRoleEvaluationGroup" > <select id="selectStaffRoleEvaluationGroupById" resultType="StaffRoleEvaluationGroup" >
select * from lz_staff_role_evaluation_group where id=#{id} and is_delete = 0 limit 1 select * from lz_staff_role_evaluation_group where id=#{id} and is_delete = 0 limit 1
</select> </select>
<insert id="insertStaffRoleEvaluationGroup" parameterType="StaffRoleEvaluationGroup" useGeneratedKeys="true" keyProperty="id" > <insert id="insertStaffRoleEvaluationGroup" parameterType="StaffRoleEvaluationGroup" useGeneratedKeys="true" keyProperty="id" >
insert into lz_staff_role_evaluation_group( insert into lz_staff_role_evaluation_group(
<if test="roleId != null">role_id, </if> <if test="roleId != null">role_id, </if>
@ -80,6 +80,19 @@
</update> </update>
<select id="selectStaffRoleEvaluationGroupBy" resultType="com.lz.modules.app.dto.EvaluationGroupInfo">
select ev.id as id ,ev.name as name,eg.is_select as isSelect from lz_staff_role_evaluation_group eg
left join lz_evaluation_group ev on eg.evaluation_group_id = ev.id
where eg.role_id = #{roleId} and ev.is_delete = 0 and eg.is_delete = 0
</select>
<delete id="deleteStaffRoleEvaluationGroupByRoleId">
delete from lz_staff_role_evaluation_group where role_id = #{roleId}
</delete>
<select id="selectEvaluationGroupIdsByRoleId"> <select id="selectEvaluationGroupIdsByRoleId">
select evaluation_group_id from lz_staff_role_evaluation_group where is_delete = 0 and role_id = #{roleId} and is_select = 1 select evaluation_group_id from lz_staff_role_evaluation_group where is_delete = 0 and role_id = #{roleId} and is_select = 1
</select> </select>

View File

@ -20,7 +20,6 @@
<select id="selectStaffRoleMenuById" resultType="StaffRoleMenu" > <select id="selectStaffRoleMenuById" resultType="StaffRoleMenu" >
select * from lz_staff_role_menu where id=#{id} and is_delete = 0 limit 1 select * from lz_staff_role_menu where id=#{id} and is_delete = 0 limit 1
</select> </select>
@ -81,5 +80,11 @@
select * from lz_staff_menu where id in (select menu_id from lz_staff_role_menu where role_id = #{roleId}) select * from lz_staff_menu where id in (select menu_id from lz_staff_role_menu where role_id = #{roleId})
</select> </select>
<delete id="deleteStaffRoleMenuByRoleId">
delete from lz_staff_role_menu where role_id = #{roleId}
</delete>
</mapper> </mapper>