From 864a545636b2ca6aeee4afbdb4d6b0acd6238925 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期一, 10 七月 2023 15:02:52 +0800 Subject: [PATCH] 1 --- src/main/java/com/moon/server/controller/sys/ResController.java | 30 ++++++++++++++++++++++++++---- src/main/java/com/moon/server/config/InitConfig.java | 11 ++++++----- 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/moon/server/config/InitConfig.java b/src/main/java/com/moon/server/config/InitConfig.java index a7d5484..505f84d 100644 --- a/src/main/java/com/moon/server/config/InitConfig.java +++ b/src/main/java/com/moon/server/config/InitConfig.java @@ -7,11 +7,12 @@ import com.moon.server.helper.PathHelper; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationRunner; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; + +import javax.annotation.Resource; /** * 鍒濆鍖栧畬鎴愰厤缃被 @@ -21,16 +22,16 @@ public class InitConfig implements ApplicationRunner { private final static Log log = LogFactory.getLog(InitConfig.class); - @Autowired + @Resource PathHelper pathHelper; - @Autowired + @Resource ArgsService argsService; - @Autowired + @Resource Environment env; - //@Autowired + //@Resource //TestService testService; @Override diff --git a/src/main/java/com/moon/server/controller/sys/ResController.java b/src/main/java/com/moon/server/controller/sys/ResController.java index a99890f..09fb3e1 100644 --- a/src/main/java/com/moon/server/controller/sys/ResController.java +++ b/src/main/java/com/moon/server/controller/sys/ResController.java @@ -5,6 +5,7 @@ import com.moon.server.entity.all.ResponseMsg; import com.moon.server.entity.sys.ResEntity; import com.moon.server.entity.sys.UserEntity; +import com.moon.server.service.all.PermsService; import com.moon.server.service.all.UploadAttachService; import com.moon.server.service.sys.ResService; import com.moon.server.service.sys.TokenService; @@ -12,10 +13,10 @@ import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; +import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.List; @@ -28,13 +29,16 @@ @RestController @RequestMapping("/res") public class ResController extends BaseController { - @Autowired + @Resource ResService resService; - @Autowired + @Resource TokenService tokenService; - @Autowired + @Resource + PermsService permsService; + + @Resource UploadAttachService uploadAttachService; private final static String TAB_NAME = "lf.sys_res"; @@ -161,6 +165,9 @@ } int count = resService.insert(entity); + if (count > 0) { + permsService.clearResCache(); + } return success(count); } catch (Exception ex) { @@ -184,6 +191,9 @@ } int count = resService.inserts(list); + if (count > 0) { + permsService.clearResCache(); + } return success(count); } catch (Exception ex) { @@ -200,6 +210,9 @@ public ResponseMsg<Integer> delete(int id) { try { int count = resService.delete(id); + if (count > 0) { + permsService.clearResCache(); + } return success(count); } catch (Exception ex) { @@ -220,6 +233,9 @@ } int count = resService.deletes(ids); + if (count > 0) { + permsService.clearResCache(); + } return success(count); } catch (Exception ex) { @@ -242,6 +258,9 @@ } int count = resService.update(entity); + if (count > 0) { + permsService.clearResCache(); + } return success(count); } catch (Exception ex) { @@ -266,6 +285,9 @@ } int count = resService.updates(list); + if (count > 0) { + permsService.clearResCache(); + } return success(count); } catch (Exception ex) { -- Gitblit v1.9.3