提交修改
This commit is contained in:
parent
8b6ec86a1a
commit
2459d85638
@ -683,4 +683,34 @@ public class StringUtil extends StringUtils {
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -210,10 +210,30 @@ public class StaffRoleController {
|
||||
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")
|
||||
public R roleDetail(RoleModel 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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
4
src/main/java/com/lz/modules/app/dto/DepartmentInfo.java
Normal file
4
src/main/java/com/lz/modules/app/dto/DepartmentInfo.java
Normal file
@ -0,0 +1,4 @@
|
||||
package com.lz.modules.app.dto;
|
||||
|
||||
public class DepartmentInfo {
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
4
src/main/java/com/lz/modules/app/dto/StaffMenuInfo.java
Normal file
4
src/main/java/com/lz/modules/app/dto/StaffMenuInfo.java
Normal file
@ -0,0 +1,4 @@
|
||||
package com.lz.modules.app.dto;
|
||||
|
||||
public class StaffMenuInfo {
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
34
src/main/java/com/lz/modules/app/enums/RoleMenuEnums.java
Normal file
34
src/main/java/com/lz/modules/app/enums/RoleMenuEnums.java
Normal 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;
|
||||
}
|
||||
}
|
||||
@ -7,5 +7,11 @@ public class RoleModel {
|
||||
private int currPage = 1;
|
||||
private int pageSize = 10;
|
||||
private Long id;
|
||||
|
||||
private Long staffId;
|
||||
private Long evaluationGroupId;
|
||||
private String evaluationGroupInfoStr;
|
||||
private Long departmentId;
|
||||
private String departmentInfoStr;
|
||||
private String selectStaffMenuInfoStr;
|
||||
private String departmentLevel;
|
||||
}
|
||||
|
||||
@ -11,6 +11,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.lz.modules.flow.entity.StaffMenu;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface StaffMenuMapper extends BaseMapper<StaffMenu> {
|
||||
|
||||
@ -30,4 +33,7 @@ public interface StaffMenuMapper extends BaseMapper<StaffMenu> {
|
||||
int deleteStaffMenuById(@Param("id") Long id);
|
||||
|
||||
|
||||
List<StaffMenu> selctAll();
|
||||
|
||||
List<StaffMenu> selectByParentId(@Param("parentId") Long parentId);
|
||||
}
|
||||
@ -45,4 +45,6 @@ public interface StaffRoleDepartmentMapper extends BaseMapper<StaffRoleDepartmen
|
||||
List<StaffRoleDepartment> selectStaffRoleDepartmentByStaffRoleIdDepartments(@Param("staffRoleId") Long staffRoleId, @Param("departments") List<String> departments);
|
||||
|
||||
List<DepartmentsSimpleDto> selectDepartmentSimpleInfos(@Param("ids") List<String> ids);
|
||||
|
||||
void deleteStaffRoleDepartmentByRoleId(@Param("roleId") Long roleId);
|
||||
}
|
||||
@ -8,9 +8,13 @@ package com.lz.modules.flow.dao;
|
||||
* @since 2020-11-02
|
||||
*/
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.lz.modules.app.dto.EvaluationGroupInfo;
|
||||
import com.lz.modules.flow.entity.StaffRoleEvaluationGroup;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface StaffRoleEvaluationGroupMapper extends BaseMapper<StaffRoleEvaluationGroup> {
|
||||
|
||||
@ -29,5 +33,7 @@ public interface StaffRoleEvaluationGroupMapper extends BaseMapper<StaffRoleEval
|
||||
|
||||
int deleteStaffRoleEvaluationGroupById(@Param("id") Long id);
|
||||
|
||||
List<EvaluationGroupInfo> selectStaffRoleEvaluationGroupBy(@Param("roleId") Long roleId);
|
||||
|
||||
void deleteStaffRoleEvaluationGroupByRoleId(@Param("roleId") Long roleId);
|
||||
}
|
||||
@ -35,4 +35,6 @@ public interface StaffRoleMenuMapper extends BaseMapper<StaffRoleMenu> {
|
||||
|
||||
|
||||
List<StaffMenu> selectByRoleId(@Param("roleId") Long roleId);
|
||||
|
||||
void deleteStaffRoleMenuByRoleId(@Param("roleId") Long roleId);
|
||||
}
|
||||
@ -1,11 +1,16 @@
|
||||
package com.lz.modules.flow.entity;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
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 org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* </p>*绩效管理菜单表
|
||||
@ -38,6 +43,8 @@ public class StaffMenu implements java.io.Serializable {
|
||||
//授权 id
|
||||
@ApiModelProperty(value = "授权 id", name = "authIds")
|
||||
private Long authIds;
|
||||
@TableField(exist=false)
|
||||
private List<StaffMenu> childs;
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
|
||||
@ -1,33 +1,43 @@
|
||||
package com.lz.modules.flow.entity;
|
||||
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.util.Date;
|
||||
/**
|
||||
* <p>
|
||||
* 菜单权限表
|
||||
* </p>*流转关系表
|
||||
* @author quyixiao
|
||||
* @since 2020-08-18
|
||||
* @since 2020-11-02
|
||||
*/
|
||||
|
||||
@Data
|
||||
@TableName("lz_staff_role_department")
|
||||
@ApiModel(value = "流转关系表")
|
||||
public class StaffRoleDepartment 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;
|
||||
//
|
||||
//角色 id
|
||||
@ApiModelProperty(value = "角色 id", name = "staffRoleId")
|
||||
private Long staffRoleId;
|
||||
//
|
||||
//部门 id
|
||||
@ApiModelProperty(value = "部门 id", name = "departmentId")
|
||||
private String departmentId;
|
||||
//部门名称
|
||||
@ApiModelProperty(value = "部门名称", name = "departmentName")
|
||||
private String departmentName;
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
@ -89,14 +99,14 @@ public class StaffRoleDepartment implements java.io.Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 角色 id
|
||||
* @return
|
||||
*/
|
||||
public Long getStaffRoleId() {
|
||||
return staffRoleId;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* 角色 id
|
||||
* @param staffRoleId
|
||||
*/
|
||||
public void setStaffRoleId(Long staffRoleId) {
|
||||
@ -104,20 +114,35 @@ public class StaffRoleDepartment implements java.io.Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 部门 id
|
||||
* @return
|
||||
*/
|
||||
public String getDepartmentId() {
|
||||
return departmentId;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* 部门 id
|
||||
* @param departmentId
|
||||
*/
|
||||
public void setDepartmentId(String departmentId) {
|
||||
this.departmentId = departmentId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 部门名称
|
||||
* @return
|
||||
*/
|
||||
public String getDepartmentName() {
|
||||
return departmentName;
|
||||
}
|
||||
/**
|
||||
* 部门名称
|
||||
* @param departmentName
|
||||
*/
|
||||
public void setDepartmentName(String departmentName) {
|
||||
this.departmentName = departmentName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "StaffRoleDepartment{" +
|
||||
@ -127,6 +152,7 @@ public class StaffRoleDepartment implements java.io.Serializable {
|
||||
",gmtModified=" + gmtModified +
|
||||
",staffRoleId=" + staffRoleId +
|
||||
",departmentId=" + departmentId +
|
||||
",departmentName=" + departmentName +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@ -3,6 +3,8 @@ package com.lz.modules.flow.service;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.lz.modules.flow.entity.StaffMenu;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 绩效管理菜单表 服务类
|
||||
@ -30,4 +32,7 @@ public interface StaffMenuService extends IService<StaffMenu> {
|
||||
int deleteStaffMenuById(Long id);
|
||||
|
||||
|
||||
List<StaffMenu> selectAll();
|
||||
|
||||
List<StaffMenu> selectByParentId(Long parentId);
|
||||
}
|
||||
@ -42,4 +42,6 @@ public interface StaffRoleDepartmentService extends IService<StaffRoleDepartment
|
||||
void deleteStaffRoleDepartment(Long id);
|
||||
|
||||
List<DepartmentsSimpleDto> selectDepartmentSimpleInfos(List<String> ids);
|
||||
|
||||
void deleteStaffRoleDepartmentByRoleId(Long roleId);
|
||||
}
|
||||
@ -1,8 +1,11 @@
|
||||
package com.lz.modules.flow.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.lz.modules.app.dto.EvaluationGroupInfo;
|
||||
import com.lz.modules.flow.entity.StaffRoleEvaluationGroup;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 绩效管理菜单表 服务类
|
||||
@ -30,4 +33,7 @@ public interface StaffRoleEvaluationGroupService extends IService<StaffRoleEvalu
|
||||
int deleteStaffRoleEvaluationGroupById(Long id);
|
||||
|
||||
|
||||
List<EvaluationGroupInfo> selectStaffRoleEvaluationGroupBy(Long id);
|
||||
|
||||
void deleteStaffRoleEvaluationGroupByRoleId(Long roleId);
|
||||
}
|
||||
@ -34,4 +34,6 @@ public interface StaffRoleMenuService extends IService<StaffRoleMenu> {
|
||||
|
||||
|
||||
List<StaffMenu> selectByRoleId(Long id);
|
||||
|
||||
void deleteStaffRoleMenuByRoleId(Long roleId);
|
||||
}
|
||||
@ -57,4 +57,8 @@ public interface StaffRoleService extends IService<StaffRole> {
|
||||
R selectRoleInfoBy(RoleModel roleModel);
|
||||
|
||||
R selectRoleDetail(RoleModel roleModel);
|
||||
|
||||
R roleAddOrUpdate(RoleModel roleModel);
|
||||
|
||||
R delete(RoleModel roleModel);
|
||||
}
|
||||
@ -7,6 +7,8 @@ import com.lz.modules.flow.service.StaffMenuService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 绩效管理菜单表 服务类
|
||||
@ -58,6 +60,15 @@ public class StaffMenuServiceImpl extends ServiceImpl<StaffMenuMapper, StaffMenu
|
||||
return staffMenuMapper.deleteStaffMenuById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StaffMenu> selectAll() {
|
||||
return staffMenuMapper.selctAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StaffMenu> selectByParentId(Long parentId) {
|
||||
return staffMenuMapper.selectByParentId(parentId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -86,5 +86,10 @@ public class StaffRoleDepartmentServiceImpl extends ServiceImpl<StaffRoleDepartm
|
||||
return staffRoleDepartmentMapper.selectDepartmentSimpleInfos(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteStaffRoleDepartmentByRoleId(Long roleId) {
|
||||
staffRoleDepartmentMapper.deleteStaffRoleDepartmentByRoleId(roleId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,12 +1,15 @@
|
||||
package com.lz.modules.flow.service.impl;
|
||||
|
||||
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.entity.StaffRoleEvaluationGroup;
|
||||
import com.lz.modules.flow.service.StaffRoleEvaluationGroupService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 绩效管理菜单表 服务类
|
||||
@ -58,6 +61,15 @@ public class StaffRoleEvaluationGroupServiceImpl extends ServiceImpl<StaffRoleEv
|
||||
return staffRoleEvaluationGroupMapper.deleteStaffRoleEvaluationGroupById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EvaluationGroupInfo> selectStaffRoleEvaluationGroupBy(Long roleId) {
|
||||
return staffRoleEvaluationGroupMapper.selectStaffRoleEvaluationGroupBy(roleId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteStaffRoleEvaluationGroupByRoleId(Long roleId) {
|
||||
staffRoleEvaluationGroupMapper.deleteStaffRoleEvaluationGroupByRoleId(roleId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -66,5 +66,10 @@ public class StaffRoleMenuServiceImpl extends ServiceImpl<StaffRoleMenuMapper, S
|
||||
return staffRoleMenuMapper.selectByRoleId(roleId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteStaffRoleMenuByRoleId(Long roleId) {
|
||||
staffRoleMenuMapper.deleteStaffRoleMenuByRoleId(roleId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -9,25 +9,25 @@ import com.lz.common.utils.R;
|
||||
import com.lz.common.utils.StringUtil;
|
||||
import com.lz.modules.app.dao.DepartmentsDao;
|
||||
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.StaffRoleResp;
|
||||
import com.lz.modules.app.entity.DepartmentsEntity;
|
||||
import com.lz.modules.app.entity.DepartmentsStaffRelateEntity;
|
||||
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.RoleMenuEnums;
|
||||
import com.lz.modules.app.model.RoleModel;
|
||||
import com.lz.modules.app.service.DepartmentsService;
|
||||
import com.lz.modules.app.service.DepartmentsStaffRelateService;
|
||||
import com.lz.modules.flow.dao.RecordRoleMapper;
|
||||
import com.lz.modules.flow.dao.StaffRoleDepartmentMapper;
|
||||
import com.lz.modules.flow.dao.StaffRoleMapper;
|
||||
import com.lz.modules.flow.entity.RecordRole;
|
||||
import com.lz.modules.flow.entity.StaffMenu;
|
||||
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.flow.entity.*;
|
||||
import com.lz.modules.flow.service.*;
|
||||
import com.lz.modules.sys.entity.SysMenuEntity;
|
||||
import com.lz.modules.sys.entity.SysRoleEntity;
|
||||
import com.lz.modules.sys.service.app.ResultRecordService;
|
||||
@ -86,6 +86,15 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
|
||||
@Autowired
|
||||
private StaffRoleMenuService staffRoleMenuService;
|
||||
|
||||
@Autowired
|
||||
private StaffRoleEvaluationGroupService staffRoleEvaluationGroupService;
|
||||
|
||||
@Autowired
|
||||
private StaffMenuService staffMenuService;
|
||||
|
||||
@Autowired
|
||||
private StaffRoleDepartmentService staffRoleDepartmentService;
|
||||
|
||||
@Override
|
||||
public StaffRole selectStaffRoleById(Long id) {
|
||||
return staffRoleMapper.selectStaffRoleById(id);
|
||||
@ -337,10 +346,132 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
|
||||
|
||||
@Override
|
||||
public R selectRoleDetail(RoleModel roleModel) {
|
||||
if(roleModel.getId() == null){
|
||||
if (roleModel.getId() == null) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,5 +79,15 @@
|
||||
update lz_staff_menu set is_delete = 1 where id=#{id} limit 1
|
||||
</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>
|
||||
|
||||
|
||||
@ -10,46 +10,51 @@
|
||||
<result column="gmt_modified" property="gmtModified"/>
|
||||
<result column="staff_role_id" property="staffRoleId"/>
|
||||
<result column="department_id" property="departmentId"/>
|
||||
<result column="department_name" property="departmentName"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<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>
|
||||
|
||||
|
||||
|
||||
|
||||
<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>
|
||||
|
||||
|
||||
<insert id="insertStaffRoleDepartment" parameterType="StaffRoleDepartment" useGeneratedKeys="true" keyProperty="id" >
|
||||
insert into lz_staff_role_department(
|
||||
<if test="staffRoleId != null">staff_role_id, </if>
|
||||
<if test="departmentId != null">department_id, </if>
|
||||
is_delete,
|
||||
gmt_create,
|
||||
gmt_modified
|
||||
<if test="staffRoleId != null">staff_role_id, </if>
|
||||
<if test="departmentId != null">department_id, </if>
|
||||
<if test="departmentName != null">department_name, </if>
|
||||
is_delete,
|
||||
gmt_create,
|
||||
gmt_modified
|
||||
)values(
|
||||
<if test="staffRoleId != null">#{ staffRoleId}, </if>
|
||||
<if test="departmentId != null">#{ departmentId}, </if>
|
||||
0,
|
||||
now(),
|
||||
now()
|
||||
<if test="staffRoleId != null">#{ staffRoleId}, </if>
|
||||
<if test="departmentId != null">#{ departmentId}, </if>
|
||||
<if test="departmentName != null">#{ departmentName}, </if>
|
||||
0,
|
||||
now(),
|
||||
now()
|
||||
)
|
||||
</insert>
|
||||
|
||||
|
||||
<update id="updateStaffRoleDepartmentById" parameterType="StaffRoleDepartment" >
|
||||
update
|
||||
lz_staff_role_department
|
||||
lz_staff_role_department
|
||||
<trim prefix="set" suffixOverrides=",">
|
||||
<if test="isDelete != null">is_delete = #{isDelete},</if>
|
||||
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</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>
|
||||
,gmt_modified = now()
|
||||
where id = #{id}
|
||||
@ -58,12 +63,13 @@
|
||||
|
||||
<update id="updateCoverStaffRoleDepartmentById" parameterType="StaffRoleDepartment" >
|
||||
update
|
||||
lz_staff_role_department
|
||||
set
|
||||
lz_staff_role_department
|
||||
set
|
||||
is_delete = #{isDelete},
|
||||
gmt_create = #{gmtCreate},
|
||||
staff_role_id = #{staffRoleId},
|
||||
department_id = #{departmentId}
|
||||
department_id = #{departmentId},
|
||||
department_name = #{departmentName}
|
||||
,gmt_modified = now()
|
||||
where id = #{id}
|
||||
</update>
|
||||
@ -101,7 +107,6 @@
|
||||
delete from lz_staff_role_department where id = #{id}
|
||||
</delete>
|
||||
|
||||
|
||||
<select id="selectStaffRoleDepartmentByStaffRoleIdDepartments"
|
||||
resultType="com.lz.modules.flow.entity.StaffRoleDepartment">
|
||||
select * from lz_staff_role_department where staff_role_id=#{staffRoleId} and is_delete = 0
|
||||
@ -120,5 +125,12 @@
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
|
||||
<delete id="deleteStaffRoleDepartmentByRoleId">
|
||||
delete from lz_staff_role_department where staff_role_id = #{roleId}
|
||||
</delete>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
@ -21,12 +21,12 @@
|
||||
|
||||
|
||||
|
||||
|
||||
<select id="selectStaffRoleEvaluationGroupById" resultType="StaffRoleEvaluationGroup" >
|
||||
select * from lz_staff_role_evaluation_group where id=#{id} and is_delete = 0 limit 1
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<insert id="insertStaffRoleEvaluationGroup" parameterType="StaffRoleEvaluationGroup" useGeneratedKeys="true" keyProperty="id" >
|
||||
insert into lz_staff_role_evaluation_group(
|
||||
<if test="roleId != null">role_id, </if>
|
||||
@ -79,5 +79,19 @@
|
||||
update lz_staff_role_evaluation_group set is_delete = 1 where id=#{id} limit 1
|
||||
</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>
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
@ -20,7 +20,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
<select id="selectStaffRoleMenuById" resultType="StaffRoleMenu" >
|
||||
select * from lz_staff_role_menu where id=#{id} and is_delete = 0 limit 1
|
||||
</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>
|
||||
|
||||
|
||||
<delete id="deleteStaffRoleMenuByRoleId">
|
||||
delete from lz_staff_role_menu where role_id = #{roleId}
|
||||
</delete>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user