StaffRightService.java 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. package com.dk.mdm.service.mst;
  2. import com.dk.common.response.ResponseResultUtil;
  3. import com.dk.common.response.ResponseResultVO;
  4. import com.dk.common.model.pojo.mst.StaffRight;
  5. import com.dk.mdm.mapper.mst.StaffRightMapper;
  6. import com.dk.common.service.BaseService;
  7. import com.dk.common.mapper.BaseMapper;
  8. import org.springframework.stereotype.Service;
  9. import org.springframework.beans.factory.annotation.Autowired;
  10. import org.springframework.transaction.annotation.Transactional;
  11. import java.util.HashMap;
  12. import java.util.List;
  13. import java.util.Map;
  14. /**
  15. * @author : 姜永辉
  16. * @desc : 获取员工权限
  17. * @date : 2024/2/26 10:36
  18. */
  19. @Service
  20. public class StaffRightService extends BaseService<StaffRight> {
  21. @Override
  22. public BaseMapper<StaffRight> getRepository() {
  23. return staffRightMapper;
  24. }
  25. @Autowired
  26. private StaffRightMapper staffRightMapper;
  27. /**
  28. * @desc : 获取员工权限
  29. * @author : 姜永辉
  30. * @date : 2024/2/26 10:36
  31. */
  32. public ResponseResultVO<Map<String, Object>> getStaffRight(Map<String, Object> param) {
  33. // 获取系统基础数据
  34. List<Map<String, Object>> list = staffRightMapper.getStaffRight(param);
  35. Map<String, Object> objectObjectHashMap = new HashMap<>();
  36. objectObjectHashMap.put("list", list);
  37. return ResponseResultUtil.success(objectObjectHashMap);
  38. }
  39. /**
  40. * @desc : 保存员工权限
  41. * @author : 姜永辉
  42. * @date : 2024/2/26 10:36
  43. */
  44. @Transactional(rollbackFor = {Exception.class})
  45. public ResponseResultVO<?> saveStaffRight(List<StaffRight> staffRightList) {
  46. staffRightMapper.insertBatch(staffRightList);
  47. return ResponseResultUtil.success();
  48. }
  49. public ResponseResultVO<Boolean> delete(String id) {
  50. return ResponseResultUtil.success(staffRightMapper.deleteById(new StaffRight().setStaffId(id)) > 0) ;
  51. }
  52. /**
  53. * @desc : WEB获取员工权限
  54. * @author : 常皓宁
  55. * @date : 2024/3/6 13:16
  56. */
  57. public ResponseResultVO<Map<String, Object>> getStaffRightWeb(Map<String, Object> param) {
  58. // 获取系统基础数据
  59. List<Map<String, Object>> list = staffRightMapper.getStaffRightWeb(param);
  60. Map<String, Object> objectObjectHashMap = new HashMap<>();
  61. objectObjectHashMap.put("list", list);
  62. return ResponseResultUtil.success(objectObjectHashMap);
  63. }
  64. }