职位管理,权限管理

master
shijie 4 years ago
parent c2536a297d
commit ab0258c0d3
  1. 7
      dq-financial-api/src/main/java/com/daqing/financial/crms/CustomerControllerApi.java
  2. 10
      dq-financial-api/src/main/java/com/daqing/financial/hrms/EmployeeControllerApi.java
  3. 32
      dq-financial-api/src/main/java/com/daqing/financial/hrms/PermissionControllerApi.java
  4. 45
      dq-financial-api/src/main/java/com/daqing/financial/hrms/PositionControllerApi.java
  5. 22
      dq-financial-crms/src/main/java/com/daqing/financial/crms/controller/CustomerController.java
  6. 13
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/config/IPageConfig.java
  7. 4
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/EmployeeController.java
  8. 35
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/PermissionController.java
  9. 70
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/PositionController.java
  10. 4
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/DeptDao.java
  11. 22
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/DeptPositionDao.java
  12. 17
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/EmployeeDeptDao.java
  13. 17
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/EmployeePositionDao.java
  14. 17
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/EmployeeRoleDao.java
  15. 11
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/PositionDao.java
  16. 17
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/RolePermissionDao.java
  17. 4
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/PermissionService.java
  18. 16
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/PositionService.java
  19. 16
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/DeptServiceImpl.java
  20. 29
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/PermissionServiceImpl.java
  21. 152
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/PositionServiceImpl.java
  22. 9
      dq-financial-hrms/src/main/resources/mapper/hrms/DeptDao.xml
  23. 28
      dq-financial-hrms/src/main/resources/mapper/hrms/DeptPositionDao.xml
  24. 14
      dq-financial-hrms/src/main/resources/mapper/hrms/EmployeeDeptDao.xml
  25. 14
      dq-financial-hrms/src/main/resources/mapper/hrms/EmployeePositionDao.xml
  26. 14
      dq-financial-hrms/src/main/resources/mapper/hrms/EmployeeRoleDao.xml
  27. 67
      dq-financial-hrms/src/main/resources/mapper/hrms/PositionDao.xml
  28. 14
      dq-financial-hrms/src/main/resources/mapper/hrms/RolePermissionDao.xml
  29. 7
      dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/DeptEntity.java
  30. 36
      dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/DeptPositionEntity.java
  31. 12
      dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/PermissionEntity.java
  32. 8
      dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/PositionEntity.java
  33. 38
      dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/ext/PositionVO.java
  34. 36
      dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/request/PositionRequest.java
  35. 6
      dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/response/HrmsCode.java
  36. 35
      dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/response/PositionResponse.java

@ -1,11 +1,10 @@
package com.daqing.financial.crms; package com.daqing.financial.crms;
import com.daqing.framework.domain.crms.request.CustomerRequest;
import com.daqing.framework.model.response.ResponseResult; import com.daqing.framework.model.response.ResponseResult;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import java.util.Map;
/** /**
* @Author: gongsj. * @Author: gongsj.
* @Description: 客户资源管理controllerApi定义 * @Description: 客户资源管理controllerApi定义
@ -18,7 +17,7 @@ public interface CustomerControllerApi {
/** /**
* 列表展示 * 列表展示
*/ */
/*@ApiOperation(value = "客户信息列表展示", notes = "客户信息列表展示") @ApiOperation(value = "客户信息列表展示", notes = "客户信息列表展示")
ResponseResult list(Map<String, Object> params);*/ ResponseResult queryList(Integer page, Integer size, CustomerRequest customerRequest);
} }

@ -1,12 +1,10 @@
package com.daqing.financial.hrms; package com.daqing.financial.hrms;
import com.daqing.framework.domain.hrms.ext.EmployeeTO; import com.daqing.framework.domain.hrms.EmployeeEntity;
import com.daqing.framework.model.response.ResponseResult; import com.daqing.framework.model.response.ResponseResult;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import java.util.List;
/** /**
* @auther River * @auther River
* @date 2020/9/9 17:41 * @date 2020/9/9 17:41
@ -19,4 +17,10 @@ public interface EmployeeControllerApi {
*/ */
@ApiOperation(value = "根据id查询员工的基本信息和部门信息", notes = "根据id查询员工的基本信息和部门信息") @ApiOperation(value = "根据id查询员工的基本信息和部门信息", notes = "根据id查询员工的基本信息和部门信息")
ResponseResult getEmployeeAndDeptById(Long[] ids); ResponseResult getEmployeeAndDeptById(Long[] ids);
/**
* 分页加条件查询员工信息
*/
@ApiOperation(value = "分页加条件查询员工信息", notes = "分页加条件查询员工信息")
ResponseResult list(Integer page, Integer size, EmployeeEntity employee);
} }

@ -1,5 +1,6 @@
package com.daqing.financial.hrms; package com.daqing.financial.hrms;
import com.daqing.framework.domain.hrms.PermissionEntity;
import com.daqing.framework.domain.hrms.request.DeptAddRequest; import com.daqing.framework.domain.hrms.request.DeptAddRequest;
import com.daqing.framework.model.response.ResponseResult; import com.daqing.framework.model.response.ResponseResult;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -17,5 +18,34 @@ public interface PermissionControllerApi {
* 新增一条权限信息 * 新增一条权限信息
*/ */
@ApiOperation(value = "新增一条权限信息", notes = "新增一条权限信息") @ApiOperation(value = "新增一条权限信息", notes = "新增一条权限信息")
ResponseResult save(DeptAddRequest deptAddRequest); ResponseResult save(PermissionEntity permission);
/**
* 权限信息树形结构展示
*/
@ApiOperation(value = "权限信息树形结构展示", notes = "权限信息树形结构展示")
ResponseResult tree();
/**
* 拖拉拽重新排序批量修改权限信息
*/
@ApiOperation(value = "拖拉拽重新排序,批量修改权限信息", notes = "拖拉拽重新排序,批量修改权限信息")
ResponseResult updateSort(PermissionEntity[] permissions);
/**
* 根据id查询权限详细信息
*/
@ApiOperation(value = "根据id查询权限详细信息", notes = "根据id查询权限详细信息")
ResponseResult info(Long id);
/**
* 根据id修改权限信息
*/
@ApiOperation(value = "根据id修改权限信息", notes = "根据id修改权限信息")
ResponseResult update(PermissionEntity permission);
/**
* 根据id数组批量删除权限信息
*/
@ApiOperation(value = "根据id数组批量删除权限信息", notes = "根据id数组批量删除权限信息")
ResponseResult delete(Long[] ids);
} }

@ -0,0 +1,45 @@
package com.daqing.financial.hrms;
import com.daqing.framework.domain.hrms.request.PositionRequest;
import com.daqing.framework.model.response.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* @Author: gongsj.
* @Description: 职位信息管理controllerApi定义
* @Date:Created in 2020/09/07 11:33.
* @Modified By:
*/
@Api(value = "职位信息管理相关操作", tags = "提供职位信息增删改查等相关方法")
public interface PositionControllerApi {
/**
* 新增一条职位信息
*/
@ApiOperation(value = "新增一条职位信息", notes = "新增一条职位信息")
ResponseResult save(PositionRequest positionRequest);
/**
* 分页加条件查询职位信息
*/
@ApiOperation(value = "分页加条件查询职位信息", notes = "分页加条件查询职位信息")
ResponseResult list(Integer page, Integer size, String queryMsg);
/**
* 修改职位信息
*/
@ApiOperation(value = "修改职位信息", notes = "修改职位信息")
ResponseResult update(PositionRequest positionRequest);
/**
* 根据职位id查询职位信息详情
*/
@ApiOperation(value = "修改职位信息", notes = "修改职位信息")
ResponseResult info(Long id);
/**
* 删除职位信息
*/
@ApiOperation(value = "删除职位信息", notes = "删除职位信息")
ResponseResult delete(Long[] ids);
}

@ -1,16 +1,15 @@
package com.daqing.financial.crms.controller; package com.daqing.financial.crms.controller;
import com.daqing.financial.crms.CustomerControllerApi; import com.daqing.financial.crms.CustomerControllerApi;
import com.daqing.financial.crms.feign.HrmsFeignService;
import com.daqing.financial.crms.service.CustomerService; import com.daqing.financial.crms.service.CustomerService;
import com.daqing.framework.domain.crms.CustomerEntity;
import com.daqing.framework.domain.crms.request.CustomerRequest; import com.daqing.framework.domain.crms.request.CustomerRequest;
import com.daqing.framework.model.response.ResponseResult; import com.daqing.framework.model.response.ResponseResult;
import com.daqing.framework.utils.PageUtils; import com.daqing.framework.utils.PageUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.*; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/** /**
@ -27,19 +26,6 @@ public class CustomerController implements CustomerControllerApi {
@Autowired @Autowired
private CustomerService customerService; private CustomerService customerService;
@Autowired
HrmsFeignService hrmsFeignService;
/**
* 列表
*/
@GetMapping("/hrms_list")
//@RequiresPermissions("hrms:dept:list")
public ResponseResult hrmsList() {
Map<String, Object> params = new HashMap<>();
return hrmsFeignService.list(params);
}
/** /**
* 查询客户列表(所有)根据创建时间筛选根据客户类型筛选根据客户编号或者名称搜索 * 查询客户列表(所有)根据创建时间筛选根据客户类型筛选根据客户编号或者名称搜索
*/ */

@ -0,0 +1,13 @@
package com.daqing.financial.hrms.config;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class IPageConfig {
@Bean
public PaginationInterceptor paginationInterceptor() {
return new PaginationInterceptor();
}
}

@ -29,7 +29,9 @@ public class EmployeeController implements EmployeeControllerApi{
@GetMapping("/list") @GetMapping("/list")
//@RequiresPermissions("hrms:employee:info") //@RequiresPermissions("hrms:employee:info")
public ResponseResult list(@RequestParam Map<String, Object> params) { public ResponseResult list(@RequestParam("page") Integer page,
@RequestParam("size") Integer size,
EmployeeEntity employee) {
return ResponseResult.SUCCESS(); return ResponseResult.SUCCESS();
} }

@ -1,14 +1,14 @@
package com.daqing.financial.hrms.controller; package com.daqing.financial.hrms.controller;
import com.daqing.financial.hrms.PermissionControllerApi;
import com.daqing.financial.hrms.service.PermissionService; import com.daqing.financial.hrms.service.PermissionService;
import com.daqing.framework.domain.hrms.PermissionEntity; import com.daqing.framework.domain.hrms.PermissionEntity;
import com.daqing.framework.model.response.ResponseResult; import com.daqing.framework.model.response.ResponseResult;
import com.daqing.framework.utils.PageUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Arrays; import java.util.Arrays;
import java.util.Map; import java.util.List;
/** /**
@ -20,63 +20,64 @@ import java.util.Map;
*/ */
@RestController @RestController
@RequestMapping("hrms/permission") @RequestMapping("hrms/permission")
public class PermissionController { public class PermissionController implements PermissionControllerApi {
@Autowired @Autowired
private PermissionService permissionService; private PermissionService permissionService;
/** @Override
* 列表 public ResponseResult tree() {
*/ List<PermissionEntity> list = permissionService.listWithTree();
@GetMapping("/list") return new ResponseResult<List<PermissionEntity>>().SUCCESS(list);
//@RequiresPermissions("hrms:permission:list")
public ResponseResult list(@RequestParam Map<String, Object> params) {
PageUtils page = permissionService.queryPage(params);
return ResponseResult.SUCCESS();
} }
/** /**
* 信息 * 信息
*/ */
@Override
@GetMapping("/info/{id}") @GetMapping("/info/{id}")
//@RequiresPermissions("hrms:permission:info") //@RequiresPermissions("hrms:permission:info")
public ResponseResult info(@PathVariable("id") Long id) { public ResponseResult info(@PathVariable("id") Long id) {
PermissionEntity permission = permissionService.getById(id); PermissionEntity permission = permissionService.getById(id);
return new ResponseResult<PermissionEntity>().SUCCESS(permission);
return ResponseResult.SUCCESS();
} }
/** /**
* 保存 * 保存
*/ */
@Override
@PostMapping("/save") @PostMapping("/save")
//@RequiresPermissions("hrms:permission:save") //@RequiresPermissions("hrms:permission:save")
public ResponseResult save(@RequestBody PermissionEntity permission) { public ResponseResult save(@RequestBody PermissionEntity permission) {
permissionService.save(permission); permissionService.save(permission);
return ResponseResult.SUCCESS();
}
@Override
public ResponseResult updateSort(PermissionEntity[] permissions) {
permissionService.updateBatchById(Arrays.asList(permissions));
return ResponseResult.SUCCESS(); return ResponseResult.SUCCESS();
} }
/** /**
* 修改 * 修改
*/ */
@Override
@PutMapping("/update") @PutMapping("/update")
//@RequiresPermissions("hrms:permission:update") //@RequiresPermissions("hrms:permission:update")
public ResponseResult update(@RequestBody PermissionEntity permission) { public ResponseResult update(@RequestBody PermissionEntity permission) {
permissionService.updateById(permission); permissionService.updateById(permission);
return ResponseResult.SUCCESS(); return ResponseResult.SUCCESS();
} }
/** /**
* 删除 * 删除
*/ */
@Override
@DeleteMapping("/delete") @DeleteMapping("/delete")
//@RequiresPermissions("hrms:permission:delete") //@RequiresPermissions("hrms:permission:delete")
public ResponseResult delete(@RequestBody Long[] ids) { public ResponseResult delete(@RequestBody Long[] ids) {
permissionService.removeByIds(Arrays.asList(ids)); permissionService.removeByIds(Arrays.asList(ids));
return ResponseResult.SUCCESS(); return ResponseResult.SUCCESS();
} }

@ -1,14 +1,16 @@
package com.daqing.financial.hrms.controller; package com.daqing.financial.hrms.controller;
import com.daqing.financial.hrms.PositionControllerApi;
import com.daqing.financial.hrms.service.PositionService; import com.daqing.financial.hrms.service.PositionService;
import com.daqing.framework.domain.hrms.PositionEntity; import com.daqing.framework.domain.hrms.PositionEntity;
import com.daqing.framework.domain.hrms.request.PositionRequest;
import com.daqing.framework.domain.hrms.response.PositionResponse;
import com.daqing.framework.model.response.ResponseResult; import com.daqing.framework.model.response.ResponseResult;
import com.daqing.framework.utils.PageUtils; import com.daqing.framework.utils.PageUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Arrays; import java.util.Arrays;
import java.util.Map;
/** /**
@ -20,64 +22,48 @@ import java.util.Map;
*/ */
@RestController @RestController
@RequestMapping("hrms/position") @RequestMapping("hrms/position")
public class PositionController { public class PositionController implements PositionControllerApi {
@Autowired @Autowired
private PositionService positionService; private PositionService positionService;
/** @Override
* 列表
*/
@GetMapping("/list")
//@RequiresPermissions("hrms:position:list")
public ResponseResult list(@RequestParam Map<String, Object> params) {
PageUtils page = positionService.queryPage(params);
return ResponseResult.SUCCESS();
}
/**
* 信息
*/
@GetMapping("/info/{id}")
//@RequiresPermissions("hrms:position:info")
public ResponseResult info(@PathVariable("id") Long id) {
PositionEntity position = positionService.getById(id);
return ResponseResult.SUCCESS();
}
/**
* 保存
*/
@PostMapping("/save") @PostMapping("/save")
//@RequiresPermissions("hrms:position:save") public ResponseResult save(@RequestBody PositionRequest positionRequest) {
public ResponseResult save(@RequestBody PositionEntity position) { boolean result = positionService.savePosition(positionRequest);
positionService.save(position); return result ? ResponseResult.SUCCESS() : ResponseResult.FAIL();
}
return ResponseResult.SUCCESS(); @Override
@GetMapping("/list")
public ResponseResult list(@RequestParam("page") Integer page,
@RequestParam("size") Integer size,
@RequestParam(value = "queryMsg", required = false) String queryMsg) {
PageUtils data = positionService.queryPage(page, size, queryMsg);
return new ResponseResult<PageUtils>().SUCCESS(data);
} }
/** @Override
* 修改
*/
@PutMapping("/update") @PutMapping("/update")
//@RequiresPermissions("hrms:position:update") public ResponseResult update(@RequestBody PositionRequest positionRequest) {
public ResponseResult update(@RequestBody PositionEntity position) { boolean result = positionService.updatePosition(positionRequest);
positionService.updateById(position); return result ? ResponseResult.SUCCESS() : ResponseResult.FAIL();
}
return ResponseResult.SUCCESS(); @GetMapping("/info")
//@RequiresPermissions("hrms:position:info")
public ResponseResult info(@RequestParam("id") Long id) {
PositionResponse position = positionService.getPositionById(id);
return new ResponseResult<PositionResponse>().SUCCESS(position);
} }
/** /**
* 删除 * 删除
*/ */
@DeleteMapping("/delete") @DeleteMapping("/delete")
//@RequiresPermissions("hrms:position:delete") //@RequiresPermissions("hrms:position:delete")
public ResponseResult delete(@RequestBody Long[] ids) { public ResponseResult delete(@RequestBody Long[] ids) {
positionService.removeByIds(Arrays.asList(ids)); positionService.removePositionByIds(Arrays.asList(ids));
return ResponseResult.SUCCESS(); return ResponseResult.SUCCESS();
} }
} }

@ -5,6 +5,8 @@ import com.daqing.framework.domain.hrms.DeptEntity;
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;
/** /**
* 记录部门信息 * 记录部门信息
* *
@ -17,4 +19,6 @@ public interface DeptDao extends BaseMapper<DeptEntity> {
Integer getMaxSort(@Param("parentId") Long parentId); Integer getMaxSort(@Param("parentId") Long parentId);
Integer getEmpDeptCount(@Param("deptId") Long deptId); Integer getEmpDeptCount(@Param("deptId") Long deptId);
List<DeptEntity> getByPositionId(@Param("positionId") Long positionId);
} }

@ -0,0 +1,22 @@
package com.daqing.financial.hrms.dao;
import com.daqing.framework.domain.hrms.DeptPositionEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
*
*
* @author gongsj
* @email gongsj@gmail.com
* @date 2020-09-14 09:35:05
*/
@Mapper
public interface DeptPositionDao extends BaseMapper<DeptPositionEntity> {
int saveBatch(@Param("list") List<DeptPositionEntity> deptPositionList);
int deleteByPositionId(@Param("positionId") Long positionId);
}

@ -0,0 +1,17 @@
package com.daqing.financial.hrms.dao;
import com.daqing.framework.domain.hrms.EmployeeDeptEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* 员工部门中间表
*
* @author gongsj
* @email gongsj@gmail.com
* @date 2020-09-14 09:35:05
*/
@Mapper
public interface EmployeeDeptDao extends BaseMapper<EmployeeDeptEntity> {
}

@ -0,0 +1,17 @@
package com.daqing.financial.hrms.dao;
import com.daqing.framework.domain.hrms.EmployeePositionEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* 员工职位中间表
*
* @author gongsj
* @email gongsj@gmail.com
* @date 2020-09-14 09:35:05
*/
@Mapper
public interface EmployeePositionDao extends BaseMapper<EmployeePositionEntity> {
}

@ -0,0 +1,17 @@
package com.daqing.financial.hrms.dao;
import com.daqing.framework.domain.hrms.EmployeeRoleEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
*
*
* @author gongsj
* @email gongsj@gmail.com
* @date 2020-09-14 09:35:05
*/
@Mapper
public interface EmployeeRoleDao extends BaseMapper<EmployeeRoleEntity> {
}

@ -1,8 +1,12 @@
package com.daqing.financial.hrms.dao; package com.daqing.financial.hrms.dao;
import com.daqing.framework.domain.hrms.PositionEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.daqing.framework.domain.hrms.PositionEntity;
import com.daqing.framework.domain.hrms.ext.PositionVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/** /**
* 记录职位信息 * 记录职位信息
@ -14,4 +18,9 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface PositionDao extends BaseMapper<PositionEntity> { public interface PositionDao extends BaseMapper<PositionEntity> {
Integer getCountByNameAndDeptId(@Param("deptId") Long deptId, @Param("name") String name);
Integer getCountByNameAndDeptIdAndId(@Param("deptId") Long deptId, @Param("name") String name, @Param("id") Long id);
IPage<PositionVO> pageByCondition(Page page, @Param("queryMsg") String queryMsg);
} }

@ -0,0 +1,17 @@
package com.daqing.financial.hrms.dao;
import com.daqing.framework.domain.hrms.RolePermissionEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* 角色权限中间表
*
* @author gongsj
* @email gongsj@gmail.com
* @date 2020-09-14 09:35:05
*/
@Mapper
public interface RolePermissionDao extends BaseMapper<RolePermissionEntity> {
}

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.daqing.framework.utils.PageUtils; import com.daqing.framework.utils.PageUtils;
import com.daqing.framework.domain.hrms.PermissionEntity; import com.daqing.framework.domain.hrms.PermissionEntity;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -15,6 +16,7 @@ import java.util.Map;
*/ */
public interface PermissionService extends IService<PermissionEntity> { public interface PermissionService extends IService<PermissionEntity> {
PageUtils queryPage(Map<String, Object> params); List<PermissionEntity> listWithTree();
} }

@ -1,10 +1,12 @@
package com.daqing.financial.hrms.service; package com.daqing.financial.hrms.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.daqing.framework.utils.PageUtils;
import com.daqing.framework.domain.hrms.PositionEntity; import com.daqing.framework.domain.hrms.PositionEntity;
import com.daqing.framework.domain.hrms.request.PositionRequest;
import com.daqing.framework.domain.hrms.response.PositionResponse;
import com.daqing.framework.utils.PageUtils;
import java.util.Map; import java.util.List;
/** /**
* 记录职位信息 * 记录职位信息
@ -15,6 +17,14 @@ import java.util.Map;
*/ */
public interface PositionService extends IService<PositionEntity> { public interface PositionService extends IService<PositionEntity> {
PageUtils queryPage(Map<String, Object> params); PageUtils queryPage(Integer page, Integer size, String queryMsg);
boolean savePosition(PositionRequest positionRequest);
boolean updatePosition(PositionRequest positionRequest);
PositionResponse getPositionById(Long id);
void removePositionByIds(List<Long> asList);
} }

@ -6,7 +6,7 @@ import com.daqing.financial.hrms.dao.DeptDao;
import com.daqing.financial.hrms.service.DeptService; import com.daqing.financial.hrms.service.DeptService;
import com.daqing.framework.domain.hrms.DeptEntity; import com.daqing.framework.domain.hrms.DeptEntity;
import com.daqing.framework.domain.hrms.request.DeptAddRequest; import com.daqing.framework.domain.hrms.request.DeptAddRequest;
import com.daqing.framework.domain.hrms.response.DeptCode; import com.daqing.framework.domain.hrms.response.HrmsCode;
import com.daqing.framework.exception.ExceptionCast; import com.daqing.framework.exception.ExceptionCast;
import com.daqing.framework.utils.SnowflakeIdUtils; import com.daqing.framework.utils.SnowflakeIdUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
@ -35,7 +35,7 @@ public class DeptServiceImpl extends ServiceImpl<DeptDao, DeptEntity> implements
String deptName = deptAddRequest.getName(); String deptName = deptAddRequest.getName();
if (StringUtils.isEmpty(deptName)) { if (StringUtils.isEmpty(deptName)) {
//抛出部门名称非法异常 //抛出部门名称非法异常
ExceptionCast.cast(DeptCode.DEPT_NAME_ILLEGAL); ExceptionCast.cast(HrmsCode.DEPT_NAME_ILLEGAL);
} }
//判断上级部门id是否为空 //判断上级部门id是否为空
if (deptAddRequest.getParentId() == null) { if (deptAddRequest.getParentId() == null) {
@ -50,7 +50,7 @@ public class DeptServiceImpl extends ServiceImpl<DeptDao, DeptEntity> implements
.eq("parent_id", parentId)); .eq("parent_id", parentId));
if (countByName > 0) { if (countByName > 0) {
//抛出部门名称非法异常 //抛出部门名称非法异常
ExceptionCast.cast(DeptCode.DEPT_NAME_ILLEGAL); ExceptionCast.cast(HrmsCode.DEPT_NAME_ILLEGAL);
} }
//实体类 //实体类
DeptEntity deptEntity = new DeptEntity(); DeptEntity deptEntity = new DeptEntity();
@ -69,13 +69,13 @@ public class DeptServiceImpl extends ServiceImpl<DeptDao, DeptEntity> implements
DeptEntity byId = this.getById(parentId); DeptEntity byId = this.getById(parentId);
if (byId == null) { if (byId == null) {
//抛出部门id不存在异常 //抛出部门id不存在异常
ExceptionCast.cast(DeptCode.DEPT_ID_NOT_EXSIT); ExceptionCast.cast(HrmsCode.DEPT_ID_NOT_EXSIT);
} }
//根据上级部门层级计算当前部门层级 //根据上级部门层级计算当前部门层级
int level = byId.getLevel() + 1; int level = byId.getLevel() + 1;
if (level > 5 || level < 1) { if (level > 5 || level < 1) {
//部门层级大于5级或小于1级,抛出异常 //部门层级大于5级或小于1级,抛出异常
ExceptionCast.cast(DeptCode.DEPT_LEVEL_ILLEGAL); ExceptionCast.cast(HrmsCode.DEPT_LEVEL_ILLEGAL);
} }
deptEntity.setLevel(level); deptEntity.setLevel(level);
} }
@ -110,14 +110,14 @@ public class DeptServiceImpl extends ServiceImpl<DeptDao, DeptEntity> implements
String deptName = dept.getName(); String deptName = dept.getName();
if (StringUtils.isEmpty(deptName)) { if (StringUtils.isEmpty(deptName)) {
ExceptionCast.cast(DeptCode.DEPT_NAME_ILLEGAL); ExceptionCast.cast(HrmsCode.DEPT_NAME_ILLEGAL);
} }
int count = this.count(new QueryWrapper<DeptEntity>() int count = this.count(new QueryWrapper<DeptEntity>()
.eq("name", deptName) .eq("name", deptName)
.notIn("id", dept.getId())); .notIn("id", dept.getId()));
if (count > 0) { if (count > 0) {
ExceptionCast.cast(DeptCode.DEPT_NAME_ILLEGAL); ExceptionCast.cast(HrmsCode.DEPT_NAME_ILLEGAL);
} }
return this.updateById(dept); return this.updateById(dept);
@ -132,7 +132,7 @@ public class DeptServiceImpl extends ServiceImpl<DeptDao, DeptEntity> implements
List<Long> list = Arrays.asList(ids); List<Long> list = Arrays.asList(ids);
list.forEach(id -> { list.forEach(id -> {
if (this.getBaseMapper().getEmpDeptCount(id) > 0) { if (this.getBaseMapper().getEmpDeptCount(id) > 0) {
ExceptionCast.cast(DeptCode.DEPT_EMP_EXSIT); ExceptionCast.cast(HrmsCode.DEPT_EMP_EXSIT);
} }
}); });
return this.removeByIds(list); return this.removeByIds(list);

@ -1,29 +1,30 @@
package com.daqing.financial.hrms.service.impl; package com.daqing.financial.hrms.service.impl;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.daqing.framework.utils.PageUtils;
import com.daqing.framework.utils.Query;
import com.daqing.financial.hrms.dao.PermissionDao; import com.daqing.financial.hrms.dao.PermissionDao;
import com.daqing.framework.domain.hrms.PermissionEntity;
import com.daqing.financial.hrms.service.PermissionService; import com.daqing.financial.hrms.service.PermissionService;
import com.daqing.framework.domain.hrms.PermissionEntity;
import org.springframework.stereotype.Service;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
@Service("permissionService") @Service("permissionService")
public class PermissionServiceImpl extends ServiceImpl<PermissionDao, PermissionEntity> implements PermissionService { public class PermissionServiceImpl extends ServiceImpl<PermissionDao, PermissionEntity> implements PermissionService {
@Override @Override
public PageUtils queryPage(Map<String, Object> params) { public List<PermissionEntity> listWithTree() {
IPage<PermissionEntity> page = this.page( return getPermissionTreeList(this.list(), 0L);
new Query<PermissionEntity>().getPage(params), }
new QueryWrapper<PermissionEntity>()
);
return new PageUtils(page); private List<PermissionEntity> getPermissionTreeList(List<PermissionEntity> list, Long parentId) {
return list.stream()
.filter(item -> parentId.equals(item.getParentId()))
.peek(item -> item.setChildren(getPermissionTreeList(list, item.getId())))
.sorted(Comparator.comparingInt(menu -> (menu.getSort() == null ? 0 : menu.getSort())))
.collect(Collectors.toList());
} }
} }

@ -2,28 +2,164 @@ package com.daqing.financial.hrms.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.daqing.financial.hrms.dao.DeptDao;
import com.daqing.financial.hrms.dao.DeptPositionDao;
import com.daqing.financial.hrms.dao.EmployeePositionDao;
import com.daqing.financial.hrms.dao.PositionDao; import com.daqing.financial.hrms.dao.PositionDao;
import com.daqing.financial.hrms.service.PositionService; import com.daqing.financial.hrms.service.PositionService;
import com.daqing.framework.domain.hrms.DeptEntity;
import com.daqing.framework.domain.hrms.DeptPositionEntity;
import com.daqing.framework.domain.hrms.EmployeePositionEntity;
import com.daqing.framework.domain.hrms.PositionEntity; import com.daqing.framework.domain.hrms.PositionEntity;
import com.daqing.framework.domain.hrms.ext.PositionVO;
import com.daqing.framework.domain.hrms.request.PositionRequest;
import com.daqing.framework.domain.hrms.response.HrmsCode;
import com.daqing.framework.domain.hrms.response.PositionResponse;
import com.daqing.framework.exception.ExceptionCast;
import com.daqing.framework.model.response.CommonCode;
import com.daqing.framework.utils.PageUtils; import com.daqing.framework.utils.PageUtils;
import com.daqing.framework.utils.Query; import com.daqing.framework.utils.SnowflakeIdUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Map; import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@Service("positionService") @Service("positionService")
public class PositionServiceImpl extends ServiceImpl<PositionDao, PositionEntity> implements PositionService { public class PositionServiceImpl extends ServiceImpl<PositionDao, PositionEntity> implements PositionService {
@Autowired
DeptPositionDao deptPositionDao;
@Autowired
DeptDao deptDao;
@Autowired
EmployeePositionDao employeePositionDao;
@Override
public PageUtils queryPage(Integer page, Integer size, String queryMsg) {
//分页参数
if (page <= 0) {
page = 1;
}
if (size <= 0) {
size = 10;
}
IPage<PositionVO> positionVO = this.getBaseMapper().pageByCondition(new Page(page, size), queryMsg);
return new PageUtils(positionVO);
}
@Override
@Transactional
public boolean savePosition(PositionRequest position) {
//TODO 用户id从当前登录token中获取,不由前端传递
if (position == null
|| position.getDeptIds() == null
|| position.getName() == null
|| position.getUserId() == null) {
ExceptionCast.cast(CommonCode.INVALID_PARAM);
}
//校验该部门下面有没有重复的职位
List<Long> deptIdList = Arrays.asList(position.getDeptIds());
deptIdList.forEach(deptId -> {
int count = this.getBaseMapper().getCountByNameAndDeptId(deptId, position.getName());
if (count > 0) {
ExceptionCast.cast(HrmsCode.DEPT_POSITION_EXSIT);
}
});
//添加职位信息
PositionEntity positionEntity = new PositionEntity();
BeanUtils.copyProperties(position, positionEntity);
positionEntity.setId(SnowflakeIdUtils.getRandomid());
positionEntity.setCreateUser(position.getUserId());
positionEntity.setCreateTime(new Date());
positionEntity.setMotifyTime(new Date());
boolean savePosition = this.save(positionEntity);
//添加部门职位关系表信息
List<DeptPositionEntity> deptPositionList = getDeptPositionList(deptIdList, positionEntity.getId());
int insertDeptPosition = deptPositionDao.saveBatch(deptPositionList);
return savePosition && insertDeptPosition > 0;
}
@Override @Override
public PageUtils queryPage(Map<String, Object> params) { @Transactional
IPage<PositionEntity> page = this.page( public boolean updatePosition(PositionRequest positionRequest) {
new Query<PositionEntity>().getPage(params), if (positionRequest == null
new QueryWrapper<PositionEntity>() || positionRequest.getId() == null
); || positionRequest.getDeptIds() == null
|| positionRequest.getName() == null) {
ExceptionCast.cast(CommonCode.INVALID_PARAM);
}
//校验该部门下面有没有重复的职位
List<Long> deptIdList = Arrays.asList(positionRequest.getDeptIds());
deptIdList.forEach(deptId -> {
int count = this.getBaseMapper().getCountByNameAndDeptIdAndId(deptId, positionRequest.getName(), positionRequest.getId());
if (count > 0) {
ExceptionCast.cast(HrmsCode.DEPT_POSITION_EXSIT);
}
});
PositionEntity positionEntity = new PositionEntity();
BeanUtils.copyProperties(positionRequest, positionEntity);
positionEntity.setMotifyTime(new Date());
boolean updateById = this.updateById(positionEntity);
//删除原关系
deptPositionDao.deleteByPositionId(positionRequest.getId());
List<DeptPositionEntity> deptPositionList = getDeptPositionList(deptIdList, positionEntity.getId());
//批量保存中间表
int insertDeptPosition = deptPositionDao.saveBatch(deptPositionList);
return updateById && insertDeptPosition > 0;
}
@Override
public PositionResponse getPositionById(Long id) {
List<DeptEntity> dept = deptDao.getByPositionId(id);
PositionResponse positionResponse = new PositionResponse();
BeanUtils.copyProperties(this.getById(id), positionResponse);
positionResponse.setDeptList(dept);
return positionResponse;
}
@Override
@Transactional
public void removePositionByIds(List<Long> idList) {
idList.forEach(id -> {
Integer count = employeePositionDao.selectCount(new QueryWrapper<EmployeePositionEntity>().eq("position_id", id));
if (count > 0) {
ExceptionCast.cast(HrmsCode.EMP_POSITION_EXSIT);
}
});
this.removeByIds(idList);
idList.forEach(id -> deptPositionDao.deleteByPositionId(id));
}
return new PageUtils(page); private List<DeptPositionEntity> getDeptPositionList(List<Long> deptIdList, Long id) {
return deptIdList.stream().map(deptId -> {
DeptPositionEntity deptPositionEntity = new DeptPositionEntity();
deptPositionEntity.setId(SnowflakeIdUtils.getRandomid());
deptPositionEntity.setDeptId(deptId);
deptPositionEntity.setPositionId(id);
return deptPositionEntity;
}).collect(Collectors.toList());
} }
} }

@ -20,5 +20,14 @@
<select id="getEmpDeptCount" parameterType="java.lang.Long" resultType="java.lang.Integer"> <select id="getEmpDeptCount" parameterType="java.lang.Long" resultType="java.lang.Integer">
SELECT count(1) FROM hrms_employee_dept WHERE dept_id = #{deptId} SELECT count(1) FROM hrms_employee_dept WHERE dept_id = #{deptId}
</select> </select>
<select id="getByPositionId" resultType="com.daqing.framework.domain.hrms.DeptEntity">
SELECT
d.*
FROM
hrms_dept d
INNER JOIN hrms_dept_position dp ON d.id = dp.dept_id
WHERE
dp.position_id = #{positionId}
</select>
</mapper> </mapper>

@ -0,0 +1,28 @@
<?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.daqing.financial.hrms.dao.DeptPositionDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.daqing.framework.domain.hrms.DeptPositionEntity" id="deptPositionMap">
<result property="id" column="id"/>
<result property="deptId" column="dept_id"/>
<result property="positionId" column="position_id"/>
</resultMap>
<insert id="saveBatch" parameterType="java.util.List">
INSERT INTO hrms_dept_position (id, dept_id, position_id)
VALUES
<foreach collection="list" index="index" separator="," item="item">
(#{item.id}, #{item.deptId}, #{item.positionId})
</foreach>
</insert>
<delete id="deleteByPositionId">
DELETE
FROM
hrms_dept_position
WHERE
position_id = #{positionId}
</delete>
</mapper>

@ -0,0 +1,14 @@
<?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.daqing.financial.hrms.dao.EmployeeDeptDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.daqing.framework.domain.hrms.EmployeeDeptEntity" id="employeeDeptMap">
<result property="id" column="id"/>
<result property="employeeId" column="employee_id"/>
<result property="deptId" column="dept_id"/>
</resultMap>
</mapper>

@ -0,0 +1,14 @@
<?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.daqing.financial.hrms.dao.EmployeePositionDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.daqing.framework.domain.hrms.EmployeePositionEntity" id="employeePositionMap">
<result property="id" column="id"/>
<result property="empId" column="emp_id"/>
<result property="positionId" column="position_id"/>
</resultMap>
</mapper>

@ -0,0 +1,14 @@
<?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.daqing.financial.hrms.dao.EmployeeRoleDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.daqing.framework.domain.hrms.EmployeeRoleEntity" id="employeeRoleMap">
<result property="id" column="id"/>
<result property="userId" column="user_id"/>
<result property="roleId" column="role_id"/>
</resultMap>
</mapper>

@ -6,13 +6,78 @@
<!-- 可根据自己的需求,是否要使用 --> <!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.daqing.framework.domain.hrms.PositionEntity" id="positionMap"> <resultMap type="com.daqing.framework.domain.hrms.PositionEntity" id="positionMap">
<result property="id" column="id"/> <result property="id" column="id"/>
<result property="deptId" column="dept_id"/>
<result property="name" column="name"/> <result property="name" column="name"/>
<result property="introduction" column="introduction"/> <result property="introduction" column="introduction"/>
<result property="sort" column="sort"/> <result property="sort" column="sort"/>
<result property="createUser" column="create_user"/>
<result property="createTime" column="create_time"/> <result property="createTime" column="create_time"/>
<result property="motifyTime" column="motify_time"/> <result property="motifyTime" column="motify_time"/>
</resultMap> </resultMap>
<resultMap type="com.daqing.framework.domain.hrms.ext.PositionVO" id="positionVOMap">
<result property="id" column="position_id"/>
<result property="name" column="position_name"/>
<result property="deptNames" column="dept_name"/>
<result property="createUserName" column="crate_user_name"/>
<result property="createTime" column="create_time"/>
</resultMap>
<select id="pageByCondition" resultMap="positionVOMap">
SELECT
p.`id`, position_id,
p.`name` position_name,
GROUP_CONCAT(d.`name` SEPARATOR '/') dept_name,
e.`name` crate_user_name,
p.create_time
FROM
hrms_position p
INNER JOIN hrms_dept_position dp ON p.id = dp.position_id
INNER JOIN hrms_dept d ON dp.dept_id = d.id
INNER JOIN hrms_employee e ON p.create_user = e.id
<if test="queryMsg != null and queryMsg != ''">
WHERE
(
d.`name` LIKE CONCAT('%',#{queryMsg},'%')
OR p.`name` LIKE CONCAT('%',#{queryMsg},'%')
)
</if>
GROUP BY
p.id
ORDER BY
p.create_time
</select>
<select id="getCountByNameAndDeptId" resultType="java.lang.Integer">
SELECT
COUNT(1)
FROM
hrms_position p
INNER JOIN
hrms_dept_position dp
ON
p.id = dp.position_id
WHERE
dp.dept_id = #{deptId}
AND
p.name = #{name}
</select>
<select id="getCountByNameAndDeptIdAndId" resultType="java.lang.Integer">
SELECT
COUNT(1)
FROM
hrms_position p
INNER JOIN
hrms_dept_position dp
ON
p.id = dp.position_id
WHERE
dp.dept_id = #{deptId}
AND
p.name = #{name}
AND
p.id != #{id}
</select>
</mapper> </mapper>

@ -0,0 +1,14 @@
<?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.daqing.financial.hrms.dao.RolePermissionDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.daqing.framework.domain.hrms.RolePermissionEntity" id="rolePermissionMap">
<result property="id" column="id"/>
<result property="roleId" column="role_id"/>
<result property="permissionId" column="permission_id"/>
</resultMap>
</mapper>

@ -59,4 +59,11 @@ public class DeptEntity implements Serializable {
@JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonInclude(JsonInclude.Include.NON_EMPTY)
@TableField(exist = false) @TableField(exist = false)
private List<DeptEntity> children; private List<DeptEntity> children;
/**
* 部门成员
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@TableField(exist = false)
private List<EmployeeEntity> employeeEntities;
} }

@ -0,0 +1,36 @@
package com.daqing.framework.domain.hrms;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
/**
*
*
* @author gongsj
* @email gongsj@gmail.com
* @date 2020-09-07 16:26:04
*/
@Data
@TableName("hrms_dept_position")
public class DeptPositionEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(value = "id", type = IdType.INPUT)
private Long id;
/**
* 部门id
*/
private Long deptId;
/**
* 职位id
*/
private Long positionId;
}

@ -1,12 +1,15 @@
package com.daqing.framework.domain.hrms; package com.daqing.framework.domain.hrms;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
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.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import lombok.Data; import java.util.List;
/** /**
* 记录菜单权限 * 记录菜单权限
@ -69,5 +72,10 @@ public class PermissionEntity implements Serializable {
* 更新时间 * 更新时间
*/ */
private Date motifyTime; private Date motifyTime;
/**
* 子权限
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@TableField(exist = false)
private List<PermissionEntity> children;
} }

@ -25,10 +25,6 @@ public class PositionEntity implements Serializable {
*/ */
@TableId(value = "id", type = IdType.INPUT) @TableId(value = "id", type = IdType.INPUT)
private Long id; private Long id;
/**
* 部门id
*/
private Long deptId;
/** /**
* 职位名称 * 职位名称
*/ */
@ -41,6 +37,10 @@ public class PositionEntity implements Serializable {
* 排序 * 排序
*/ */
private Integer sort; private Integer sort;
/**
* 创建人id
*/
private Long createUser;
/** /**
* 创建时间 * 创建时间
*/ */

@ -0,0 +1,38 @@
package com.daqing.framework.domain.hrms.ext;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 记录职位信息
*
* @author gongsj
* @email gongsj@gmail.com
* @date 2020-09-07 16:26:04
*/
@Data
public class PositionVO implements Serializable {
/**
* 主键
*/
private Long id;
/**
* 职位名称
*/
private String name;
/**
* 所属部门
*/
private String deptNames;
/**
* 创建人
*/
private String createUserName;
/**
* 创建时间
*/
private Date createTime;
}

@ -0,0 +1,36 @@
package com.daqing.framework.domain.hrms.request;
import lombok.Data;
import java.io.Serializable;
/**
* 记录职位信息
*
* @author gongsj
* @email gongsj@gmail.com
* @date 2020-09-07 16:26:04
*/
@Data
public class PositionRequest implements Serializable {
/**
* 主键
*/
private Long id;
/**
* 用户id
*/
private Long userId;
/**
* 部门id
*/
private Long[] deptIds;
/**
* 职位名称
*/
private String name;
/**
* 职位介绍
*/
private String introduction;
}

@ -13,12 +13,14 @@ import lombok.ToString;
*/ */
@ToString @ToString
@AllArgsConstructor @AllArgsConstructor
public enum DeptCode implements ResultCode { public enum HrmsCode implements ResultCode {
DEPT_NAME_ILLEGAL(false, 22001, "部门名称为空或已存在!"), DEPT_NAME_ILLEGAL(false, 22001, "部门名称为空或已存在!"),
DEPT_ID_NOT_EXSIT(false, 22002, "部门id不存在!"), DEPT_ID_NOT_EXSIT(false, 22002, "部门id不存在!"),
DEPT_LEVEL_ILLEGAL(false, 22003, "部门层级不可超出5级!"), DEPT_LEVEL_ILLEGAL(false, 22003, "部门层级不可超出5级!"),
DEPT_EMP_EXSIT(false, 22004, "请将部门下所有员工移除后再执行删除操作!"); DEPT_EMP_EXSIT(false, 22004, "请将部门下所有员工移除后再执行删除操作!"),
DEPT_POSITION_EXSIT(false, 22005, "该部门下已存在该职位!"),
EMP_POSITION_EXSIT(false, 22006, "该职位下已关联员工!");
/** /**
* 操作是否成功 * 操作是否成功

@ -0,0 +1,35 @@
package com.daqing.framework.domain.hrms.response;
import com.daqing.framework.domain.hrms.DeptEntity;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 记录职位信息
*
* @author gongsj
* @email gongsj@gmail.com
* @date 2020-09-07 16:26:04
*/
@Data
public class PositionResponse implements Serializable {
/**
* 主键
*/
private Long id;
/**
* 职位名称
*/
private String name;
/**
* 职位介绍
*/
private String introduction;
/**
* 部门列表
*/
private List<DeptEntity> deptList;
}
Loading…
Cancel
Save