|
@@ -1,10 +1,25 @@
|
|
|
package com.management.platform.controller;
|
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.management.platform.entity.CommonUse;
|
|
|
+import com.management.platform.entity.FastAccess;
|
|
|
+import com.management.platform.entity.SysModule;
|
|
|
+import com.management.platform.entity.User;
|
|
|
+import com.management.platform.service.CommonUseService;
|
|
|
+import com.management.platform.service.FastAccessService;
|
|
|
+import com.management.platform.service.SysModuleService;
|
|
|
+import com.management.platform.service.UserService;
|
|
|
+import com.management.platform.util.HttpRespMsg;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
/**
|
|
|
* <p>
|
|
|
* 菜单表 前端控制器
|
|
@@ -16,6 +31,71 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
@RestController
|
|
|
@RequestMapping("/sys-module")
|
|
|
public class SysModuleController {
|
|
|
+ @Resource
|
|
|
+ private SysModuleService sysModuleService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private UserService userService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private FastAccessService fastAccessService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private CommonUseService commonUseService;
|
|
|
+
|
|
|
+ @RequestMapping("/getAllSysModule")
|
|
|
+ public HttpRespMsg getAllSysModule() {
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
+ msg.data = sysModuleService.list(new QueryWrapper<SysModule>().notLike("name","详情").isNull("parent_id"));
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/getFastAccessList")
|
|
|
+ public HttpRespMsg getFastAccessList(HttpServletRequest request) {
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
+ User user = userService.getById(request.getHeader("token"));
|
|
|
+ msg.data= fastAccessService.list(new QueryWrapper<FastAccess>().eq("company_id", user.getCompanyId()));
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/getCommonUseList")
|
|
|
+ public HttpRespMsg getCommonUseList(HttpServletRequest request) {
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
+ User user = userService.getById(request.getHeader("token"));
|
|
|
+ msg.data= commonUseService.list(new QueryWrapper<CommonUse>().eq("company_id", user.getCompanyId()));
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/saveCommonUseList")
|
|
|
+ public HttpRespMsg getCommonUseList(String jsonstr, HttpServletRequest request) {
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
+ User user = userService.getById(request.getHeader("token"));
|
|
|
+ if (StringUtils.isNotBlank(jsonstr)) {
|
|
|
+ List<CommonUse> commonUses = JSONArray.parseArray(jsonstr, CommonUse.class);
|
|
|
+ if (!commonUses.isEmpty()){
|
|
|
+ commonUses.forEach(c->c.setCompanyId(user.getCompanyId()));
|
|
|
+ }
|
|
|
+ commonUseService.remove(new QueryWrapper<CommonUse>().eq("company_id", user.getCompanyId()));
|
|
|
+ commonUseService.saveOrUpdateBatch(commonUses);
|
|
|
+ }
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/saveFastAccessList")
|
|
|
+ public HttpRespMsg saveFastAccessList(String jsonstr, HttpServletRequest request) {
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
+ User user = userService.getById(request.getHeader("token"));
|
|
|
+ if (StringUtils.isNotBlank(jsonstr)) {
|
|
|
+ List<FastAccess> fastAccessList = JSONArray.parseArray(jsonstr, FastAccess.class);
|
|
|
+ if (!fastAccessList.isEmpty()){
|
|
|
+ fastAccessList.forEach(c->c.setCompanyId(user.getCompanyId()));
|
|
|
+ }
|
|
|
+ fastAccessService.remove(new QueryWrapper<FastAccess>().eq("company_id", user.getCompanyId()));
|
|
|
+ fastAccessService.saveOrUpdateBatch(fastAccessList);
|
|
|
+ }
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|