From b9f3cac2049d5e24828eb9b29d1262454b3c5ec5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=AE=E9=86=BA?=
<14463847+zmw770157181@user.noreply.gitee.com>
Date: Mon, 30 Sep 2024 15:33:37 +0800
Subject: [PATCH] =?UTF-8?q?1.feat():=20=E6=B7=BB=E5=8A=A0=20redis=E7=BC=93?=
=?UTF-8?q?=E5=AD=98=202.fix():=20=E6=9B=B4=E6=96=B0=E5=85=AC=E5=85=B1?=
=?UTF-8?q?=E8=B7=AF=E5=BE=84=20=E6=9B=B4=E6=96=B0=E6=97=B6=E9=97=B4093015?=
=?UTF-8?q?33?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
cloud-common/cloud-common-cache/pom.xml | 26 +++++++++++
.../common/cache/config/CacheAbsBasic.java | 33 ++++++++++++++
.../muyu/common/cache/config/CacheBasic.java | 21 +++++++++
.../common/cache/config/PrimaryKeyBasic.java | 45 +++++++++++++++++++
...ot.autoconfigure.AutoConfiguration.imports | 1 +
cloud-common/pom.xml | 1 +
.../cloud-modules-enterprise-cache/pom.xml | 39 ++++++++++++++++
.../cache/CarManageCacheService.java | 30 +++++++++++++
...ot.autoconfigure.AutoConfiguration.imports | 1 +
.../cloud-modules-enterprise-server/pom.xml | 7 +++
.../CloudEnterpriseApplication.java | 3 +-
.../controller/CarCompanyController.java | 7 ++-
.../controller/CarConfigController.java | 7 ++-
.../controller/CarManageController.java | 16 +++++--
.../controller/CarMessageController.java | 8 +++-
.../controller/CarMessageTypeController.java | 8 +++-
.../controller/CarTemplateController.java | 8 +++-
.../controller/CarTypeController.java | 9 +++-
.../cloud-modules-enterprise/pom.xml | 1 +
19 files changed, 253 insertions(+), 18 deletions(-)
create mode 100644 cloud-common/cloud-common-cache/pom.xml
create mode 100644 cloud-common/cloud-common-cache/src/main/java/com/muyu/common/cache/config/CacheAbsBasic.java
create mode 100644 cloud-common/cloud-common-cache/src/main/java/com/muyu/common/cache/config/CacheBasic.java
create mode 100644 cloud-common/cloud-common-cache/src/main/java/com/muyu/common/cache/config/PrimaryKeyBasic.java
create mode 100644 cloud-common/cloud-common-cache/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
create mode 100644 cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/pom.xml
create mode 100644 cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/java/com/muyu/enterprise/cache/CarManageCacheService.java
create mode 100644 cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
diff --git a/cloud-common/cloud-common-cache/pom.xml b/cloud-common/cloud-common-cache/pom.xml
new file mode 100644
index 0000000..7166c7a
--- /dev/null
+++ b/cloud-common/cloud-common-cache/pom.xml
@@ -0,0 +1,26 @@
+
+
+
+ com.muyu
+ cloud-common
+ 3.6.3
+
+ 4.0.0
+
+ cloud-common-cache
+
+
+ cloud-common-cache redis缓存架构
+
+
+
+
+
+ com.muyu
+ cloud-common-redis
+
+
+
+
diff --git a/cloud-common/cloud-common-cache/src/main/java/com/muyu/common/cache/config/CacheAbsBasic.java b/cloud-common/cloud-common-cache/src/main/java/com/muyu/common/cache/config/CacheAbsBasic.java
new file mode 100644
index 0000000..d7b3575
--- /dev/null
+++ b/cloud-common/cloud-common-cache/src/main/java/com/muyu/common/cache/config/CacheAbsBasic.java
@@ -0,0 +1,33 @@
+package com.muyu.common.cache.config;
+/**
+ * 抽象缓存层
+ * @ClassName CacheAbsBasic
+ * @Description CacheAbsBasic:类的描述
+ * @Date 2024/9/30 1:39
+ * @author MingWei.Zong
+ */
+
+import com.muyu.common.redis.service.RedisService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+
+public abstract class CacheAbsBasic implements CacheBasic {
+
+ @Autowired
+ private RedisService redisService;
+
+ @Override
+ public void put(K key, V value) {
+ redisService.setCacheObject(encode(key),value);
+ }
+
+ @Override
+ public V get(K key) {
+ return redisService.getCacheObject(encode(key));
+ }
+
+ @Override
+ public void remove(K key) {
+ redisService.deleteObject(encode(key));
+ }
+}
diff --git a/cloud-common/cloud-common-cache/src/main/java/com/muyu/common/cache/config/CacheBasic.java b/cloud-common/cloud-common-cache/src/main/java/com/muyu/common/cache/config/CacheBasic.java
new file mode 100644
index 0000000..9b8bb4f
--- /dev/null
+++ b/cloud-common/cloud-common-cache/src/main/java/com/muyu/common/cache/config/CacheBasic.java
@@ -0,0 +1,21 @@
+package com.muyu.common.cache.config;
+
+import java.awt.image.Kernel;
+
+/**
+ * 缓存基础
+ * @ClassName CacheBasic
+ * @Description CacheBasic:类的描述
+ * @Date 2024/9/30 1:36
+ * @author MingWei.Zong
+ */
+
+public interface CacheBasic extends PrimaryKeyBasic{
+ void put(K key,V value);
+
+ V get(K key);
+
+ void remove(K key);
+
+
+}
diff --git a/cloud-common/cloud-common-cache/src/main/java/com/muyu/common/cache/config/PrimaryKeyBasic.java b/cloud-common/cloud-common-cache/src/main/java/com/muyu/common/cache/config/PrimaryKeyBasic.java
new file mode 100644
index 0000000..88e822f
--- /dev/null
+++ b/cloud-common/cloud-common-cache/src/main/java/com/muyu/common/cache/config/PrimaryKeyBasic.java
@@ -0,0 +1,45 @@
+package com.muyu.common.cache.config;
+
+/**
+ * 主键基础
+ * @ClassName PrimaryKeyBasic
+ * @Description PrimaryKeyBasic:类的描述
+ * @Date 2024/9/30 0:15
+ * @author MingWei.Zong
+ */
+public interface PrimaryKeyBasic {
+ /**
+ * key 前缀
+ */
+ public String keyPre();
+
+ /**
+ * 编码
+ * @param key 缓存键
+ * @return 装修键
+ */
+ public default String encode(K key){
+ return keyPre() + key.toString();
+ }
+
+ /**
+ * 解码 Key
+ * @param key 解码后的key
+ * @return
+ */
+ public K decode(String key);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
diff --git a/cloud-common/cloud-common-cache/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/cloud-common/cloud-common-cache/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000..6bb15df
--- /dev/null
+++ b/cloud-common/cloud-common-cache/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.muyu.common.cache.config.SpringDocConfig
diff --git a/cloud-common/pom.xml b/cloud-common/pom.xml
index d052b4d..a99da4c 100644
--- a/cloud-common/pom.xml
+++ b/cloud-common/pom.xml
@@ -21,6 +21,7 @@
cloud-common-system
cloud-common-xxl
cloud-common-rabbit
+ cloud-common-cache
cloud-common
diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/pom.xml b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/pom.xml
new file mode 100644
index 0000000..f4c2c48
--- /dev/null
+++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/pom.xml
@@ -0,0 +1,39 @@
+
+
+ 4.0.0
+
+ com.muyu
+ cloud-modules-enterprise
+ 3.6.3
+
+
+ cloud-modules-enterprise-cache
+
+
+ 17
+ 17
+ UTF-8
+
+
+
+ cloud-modules-enterprise-cache redis 缓存平台
+
+
+
+
+
+ com.muyu
+ cloud-common-cache
+ 3.6.3
+
+
+ com.muyu
+ cloud-modules-enterprise-common
+
+
+
+
+
+
diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/java/com/muyu/enterprise/cache/CarManageCacheService.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/java/com/muyu/enterprise/cache/CarManageCacheService.java
new file mode 100644
index 0000000..f2de7c8
--- /dev/null
+++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/java/com/muyu/enterprise/cache/CarManageCacheService.java
@@ -0,0 +1,30 @@
+package com.muyu.enterprise.cache;
+
+import com.muyu.common.cache.config.CacheAbsBasic;
+import com.muyu.enterprise.domain.CarManage;
+
+/**
+ * 控制层
+ * 业务实现层
+ * @ClassName VehicleCacheService
+ * @Description VehicleCacheService:类的描述
+ * @Date 2024/9/30 11:42
+ * @author MingWei.Zong
+ */
+
+public class CarManageCacheService extends CacheAbsBasic {
+ @Override
+ public String keyPre() {
+ return "carManage:info:";
+ }
+
+// @Override
+// public String encode(String key) {
+// return super.encode(key);
+// }
+
+ @Override
+ public String decode(String key) {
+ return key.replace("carManage:info:","");
+ }
+}
diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
new file mode 100644
index 0000000..606fe14
--- /dev/null
+++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -0,0 +1 @@
+com.muyu.enterprise.cache.CarManageCacheService
diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/pom.xml b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/pom.xml
index 737986f..4b5e544 100644
--- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/pom.xml
+++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/pom.xml
@@ -77,6 +77,13 @@
cloud-common-api-doc
+
+
+ com.muyu
+ cloud-modules-enterprise-cache
+ 3.6.3
+
+
com.muyu
diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/CloudEnterpriseApplication.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/CloudEnterpriseApplication.java
index ddd295f..8d19c0f 100644
--- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/CloudEnterpriseApplication.java
+++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/CloudEnterpriseApplication.java
@@ -6,8 +6,7 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
- * 系统模块
- *
+ * 企业模块
* @author muyu
*/
@EnableCustomConfig
diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/CarCompanyController.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/CarCompanyController.java
index bdca8a8..8e86b37 100644
--- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/CarCompanyController.java
+++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/CarCompanyController.java
@@ -5,6 +5,7 @@ import com.muyu.enterprise.service.CarCompanyService;
import com.muyu.common.core.domain.Result;
import com.muyu.common.core.web.controller.BaseController;
import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -19,17 +20,19 @@ import java.util.List;
*/
@RestController
@RequestMapping("/carCompany")
+/** 构造必备注解 只有用 final 修饰 才会被构造注入 */
+@RequiredArgsConstructor //制动构造注入 默认无参 Lombook包下
@Tag(name = "CarCompanyController", description = "企业表")
public class CarCompanyController extends BaseController {
- @Autowired
- private CarCompanyService sysCarCompanyService;
+ private final CarCompanyService sysCarCompanyService;
/**
* 查询企业表
*/
@PostMapping("selectCompany")
public Result> selectCompany(){
+ startPage();
return Result.success(sysCarCompanyService.list());
}
diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/CarConfigController.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/CarConfigController.java
index 42c6e31..4ee3ec2 100644
--- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/CarConfigController.java
+++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/CarConfigController.java
@@ -6,6 +6,7 @@ import com.muyu.enterprise.domain.CarCompany;
import com.muyu.enterprise.service.CarCompanyService;
import com.muyu.enterprise.service.CarConfigService;
import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -23,11 +24,12 @@ import java.util.List;
*/
@RestController
@RequestMapping("/carConfig")
+/** 构造必备注解 只有用 final 修饰 才会被构造注入 */
+@RequiredArgsConstructor //制动构造注入 默认无参 Lombook包下
@Tag(name = "CarConfigController", description = "车辆配置")
public class CarConfigController extends BaseController {
- @Autowired
- private CarConfigService carConfigService;
+ private final CarConfigService carConfigService;
/**
* 通过 configId 查询企业
@@ -36,6 +38,7 @@ public class CarConfigController extends BaseController {
*/
@PostMapping("selectByConfigId")
public Result selectByConfigId(@RequestParam("configId") Long configId){
+ startPage();
return Result.success(carConfigService.selectByConfigId(configId));
}
diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/CarManageController.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/CarManageController.java
index 3557977..768d33b 100644
--- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/CarManageController.java
+++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/CarManageController.java
@@ -3,6 +3,7 @@ package com.muyu.enterprise.controller;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.RandomUtil;
import com.muyu.common.core.utils.StringUtils;
+import com.muyu.enterprise.cache.CarManageCacheService;
import com.muyu.enterprise.domain.CarManage;
import com.muyu.enterprise.domain.dto.CarDTO;
import com.muyu.enterprise.domain.vo.CarVO;
@@ -14,6 +15,7 @@ import com.muyu.common.core.web.page.TableDataInfo;
import com.muyu.common.security.utils.SecurityUtils;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -28,13 +30,16 @@ import java.util.List;
*/
@RestController
@RequestMapping("/carManage")
+/** 构造必备注解 只有用 final 修饰 才会被构造注入 */
+@RequiredArgsConstructor //制动构造注入 默认无参 Lombook包下
@Tag(name = "CarManageController", description = "车辆管理")
public class CarManageController extends BaseController {
- @Autowired
- private CarCompanyService sysCarCompanyService;
- @Autowired
- private CarManageService sysCarService;
+ private final CarManageCacheService carManageCacheService;
+
+ private final CarCompanyService sysCarCompanyService;
+
+ private final CarManageService sysCarService;
/**
@@ -44,6 +49,7 @@ public class CarManageController extends BaseController {
*/
@PostMapping("carListShow2")
public Result> carListShow2(@RequestBody CarDTO carDTO){
+ startPage();
return Result.success(sysCarService.carListShow2(carDTO));
}
@@ -82,6 +88,8 @@ public class CarManageController extends BaseController {
String key2 = RandomUtil.randomNumbers(17);
carVO.setCarVin(key2);
sysCarService.save(carVO);
+ // 存到缓存中去
+ carManageCacheService.put(carVO.getCarVin(),new CarManage());
return Result.success("车辆添加成功");
}
diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/CarMessageController.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/CarMessageController.java
index c71f571..3e5c555 100644
--- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/CarMessageController.java
+++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/CarMessageController.java
@@ -6,6 +6,7 @@ import com.muyu.common.core.web.controller.BaseController;
import com.muyu.enterprise.domain.CarMessage;
import com.muyu.enterprise.service.CarMessageService;
import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -20,10 +21,12 @@ import java.util.List;
*/
@RestController
@RequestMapping("/carMessage")
+/** 构造必备注解 只有用 final 修饰 才会被构造注入 */
+@RequiredArgsConstructor //制动构造注入 默认无参 Lombook包下
@Tag(name = "报文",description = "报文模块")
public class CarMessageController extends BaseController {
- @Autowired
- private CarMessageService sysCarMessageService;
+
+ private final CarMessageService sysCarMessageService;
/**
* 查询所有报文信息
@@ -31,6 +34,7 @@ public class CarMessageController extends BaseController {
*/
@PostMapping("selectMessageShow")
public List selectMessageShow(@RequestParam("templateId") Long templateId){
+ startPage();
return sysCarMessageService.selectMessageShow(templateId);
}
diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/CarMessageTypeController.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/CarMessageTypeController.java
index 7169683..dbe7429 100644
--- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/CarMessageTypeController.java
+++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/CarMessageTypeController.java
@@ -7,6 +7,7 @@ import com.muyu.common.security.utils.SecurityUtils;
import com.muyu.enterprise.domain.CarMessageType;
import com.muyu.enterprise.service.CarMessageTypeService;
import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -21,10 +22,12 @@ import java.util.List;
*/
@RestController
@RequestMapping("carMessageType")
+/** 构造必备注解 只有用 final 修饰 才会被构造注入 */
+@RequiredArgsConstructor //制动构造注入 默认无参 Lombook包下
@Tag(name = "报文类型" ,description = "报文类型")
public class CarMessageTypeController extends BaseController {
- @Autowired
- private CarMessageTypeService sysCarMessageTypeService;
+
+ private final CarMessageTypeService sysCarMessageTypeService;
/**
* 查询报文类型
@@ -32,6 +35,7 @@ public class CarMessageTypeController extends BaseController {
*/
@PostMapping("messageTypeList")
public Result messageTypeList(){
+ startPage();
List list = sysCarMessageTypeService.list();
return Result.success(list);
}
diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/CarTemplateController.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/CarTemplateController.java
index 8388d7e..a5a3329 100644
--- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/CarTemplateController.java
+++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/CarTemplateController.java
@@ -5,6 +5,7 @@ import com.muyu.enterprise.service.CarTemplateService;
import com.muyu.common.core.domain.Result;
import com.muyu.common.core.web.controller.BaseController;
import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -18,10 +19,12 @@ import java.util.List;
*/
@RestController
@RequestMapping("/carTemplate") // 报文模版
+/** 构造必备注解 只有用 final 修饰 才会被构造注入 */
+@RequiredArgsConstructor //制动构造注入 默认无参 Lombook包下
@Tag(name = "模版模块",description = "报文模版模块")
public class CarTemplateController extends BaseController {
- @Autowired
- private CarTemplateService sysCarTemplateService;
+
+ private final CarTemplateService sysCarTemplateService;
/**
* 查询所有模版信息
@@ -29,6 +32,7 @@ public class CarTemplateController extends BaseController {
*/
@PostMapping("selectTemplateShow")
public List selectTemplateShow(){
+ startPage();
return sysCarTemplateService.selectTemplateShow();
}
/**
diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/CarTypeController.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/CarTypeController.java
index 832b23b..aaf5004 100644
--- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/CarTypeController.java
+++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/CarTypeController.java
@@ -4,11 +4,14 @@ import com.muyu.common.core.domain.Result;
import com.muyu.enterprise.domain.CarType;
import com.muyu.enterprise.service.CarTypeService;
import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
+import static com.muyu.common.core.utils.PageUtils.startPage;
+
/**
* 车辆类型控制层
* @ClassName CarController
@@ -18,11 +21,12 @@ import java.util.List;
*/
@RestController
@RequestMapping("/carType")
+/** 构造必备注解 只有用 final 修饰 才会被构造注入 */
+@RequiredArgsConstructor //制动构造注入 默认无参 Lombook包下
@Tag(name = "CarTypeController",description = "车辆类型")
public class CarTypeController {
- @Autowired
- private CarTypeService carTypeService;
+ private final CarTypeService carTypeService;
/**
* 查询所有规则
@@ -30,6 +34,7 @@ public class CarTypeController {
*/
@GetMapping("/carTypeList")
private Result> carTypeList() {
+ startPage();
List carTypeList = carTypeService.list();
return Result.success(carTypeList);
}
diff --git a/cloud-modules/cloud-modules-enterprise/pom.xml b/cloud-modules/cloud-modules-enterprise/pom.xml
index c0d0b63..9ad1d7b 100644
--- a/cloud-modules/cloud-modules-enterprise/pom.xml
+++ b/cloud-modules/cloud-modules-enterprise/pom.xml
@@ -15,6 +15,7 @@
cloud-modules-enterprise-server
cloud-modules-enterprise-common
+ cloud-modules-enterprise-cache