|
@@ -0,0 +1,62 @@
|
|
|
+package com.zy.bms.controller;
|
|
|
+
|
|
|
+
|
|
|
+import com.zy.bms.common.ServerResponse;
|
|
|
+import com.zy.bms.entity.PrivilegeApplyRecord;
|
|
|
+import com.zy.bms.pojo.io.PrivilegeApplyIO;
|
|
|
+import com.zy.bms.service.IGroupService;
|
|
|
+import com.zy.bms.service.IPrivilegeApplyRecordService;
|
|
|
+import com.zy.bms.service.IUserPrivilegeService;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.time.LocalDateTime;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 权限申请记录 前端控制器
|
|
|
+ *
|
|
|
+ * @author chenyi
|
|
|
+ * @since 2021-07-12
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/bms/privilegeApply")
|
|
|
+public class PrivilegeApplyRecordController extends BaseController {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IPrivilegeApplyRecordService privilegeApplyRecordService;
|
|
|
+ @Resource
|
|
|
+ private IUserPrivilegeService userPrivilegeService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分页查询
|
|
|
+ */
|
|
|
+ @PostMapping("listPage.do")
|
|
|
+ public ServerResponse listPage(PrivilegeApplyIO io) {
|
|
|
+ return ServerResponse.createBySuccess(privilegeApplyRecordService.listPage(io));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 审核
|
|
|
+ */
|
|
|
+ @PostMapping("audit.do")
|
|
|
+ public ServerResponse audit(PrivilegeApplyRecord entity, String[] groups) {
|
|
|
+ //审核时间
|
|
|
+ entity.setAuditTime(LocalDateTime.now());
|
|
|
+ //保存有权限的设备组
|
|
|
+ userPrivilegeService.saveBatch(userId(), groups);
|
|
|
+ //更新申请记录
|
|
|
+ privilegeApplyRecordService.updateById(entity);
|
|
|
+ return ServerResponse.createBySuccess();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 申请权限
|
|
|
+ */
|
|
|
+ @PostMapping("apply.do")
|
|
|
+ public ServerResponse apply(PrivilegeApplyRecord entity) {
|
|
|
+ entity.setUserId(userId());
|
|
|
+ return ServerResponse.createBySuccess(privilegeApplyRecordService.save(entity));
|
|
|
+ }
|
|
|
+}
|