# Conflicts:
#	cloud-common/pom.xml
#	cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/CloudEnterpriseApplication.java
#	cloud-modules/cloud-modules-event-process/src/main/resources/banner.txt
#	pom.xml
dev.entOperation
微醺 2024-10-06 09:22:15 +08:00
commit d896e9b26d
46 changed files with 786 additions and 449 deletions

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.muyu</groupId>
<artifactId>cloud-common</artifactId>
<version>3.6.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>cloud-common-cache</artifactId>
<description>
cloud-common-cache redis缓存架构
</description>
<dependencies>
<!-- redis 缓存模块 -->
<dependency>
<groupId>com.muyu</groupId>
<artifactId>cloud-common-redis</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,78 @@
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;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
public abstract class CacheAbsBasic<K,V> implements CacheBasic<K,V> {
@Autowired
private RedisService redisService;
@Override
public void put(K key, V value) {
redisService.setCacheObject(encode(key),value);
}
/**
*
* @param key
* @return
*/
@Override
public V getManage(K key) {
return redisService.getCacheObject(encode(key));
}
/**
*
* @param key
* @param value
*/
@Override
public void putManage(K key, V value) {
redisService.setCacheObject(encode(key),value);
}
/**
*
* @param key
* @return
*/
@Override
public V getFault(K key) {
return redisService.getCacheObject(encode(key));
}
/**
*
* @param key
* @param value
*/
@Override
public void putFault(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));
}
}

View File

@ -0,0 +1,51 @@
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<K,V> extends PrimaryKeyBasic<K>{
/**
*
* @param key
* @param value
*/
void putManage(K key,V value);
/**
*
* @param key
* @return
*/
V getFault(K key);
/**
*
* @param key
* @param value
*/
void putFault(K key,V value);
/**
*
* @param key
* @return
*/
V getManage(K key);
void put(K key,V value);
V get(K key);
void remove(K key);
}

View File

@ -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 <K>{
/**
* 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);
}

View File

@ -22,6 +22,7 @@
<module>cloud-common-xxl</module> <module>cloud-common-xxl</module>
<module>cloud-common-rabbit</module> <module>cloud-common-rabbit</module>
<module>cloud-common-kafka</module> <module>cloud-common-kafka</module>
<module>cloud-common-cache</module>
</modules> </modules>
<artifactId>cloud-common</artifactId> <artifactId>cloud-common</artifactId>

View File

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.muyu</groupId>
<artifactId>cloud-modules-enterprise</artifactId>
<version>3.6.3</version>
</parent>
<artifactId>cloud-modules-enterprise-cache</artifactId>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<description>
cloud-modules-enterprise-cache redis 缓存平台
</description>
<dependencies>
<dependency>
<groupId>com.muyu</groupId>
<artifactId>cloud-common-cache</artifactId>
</dependency>
<dependency>
<groupId>com.muyu</groupId>
<artifactId>cloud-modules-enterprise-common</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,29 @@
package com.muyu.enterprise.cache;
import com.muyu.common.cache.config.CacheAbsBasic;
import com.muyu.enterprise.domain.CarCompany;
import com.muyu.enterprise.domain.CarManage;
/**
* redis
* @ClassName CarCompanyCacheService
* @Description CarCompanyCacheService:
* @Date 2024/10/3 15:22
* @author MingWei.Zong
*/
public class CarCompanyCacheService extends CacheAbsBasic<String, CarCompany> {
@Override
public String keyPre() {
return "CarCompany:info:";
}
@Override
public String decode(String key) {
return key.replace("CarCompany:info:","");
}
}

View File

@ -0,0 +1,28 @@
package com.muyu.enterprise.cache;
import com.muyu.common.cache.config.CacheAbsBasic;
import com.muyu.enterprise.domain.CarCompany;
import com.muyu.enterprise.domain.FaultType;
/**
* redis
* @ClassName CarFaultCacheService
* @Description CarFaultCacheService:
* @Date 2024/10/3 15:22
* @author MingWei.Zong
*/
public class CarFaultCacheService extends CacheAbsBasic<String, FaultType> {
@Override
public String keyPre() {
return "faultType:info:";
}
@Override
public String decode(String key) {
return key.replace("faultType:info:","");
}
}

View File

@ -0,0 +1,28 @@
package com.muyu.enterprise.cache;
import com.muyu.common.cache.config.CacheAbsBasic;
import com.muyu.enterprise.domain.CarManage;
/**
* redis
* @ClassName CarManageCacheService
* @Description CarManageCacheService:
* @Date 2024/10/3 15:22
* @author MingWei.Zong
*/
public class CarManageCacheService extends CacheAbsBasic<String, CarManage> {
@Override
public String keyPre() {
return "carManage:info:";
}
@Override
public String decode(String key) {
return key.replace("carManage:info:","");
}
}

View File

@ -0,0 +1,32 @@
package com.muyu.enterprise.cache;
import com.muyu.common.cache.config.CacheAbsBasic;
import com.muyu.enterprise.domain.CarManage;
import com.muyu.enterprise.domain.CarMessage;
/**
* redis
* @ClassName CarMessageCacheService
* @Description CarMessageCacheService:
* @Date 2024/9/30 11:42
* @author MingWei.Zong
*/
public class CarMessageCacheService extends CacheAbsBasic<String, CarMessage> {
@Override
public String keyPre() {
return "carMessage:info:";
}
// @Override
// public String encode(String key) {
// return super.encode(key);
// }
@Override
public String decode(String key) {
return key.replace("carMessage:info:","");
}
}

View File

@ -0,0 +1,29 @@
package com.muyu.enterprise.cache;
import com.muyu.common.cache.config.CacheAbsBasic;
import com.muyu.enterprise.domain.CarCompany;
import com.muyu.enterprise.domain.CarTemplate;
/**
* redis
* @ClassName CarTemplateCacheService
* @Description CarTemplateCacheService:
* @Date 2024/10/3 15:22
* @author MingWei.Zong
*/
public class CarTemplateCacheService extends CacheAbsBasic<String, CarTemplate> {
@Override
public String keyPre() {
return "carTemplate:info:";
}
@Override
public String decode(String key) {
return key.replace("carTemplate:info:","");
}
}

View File

@ -0,0 +1,28 @@
package com.muyu.enterprise.cache;
import com.muyu.common.cache.config.CacheAbsBasic;
import com.muyu.enterprise.domain.CarCompany;
import com.muyu.enterprise.domain.WarnRule;
/**
* redis
* @ClassName CarWarnCacheService
* @Description CarWarnCacheService:
* @Date 2024/10/3 15:22
* @author MingWei.Zong
*/
public class CarWarnCacheService extends CacheAbsBasic<String, WarnRule> {
@Override
public String keyPre() {
return "warnRule:info:";
}
@Override
public String decode(String key) {
return key.replace("warnRule:info:","");
}
}

View File

@ -31,4 +31,5 @@ public class CarCompany {
* *
*/ */
private String companyName; private String companyName;
} }

View File

@ -29,20 +29,17 @@ public class CarConfig {
@TableId(value = "config_id",type = IdType.AUTO) @TableId(value = "config_id",type = IdType.AUTO)
private Long configId; private Long configId;
/** /**
* 1. 2. 3. *
*/ */
private String configName; private String configName;
/** /**
* * 1. 2. 3.
*/ */
private String energyType; private Integer energyType;
/** /**
* 1. 2. * 1. 2.
*/ */
private Integer gearType; private Integer gearType;
/**
* id
*/
private Integer companyId;
} }

View File

@ -73,7 +73,7 @@ public class CarManage {
/** /**
* 线 1. 2. 3. * 线 1. 2. 3.
*/ */
private Integer carStayus; private Integer carStatus;
/** /**
* *
*/ */
@ -90,7 +90,7 @@ public class CarManage {
/** /**
* *
*/ */
private String cardDrand; private String carBrand;
/** 最后一次连线时间 */ /** 最后一次连线时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ -106,9 +106,6 @@ public class CarManage {
* id * id
*/ */
private Long companyId; private Long companyId;
/**
* 1.轿 2. 3. 4. 5. 6.
*/
private Integer carType;
} }

View File

@ -19,42 +19,27 @@ public class CarDTO {
* VIN * VIN
*/ */
private String carVin; private String carVin;
/** /**
* *
*/ */
private String typeName; private Long companyId;
/** /**
* 1. 2. 3. *
*/ */
@TableField(exist = false) private Long configId;
private Integer energyType;
/**
* 1. 2.
*/
@TableField(exist = false)
private Integer gearType;
private Integer pageNum = 1;
private Integer pageSize = 3;
/** 最后一次连线时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date carLastJoinTime;
/** 最后一次离线时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date carLastOfflineTime;
/** /**
* 线 1. 2. 3. * 线 1. 2. 3.
*/ */
private Integer carStatus; private Integer carStatus;
/** /**
* *
*/ */
@TableField(exist = false) private String carModel;
private String companyName; /**
*
*/
private String carBrand;
} }

View File

@ -31,7 +31,7 @@ public class CarVO {
/** /**
* *
*/ */
private String carCoed; private String carCode;
/** /**
* 1. 2.绿 3. 4. 5. * 1. 2.绿 3. 4. 5.
*/ */
@ -47,7 +47,7 @@ public class CarVO {
/** /**
* *
*/ */
private Integer typeId; private Long configId;
/** /**
* *
*/ */
@ -96,14 +96,16 @@ public class CarVO {
/** 所属企业 */ /** 所属企业 */
private Long companyId; private Long companyId;
/** 车辆车型(如客车,卡车,公交车等) */
private String carType;
// /** 车辆车型(如客车,卡车,公交车等) */
// private String carType;
/** /**
* *
*/ */
@TableField(exist = false) @TableField(exist = false)
private String typeName; private String configName;
/** /**
* 1. 2. 3. * 1. 2. 3.

View File

@ -83,6 +83,12 @@
<artifactId>cloud-common-api-doc</artifactId> <artifactId>cloud-common-api-doc</artifactId>
</dependency> </dependency>
<!-- 企业缓存 -->
<dependency>
<groupId>com.muyu</groupId>
<artifactId>cloud-modules-enterprise-cache</artifactId>
</dependency>
<!-- 企业业务平台 - 公共依赖 --> <!-- 企业业务平台 - 公共依赖 -->
<dependency> <dependency>
<groupId>com.muyu</groupId> <groupId>com.muyu</groupId>

View File

@ -5,6 +5,7 @@ import com.muyu.enterprise.service.CarCompanyService;
import com.muyu.common.core.domain.Result; import com.muyu.common.core.domain.Result;
import com.muyu.common.core.web.controller.BaseController; import com.muyu.common.core.web.controller.BaseController;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -18,18 +19,20 @@ import java.util.List;
* @Date 2024/9/28 16:52 * @Date 2024/9/28 16:52
*/ */
@RestController @RestController
@RequestMapping("/company") @RequestMapping("/carCompany")
/** 构造必备注解 只有用 final 修饰 才会被构造注入 */
@RequiredArgsConstructor //制动构造注入 默认无参 Lombook包下
@Tag(name = "CarCompanyController", description = "企业表") @Tag(name = "CarCompanyController", description = "企业表")
public class CarCompanyController extends BaseController { public class CarCompanyController extends BaseController {
@Autowired private final CarCompanyService sysCarCompanyService;
private CarCompanyService sysCarCompanyService;
/** /**
* *
*/ */
@PostMapping("selectCompany") @PostMapping("selectCompany")
public Result<List<CarCompany>> selectCompany(){ public Result<List<CarCompany>> selectCompany(){
startPage();
return Result.success(sysCarCompanyService.list()); return Result.success(sysCarCompanyService.list());
} }
@ -38,7 +41,7 @@ public class CarCompanyController extends BaseController {
*/ */
@PostMapping("selectCompanyByCompanyId") @PostMapping("selectCompanyByCompanyId")
public Result<CarCompany> selectCompanyByCompanyId(@RequestParam("companyId") Long companyId){ public Result<CarCompany> selectCompanyByCompanyId(@RequestParam("companyId") Long companyId){
return Result.success(sysCarCompanyService.getById(companyId)); return Result.success(sysCarCompanyService.selectCompanyByCompanyId(companyId));
} }
} }

View File

@ -0,0 +1,47 @@
package com.muyu.enterprise.controller;
import com.muyu.common.core.domain.Result;
import com.muyu.common.core.web.controller.BaseController;
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;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* --
* @ClassName CarCompanyController
* @Description Controller
* @author MingWei.Zong
* @Date 2024/9/28 16:52
*/
@RestController
@RequestMapping("/carConfig")
/** 构造必备注解 只有用 final 修饰 才会被构造注入 */
@RequiredArgsConstructor //制动构造注入 默认无参 Lombook包下
@Tag(name = "CarConfigController", description = "车辆配置")
public class CarConfigController extends BaseController {
private final CarConfigService carConfigService;
/**
* configId
* @param configId
* @return
*/
@PostMapping("selectByConfigId")
public Result selectByConfigId(@RequestParam("configId") Long configId){
startPage();
return Result.success(carConfigService.selectByConfigId(configId));
}
}

View File

@ -3,6 +3,7 @@ package com.muyu.enterprise.controller;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.RandomUtil;
import com.muyu.common.core.utils.StringUtils; import com.muyu.common.core.utils.StringUtils;
import com.muyu.enterprise.cache.CarManageCacheService;
import com.muyu.enterprise.domain.CarManage; import com.muyu.enterprise.domain.CarManage;
import com.muyu.enterprise.domain.dto.CarDTO; import com.muyu.enterprise.domain.dto.CarDTO;
import com.muyu.enterprise.domain.vo.CarVO; 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 com.muyu.common.security.utils.SecurityUtils;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -28,22 +30,36 @@ import java.util.List;
*/ */
@RestController @RestController
@RequestMapping("/carManage") @RequestMapping("/carManage")
/** 构造必备注解 只有用 final 修饰 才会被构造注入 */
@RequiredArgsConstructor //制动构造注入 默认无参 Lombook包下
@Tag(name = "CarManageController", description = "车辆管理") @Tag(name = "CarManageController", description = "车辆管理")
public class CarManageController extends BaseController { public class CarManageController extends BaseController {
@Autowired private final CarManageCacheService carManageCacheService;
private CarCompanyService sysCarCompanyService;
@Autowired private final CarCompanyService sysCarCompanyService;
private CarManageService sysCarService;
private final CarManageService sysCarService;
/** /**
* 2 *
* @param carDTO * @param carDTO
* @return * @return
*/ */
@PostMapping("CarListShow") @PostMapping("/carListShow2")
public Result<List<CarManage>> CarListShow(@RequestBody CarDTO carDTO){ public Result<List<CarVO>> carListShow2(@RequestBody CarDTO carDTO){
startPage();
return Result.success(sysCarService.carListShow2(carDTO));
}
/**
*
* @param carDTO
* @return
*/
@PostMapping("/carListShow")
public Result<List<CarVO>> carListShow(@RequestBody CarDTO carDTO){
return Result.success(sysCarService.CarListShow(carDTO)); return Result.success(sysCarService.CarListShow(carDTO));
} }
@ -52,23 +68,11 @@ public class CarManageController extends BaseController {
* @param carId * @param carId
* @return * @return
*/ */
@PostMapping("CarManageShowByCarId") @PostMapping("carManageShowByCarId")
public Result CarManageShowByCarId(@RequestParam("carId") Long carId){ public Result carManageShowByCarId(@RequestParam("carId") Long carId){
return Result.success(sysCarService.getById(carId)); return Result.success(sysCarService.getById(carId));
} }
// /**
// * 车辆列表1
// * @param carVO
// * @return
// */
// @PostMapping("CarList")
// @Operation(summary = "查询列表",description = "车辆管理列表")
// public Result<TableDataInfo<CarManage>> CarList(@RequestBody CarVO carVO){
// startPage();
// return getDataTable(sysCarService.carList(carVO));
// }
/** /**
* *
@ -84,6 +88,8 @@ public class CarManageController extends BaseController {
String key2 = RandomUtil.randomNumbers(17); String key2 = RandomUtil.randomNumbers(17);
carVO.setCarVin(key2); carVO.setCarVin(key2);
sysCarService.save(carVO); sysCarService.save(carVO);
// 存到缓存中去
carManageCacheService.putManage(carVO.getCarVin(),new CarManage());
return Result.success("车辆添加成功"); return Result.success("车辆添加成功");
} }

View File

@ -3,9 +3,12 @@ package com.muyu.enterprise.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.muyu.common.core.domain.Result; import com.muyu.common.core.domain.Result;
import com.muyu.common.core.web.controller.BaseController; import com.muyu.common.core.web.controller.BaseController;
import com.muyu.enterprise.cache.CarManageCacheService;
import com.muyu.enterprise.cache.CarMessageCacheService;
import com.muyu.enterprise.domain.CarMessage; import com.muyu.enterprise.domain.CarMessage;
import com.muyu.enterprise.service.CarMessageService; import com.muyu.enterprise.service.CarMessageService;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -20,10 +23,13 @@ import java.util.List;
*/ */
@RestController @RestController
@RequestMapping("/carMessage") @RequestMapping("/carMessage")
/** 构造必备注解 只有用 final 修饰 才会被构造注入 */
@RequiredArgsConstructor //制动构造注入 默认无参 Lombook包下
@Tag(name = "报文",description = "报文模块") @Tag(name = "报文",description = "报文模块")
public class CarMessageController extends BaseController { public class CarMessageController extends BaseController {
@Autowired
private CarMessageService sysCarMessageService; private final CarMessageCacheService carMessageCacheService;
private final CarMessageService sysCarMessageService;
/** /**
* *
@ -31,6 +37,7 @@ public class CarMessageController extends BaseController {
*/ */
@PostMapping("selectMessageShow") @PostMapping("selectMessageShow")
public List<CarMessage> selectMessageShow(@RequestParam("templateId") Long templateId){ public List<CarMessage> selectMessageShow(@RequestParam("templateId") Long templateId){
startPage();
return sysCarMessageService.selectMessageShow(templateId); return sysCarMessageService.selectMessageShow(templateId);
} }
@ -41,8 +48,7 @@ public class CarMessageController extends BaseController {
*/ */
@GetMapping("/selectByTemplateId") @GetMapping("/selectByTemplateId")
private Result<List<CarMessage>> selectByTemplateId(@RequestParam("templateId") Integer templateId) { private Result<List<CarMessage>> selectByTemplateId(@RequestParam("templateId") Integer templateId) {
return Result.success(sysCarMessageService.list return Result.success(sysCarMessageService.list(new LambdaQueryWrapper<CarMessage>().eq(CarMessage::getTemplateId, templateId)));
(new LambdaQueryWrapper<CarMessage>().eq(CarMessage::getTemplateId, templateId)));
} }
/** /**
@ -61,6 +67,8 @@ public class CarMessageController extends BaseController {
@PostMapping("insertMessage") @PostMapping("insertMessage")
public Result insertMessage(@RequestBody CarMessage carMessage){ public Result insertMessage(@RequestBody CarMessage carMessage){
sysCarMessageService.save(carMessage); sysCarMessageService.save(carMessage);
//报文 redis
carMessageCacheService.put(carMessage.getMessageType(),new CarMessage());
return Result.success("添加成功"); return Result.success("添加成功");
} }
/** /**

View File

@ -7,6 +7,7 @@ import com.muyu.common.security.utils.SecurityUtils;
import com.muyu.enterprise.domain.CarMessageType; import com.muyu.enterprise.domain.CarMessageType;
import com.muyu.enterprise.service.CarMessageTypeService; import com.muyu.enterprise.service.CarMessageTypeService;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -20,11 +21,13 @@ import java.util.List;
* @Date 2024/9/28 16:52 * @Date 2024/9/28 16:52
*/ */
@RestController @RestController
@RequestMapping("carMessageType") @RequestMapping("/carMessageType")
/** 构造必备注解 只有用 final 修饰 才会被构造注入 */
@RequiredArgsConstructor //制动构造注入 默认无参 Lombook包下
@Tag(name = "报文类型" ,description = "报文类型") @Tag(name = "报文类型" ,description = "报文类型")
public class CarMessageTypeController extends BaseController { public class CarMessageTypeController extends BaseController {
@Autowired
private CarMessageTypeService sysCarMessageTypeService; private final CarMessageTypeService sysCarMessageTypeService;
/** /**
* *
@ -32,21 +35,18 @@ public class CarMessageTypeController extends BaseController {
*/ */
@PostMapping("messageTypeList") @PostMapping("messageTypeList")
public Result messageTypeList(){ public Result messageTypeList(){
sysCarMessageTypeService.messageTypeList(); startPage();
List<CarMessageType> list = sysCarMessageTypeService.list(); List<CarMessageType> list = sysCarMessageTypeService.list();
return Result.success(list); return Result.success(list);
} }
/**
*
* @param carMessageType
* @return
*/
@PostMapping("inserMessageType") @PostMapping("inserMessageType")
public Result inserMessageType(@RequestBody CarMessageType carMessageType){ public Result inserMessageType(@RequestBody CarMessageType carMessageType){
/** id 检验 */
if(carMessageType.getMessageTypeId()>0){
return Result.error("添加要什么id");
}
/** token 检验 */
if(SecurityUtils.getToken().isEmpty()){
return Result.error("token不为空");
}
/** 报文类型 */ /** 报文类型 */
if(StringUtils.isEmpty(carMessageType.getMessageType())){ if(StringUtils.isEmpty(carMessageType.getMessageType())){
return Result.error("报文类型不能为空"); return Result.error("报文类型不能为空");
@ -74,13 +74,21 @@ public class CarMessageTypeController extends BaseController {
*/ */
@PostMapping("updateMessageType") @PostMapping("updateMessageType")
public Result updateMessageType(@RequestBody CarMessageType carMessageType){ public Result updateMessageType(@RequestBody CarMessageType carMessageType){
/** id */ /** 报文类型 */
if(carMessageType.getMessageTypeId() < 0 ){ if(StringUtils.isEmpty(carMessageType.getMessageType())){
return Result.error("修改需要id"); return Result.error("报文类型不能为空");
} }
/** 报文编号 */ /** 报文 */
if(StringUtils.isEmpty(carMessageType.getMessageName())){
return Result.error("报文不能为空");
}
/** 报文编码 */
if(StringUtils.isEmpty(carMessageType.getMessageCode())){ if(StringUtils.isEmpty(carMessageType.getMessageCode())){
return Result.error(""); return Result.error("报文编码不能为空");
}
/** 报文字段类型 */
if(StringUtils.isEmpty(carMessageType.getMessageClass())){
return Result.error("报文字段类型不能为空");
} }
sysCarMessageTypeService.updateById(carMessageType); sysCarMessageTypeService.updateById(carMessageType);
return Result.success("修改成功"); return Result.success("修改成功");

View File

@ -5,6 +5,7 @@ import com.muyu.enterprise.service.CarTemplateService;
import com.muyu.common.core.domain.Result; import com.muyu.common.core.domain.Result;
import com.muyu.common.core.web.controller.BaseController; import com.muyu.common.core.web.controller.BaseController;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -18,10 +19,12 @@ import java.util.List;
*/ */
@RestController @RestController
@RequestMapping("/carTemplate") // 报文模版 @RequestMapping("/carTemplate") // 报文模版
/** 构造必备注解 只有用 final 修饰 才会被构造注入 */
@RequiredArgsConstructor //制动构造注入 默认无参 Lombook包下
@Tag(name = "模版模块",description = "报文模版模块") @Tag(name = "模版模块",description = "报文模版模块")
public class CarTemplateController extends BaseController { public class CarTemplateController extends BaseController {
@Autowired
private CarTemplateService sysCarTemplateService; private final CarTemplateService sysCarTemplateService;
/** /**
* *
@ -29,6 +32,7 @@ public class CarTemplateController extends BaseController {
*/ */
@PostMapping("selectTemplateShow") @PostMapping("selectTemplateShow")
public List<CarTemplate> selectTemplateShow(){ public List<CarTemplate> selectTemplateShow(){
startPage();
return sysCarTemplateService.selectTemplateShow(); return sysCarTemplateService.selectTemplateShow();
} }
/** /**

View File

@ -4,11 +4,14 @@ import com.muyu.common.core.domain.Result;
import com.muyu.enterprise.domain.CarType; import com.muyu.enterprise.domain.CarType;
import com.muyu.enterprise.service.CarTypeService; import com.muyu.enterprise.service.CarTypeService;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
import static com.muyu.common.core.utils.PageUtils.startPage;
/** /**
* *
* @ClassName CarController * @ClassName CarController
@ -18,11 +21,12 @@ import java.util.List;
*/ */
@RestController @RestController
@RequestMapping("/carType") @RequestMapping("/carType")
/** 构造必备注解 只有用 final 修饰 才会被构造注入 */
@RequiredArgsConstructor //制动构造注入 默认无参 Lombook包下
@Tag(name = "CarTypeController",description = "车辆类型") @Tag(name = "CarTypeController",description = "车辆类型")
public class CarTypeController { public class CarTypeController {
@Autowired private final CarTypeService carTypeService;
private CarTypeService carTypeService;
/** /**
* *
@ -30,6 +34,7 @@ public class CarTypeController {
*/ */
@GetMapping("/carTypeList") @GetMapping("/carTypeList")
private Result<List<CarType>> carTypeList() { private Result<List<CarType>> carTypeList() {
startPage();
List<CarType> carTypeList = carTypeService.list(); List<CarType> carTypeList = carTypeService.list();
return Result.success(carTypeList); return Result.success(carTypeList);
} }

View File

@ -1,6 +1,7 @@
package com.muyu.enterprise.controller; package com.muyu.enterprise.controller;
import com.muyu.common.core.domain.Result; import com.muyu.common.core.domain.Result;
import com.muyu.enterprise.cache.CarFaultCacheService;
import com.muyu.enterprise.domain.FaultType; import com.muyu.enterprise.domain.FaultType;
import com.muyu.enterprise.service.FaultTypeService; import com.muyu.enterprise.service.FaultTypeService;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
@ -19,6 +20,8 @@ import java.util.List;
@RequestMapping("/type") @RequestMapping("/type")
@Tag(name = "故障类型",description = "对故障类型的定义") @Tag(name = "故障类型",description = "对故障类型的定义")
public class FaultTypeController { public class FaultTypeController {
@Autowired
private CarFaultCacheService carFaultCacheService;
@Autowired @Autowired
private FaultTypeService faultTypeService; private FaultTypeService faultTypeService;

View File

@ -0,0 +1,22 @@
package com.muyu.enterprise.mapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.yulichang.base.MPJBaseMapper;
import com.muyu.enterprise.domain.CarConfig;
import com.muyu.enterprise.domain.CarManage;
import com.muyu.enterprise.domain.vo.CarVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* --
* @ClassName CarManageMapper
* @Description Mapper
* @author MingWei.Zong
* @Date 2024/9/28 16:52
*/
public interface CarConfigMapper extends MPJBaseMapper<CarConfig> {
}

View File

@ -2,9 +2,12 @@ package com.muyu.enterprise.mapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.github.yulichang.base.MPJBaseMapper;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.muyu.enterprise.domain.CarManage; import com.muyu.enterprise.domain.CarManage;
import com.muyu.enterprise.domain.dto.CarDTO; import com.muyu.enterprise.domain.dto.CarDTO;
import com.muyu.enterprise.domain.vo.CarVO; import com.muyu.enterprise.domain.vo.CarVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -16,26 +19,7 @@ import java.util.List;
* @author MingWei.Zong * @author MingWei.Zong
* @Date 2024/9/28 16:52 * @Date 2024/9/28 16:52
*/ */
@Mapper
public interface CarManageMapper extends MPJBaseMapper<CarManage> {
public interface CarManageMapper extends BaseMapper<CarManage> {
/**
*
* @param queryWrapper
* @return
*/
List<CarVO> carList(LambdaQueryWrapper<CarVO> queryWrapper);
/**
* 2
* @param carDTO
* @return
*/
List<CarVO> CarListShow(CarDTO carDTO);
/**
* id
* @param carId
* @return
*/
List<CarVO> CarListShowByCarId(@Param("carId") Long carId);
} }

View File

@ -14,10 +14,5 @@ import java.util.List;
*/ */
@Mapper @Mapper
public interface CarMessageMapper extends BaseMapper<CarMessage> { public interface CarMessageMapper extends BaseMapper<CarMessage> {
/**
*
* @param templateId
* @return
*/
List<CarMessage> selectMessageShow(Long templateId);
} }

View File

@ -14,9 +14,5 @@ import java.util.List;
*/ */
@Mapper @Mapper
public interface CarTemplateMapper extends BaseMapper<CarTemplate> { public interface CarTemplateMapper extends BaseMapper<CarTemplate> {
/**
*
* @return
*/
List<CarTemplate> selectTemplateShow();
} }

View File

@ -10,11 +10,13 @@ import com.muyu.enterprise.domain.CarCompany;
* @Date 2024/9/28 16:52 * @Date 2024/9/28 16:52
*/ */
public interface CarCompanyService extends IService<CarCompany> { public interface CarCompanyService extends IService<CarCompany> {
/** /**
* *
* @param companyId
* @return * @return
*/ */
//List<CarCompany> selectCompany(); CarCompany selectCompanyByCompanyId(Long companyId);
} }

View File

@ -0,0 +1,25 @@
package com.muyu.enterprise.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.enterprise.domain.CarConfig;
import com.muyu.enterprise.domain.CarManage;
import com.muyu.enterprise.domain.dto.CarDTO;
import com.muyu.enterprise.domain.vo.CarVO;
import java.util.List;
/**
* --
* @ClassName CarConfigService
* @Description Service
* @author MingWei.Zong
* @Date 2024/9/28 16:52
*/
public interface CarConfigService extends IService<CarConfig> {
/**
* configId
* @param configId
* @return
*/
CarConfig selectByConfigId(Long configId);
}

View File

@ -14,37 +14,22 @@ import java.util.List;
* @Date 2024/9/28 16:52 * @Date 2024/9/28 16:52
*/ */
public interface CarManageService extends IService<CarManage> { public interface CarManageService extends IService<CarManage> {
// /**
// * 车辆列表
// * @param carVO
// * @return
// */
// List<CarManage> carList(CarVO carVO);
//
// /**
// * 车辆添加
// * @param carVO
// */
// void insertCar(CarVO carVO);
//
// /**
// * 车辆删除
// * @param ids
// */
// void deleteCar(List<Long> ids);
//
//
/** /**
* 2 * 2
* @param carDTO * @param carDTO
* @return * @return
*/ */
List<CarManage> CarListShow(CarDTO carDTO); List<CarVO> carListShow2(CarDTO carDTO);
//
// /** /**
// * 通过id查询 *
// * @param carId * @param carDTO
// * @return * @return
// */ */
// List<CarVO> CarListShowByCarId(Long carId); List<CarVO> CarListShow(CarDTO carDTO);
} }

View File

@ -12,5 +12,5 @@ import java.util.List;
* @Date 2024/9/28 16:52 * @Date 2024/9/28 16:52
*/ */
public interface CarMessageTypeService extends IService<CarMessageType> { public interface CarMessageTypeService extends IService<CarMessageType> {
List<CarMessageType> messageTypeList();
} }

View File

@ -29,11 +29,17 @@ public class CarCompanyServiceImpl extends ServiceImpl<CarCompanyMapper, CarComp
@Autowired @Autowired
private RedisService redisService; private RedisService redisService;
@Autowired @Autowired
private CarCompanyMapper sysCarCompanyMapper; private CarCompanyMapper carCompanyMapper;
/**
*
* @param companyId
* @return
*/
@Override
public CarCompany selectCompanyByCompanyId(Long companyId) {
return carCompanyMapper.selectById(companyId);
}
// @Override
// public List<CarCompany> selectCompany() {
// return sysCarCompanyMapper.;
// }
} }

View File

@ -0,0 +1,45 @@
package com.muyu.enterprise.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.muyu.enterprise.domain.CarCompany;
import com.muyu.enterprise.domain.CarConfig;
import com.muyu.enterprise.domain.CarManage;
import com.muyu.enterprise.domain.dto.CarDTO;
import com.muyu.enterprise.domain.vo.CarVO;
import com.muyu.enterprise.mapper.CarConfigMapper;
import com.muyu.enterprise.mapper.CarManageMapper;
import com.muyu.enterprise.service.CarCompanyService;
import com.muyu.enterprise.service.CarConfigService;
import com.muyu.enterprise.service.CarManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* --
* @ClassName CarConfigServiceImpl
* @Description ServiceImpl
* @author MingWei.Zong
* @Date 2024/9/28 16:52
*/
@Service
public class CarConfigServiceImpl extends ServiceImpl<CarConfigMapper, CarConfig>
implements CarConfigService {
@Autowired
private CarConfigMapper carConfigMapper;
/**
* configId
* @param configId
* @return
*/
@Override
public CarConfig selectByConfigId(Long configId) {
CarConfig carConfig = carConfigMapper.selectById(configId);
return carConfig;
}
}

View File

@ -2,21 +2,25 @@ package com.muyu.enterprise.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.muyu.common.core.domain.Result; import com.muyu.common.core.domain.Result;
import com.muyu.common.core.utils.StringUtils; import com.muyu.common.core.utils.StringUtils;
import com.muyu.enterprise.controller.CarCompanyController; import com.muyu.enterprise.controller.CarCompanyController;
import com.muyu.enterprise.domain.CarCompany; import com.muyu.enterprise.domain.CarCompany;
import com.muyu.enterprise.domain.CarConfig;
import com.muyu.enterprise.domain.CarManage; import com.muyu.enterprise.domain.CarManage;
import com.muyu.enterprise.domain.dto.CarDTO; import com.muyu.enterprise.domain.dto.CarDTO;
import com.muyu.enterprise.domain.vo.CarVO; import com.muyu.enterprise.domain.vo.CarVO;
import com.muyu.enterprise.mapper.CarManageMapper; import com.muyu.enterprise.mapper.CarManageMapper;
import com.muyu.enterprise.service.CarCompanyService; import com.muyu.enterprise.service.CarCompanyService;
import com.muyu.enterprise.service.CarConfigService;
import com.muyu.enterprise.service.CarManageService; import com.muyu.enterprise.service.CarManageService;
import com.muyu.common.redis.service.RedisService; import com.muyu.common.redis.service.RedisService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
@ -30,122 +34,67 @@ import java.util.List;
public class CarManageServiceImpl extends ServiceImpl<CarManageMapper, CarManage> public class CarManageServiceImpl extends ServiceImpl<CarManageMapper, CarManage>
implements CarManageService { implements CarManageService {
// @Autowired @Autowired
// private RedisService redisService; private CarCompanyService carCompanyService;
// @Autowired @Autowired
// private CarManageMapper carMapper; private CarConfigService carConfigService;
// // 企业 service @Autowired
// @Autowired private CarManageMapper carManageMapper;
// private CarCompanyService carCompanyService;
// /**
// * 车辆列表
// * @param carVO
// * @return
// */
// @Override
// public List<CarVO> carList(CarVO carVO) {
//
//// MPJLambdaWrapper<CarVO> queryWrapper = new MPJLambdaWrapper<>();
//// carMapper.selectJoinList(CarVO.class,
//// queryWrapper.selectAll(CarVO.class)// 主表查询所有
//// .select(Type::getTypeName)// 获取附表的字段
//// .select(Type::getEnergyType)
//// .select(Type::getGearType)
//// .leftJoin(Type.class,Type::getTypeId,Car::getTypeId)// 左链接
//// );
//// // vin码--精确
//// if(StringUtils.isNotEmpty(carVO.getCarVin())){
//// queryWrapper.eq(CarVO::getCarVin,carVO.getCarVin());
//// }
//// // 车辆型号
//// if(StringUtils.isNotEmpty(carVO.getTypeName())){
//// queryWrapper.like(CarVO::getTypeName,carVO.getTypeName());
//// }
//// // 能源类型 1.电动 2.纯油 3.混动
//// if(carVO.getEnergyType()>0){
//// queryWrapper.eq(CarVO::getEnergyType,carVO.getEnergyType());
//// }
//// // 档的类型 1.手动 2.自动
//// if(carVO.getGearType()>0){
//// queryWrapper.eq(CarVO::getGearType,carVO.getGearType());
//// }
//// // 自定义列表查询
////// @Select("")
////// this.list(queryWrapper);
//// // mybatis列表查询
//// //return carMapper.carList(queryWrapper);
//// // 单表的列表查询
//// this.list(
//// new LambdaQueryWrapper<CarVO>()
//// .eq(StringUtils.isNotEmpty(carVO.getCarVin()),CarVO::getCarVin,carVO.getCarVin())
//// .eq(carVO.getEnergyType()>0,CarVO::getEnergyType,carVO.getEnergyType())
//// .eq(carVO.getGearType()>0,CarVO::getGearType,carVO.getGearType())
//// .like(StringUtils.isNotEmpty(carVO.getTypeName()),CarVO::getTypeName,carVO.getTypeName())
//// );
//// return this.list(queryWrapper);
// return null;
// }
//
// /**
// * 车辆添加
// * @param carVO
// */
// @Override
// public void insertCar(CarVO carVO) {
// carMapper.insert(carVO);
// }
//
//// /**
//// * 车辆修改
//// * @param carVO
//// */
//// @Override
//// public void updataCar(CarVO carVO) {
//// carMapper.updateById(carVO);
//// }
//
/** /**
* 2 * 2
* @param carDTO * @param carDTO
* @return * @return
*/ */
@Override @Override
public List<CarManage> CarListShow(CarDTO carDTO) { public List<CarVO> carListShow2(CarDTO carDTO) {
// 获取 企业 // 获取 企业
// CarCompanyController carCompanyController = new CarCompanyController();
CarManage carManage = BeanUtil.copyProperties(carDTO, CarManage.class); CarManage carManage = BeanUtil.copyProperties(carDTO, CarManage.class);
return lambdaQuery() List<CarManage> list = lambdaQuery()
.eq(StringUtils.isNotEmpty(carManage.getCarVin()), CarManage::getCarVin, carManage.getCarVin()) .eq(carManage.getCarVin() != null && carManage.getCarVin() != "", CarManage::getCarVin, carManage.getCarVin())
.eq(carManage.getConfigId() > 0, CarManage::getCarVin, carManage.getConfigId()) .eq(carManage.getCarModel() != null && carManage.getCarModel() != "", CarManage::getCarModel, carManage.getCarModel())
.eq(carManage.getCarBrand() != null && carManage.getCarBrand() != "", CarManage::getCarBrand, carManage.getCarBrand())
.eq(carManage.getCarStatus() != null && carManage.getCarStatus() > 0, CarManage::getCarStatus, carManage.getCarStatus())
.eq(carManage.getCompanyId() != null && carManage.getCompanyId() > 0, CarManage::getCompanyId, carManage.getCompanyId())
.list(); .list();
// list.forEach(carManage1 -> { // List<CarManage> list = list();
// // 获取 企业 id
// carCompanyController.selectCompanyByCompanyId(carManage1.getCompanyId()); // 把 查询出来的车辆数据 copy 到 CarVO
// }); List<CarVO> carVOS = BeanUtil.copyToList(list, CarVO.class);
// // 遍历赋值
// List<CarCompany> data = carCompanyController.selectCompany().getData(); carVOS.forEach(carVO -> {
// getById() // 查询出对象,用于赋值
CarConfig carConfig = carConfigService.selectByConfigId(carVO.getConfigId());
carVO.setConfigName(carConfig.getConfigName());
carVO.setEnergyType(carConfig.getEnergyType());
carVO.setGearType(carConfig.getGearType());
// 查询出对象,用于赋值
CarCompany carCompany = carCompanyService.selectCompanyByCompanyId(carVO.getCompanyId());
carVO.setCompanyName(carCompany.getCompanyName());
});
return carVOS;
}
@Override
public List<CarVO> CarListShow(CarDTO carDTO) {
// 获取 企业
CarManage carManage = BeanUtil.copyProperties(carDTO, CarManage.class);
return carManageMapper.selectJoinList(CarVO.class, new MPJLambdaWrapper<CarManage>()
.selectAll(CarManage.class) // 查询所有车辆表
.select(CarCompany::getCompanyName)
.select(CarConfig::getConfigName)
.select(CarConfig::getGearType)
.select(CarConfig::getEnergyType)
.leftJoin(CarConfig.class, CarConfig::getConfigId, CarManage::getConfigId)
.leftJoin(CarCompany.class, CarCompany::getCompanyId, CarManage::getCompanyId)
.eq(carManage.getCarVin() != null && carManage.getCarVin() != "", CarManage::getCarVin, carManage.getCarVin())
.eq(carManage.getCarModel() != null && carManage.getCarModel() != "", CarManage::getCarModel, carManage.getCarModel())
.eq(carManage.getCarBrand() != null && carManage.getCarBrand() != "", CarManage::getCarBrand, carManage.getCarBrand())
.eq(carManage.getCarStatus() != null && carManage.getCarStatus() > 0, CarManage::getCarStatus, carManage.getCarStatus())
.eq(carManage.getCompanyId() != null && carManage.getCompanyId() > 0, CarManage::getCompanyId, carManage.getCompanyId())
);
} }
//
// /**
// * 通过id查询
// * @param carId
// * @return
// */
// @Override
// public CarManage CarListShowByCarId(Long carId) {
// return carMapper.CarListShowByCarId(carId);
// }
//
//
// /**
// * 车辆删除
// * @param ids
// */
// @Override
// public void deleteCar(List<Long> ids) {
// carMapper.deleteBatchIds(ids);
// }
} }

View File

@ -1,5 +1,6 @@
package com.muyu.enterprise.service.impl; package com.muyu.enterprise.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.enterprise.domain.CarMessage; import com.muyu.enterprise.domain.CarMessage;
import com.muyu.enterprise.mapper.CarMessageMapper; import com.muyu.enterprise.mapper.CarMessageMapper;
@ -7,6 +8,7 @@ import com.muyu.enterprise.service.CarMessageService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List; import java.util.List;
/** /**
* -- * --
@ -27,7 +29,8 @@ public class CarMessageServiceImpl extends ServiceImpl<CarMessageMapper, CarMess
*/ */
@Override @Override
public List<CarMessage> selectMessageShow(Long templateId) { public List<CarMessage> selectMessageShow(Long templateId) {
return sysCarMessageMapper.selectMessageShow(templateId); return list(new LambdaQueryWrapper<CarMessage>()
.eq(CarMessage::getTemplateId,templateId));
} }
/** /**

View File

@ -18,8 +18,5 @@ import java.util.List;
@Service @Service
public class CarMessageTypeServiceImpl extends ServiceImpl<CarMessageTypeMapper, CarMessageType> implements CarMessageTypeService { public class CarMessageTypeServiceImpl extends ServiceImpl<CarMessageTypeMapper, CarMessageType> implements CarMessageTypeService {
@Override
public List<CarMessageType> messageTypeList() {
return null;
}
} }

View File

@ -26,7 +26,7 @@ public class CarTemplateServiceImpl extends ServiceImpl<CarTemplateMapper, CarTe
*/ */
@Override @Override
public List<CarTemplate> selectTemplateShow() { public List<CarTemplate> selectTemplateShow() {
return sysCarTemplateMapper.selectTemplateShow(); return list();
} }
/** /**

View File

@ -4,75 +4,5 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.muyu.enterprise.mapper.CarManageMapper"> <mapper namespace="com.muyu.enterprise.mapper.CarManageMapper">
<!-- 车辆列表 -->
<select id="carList" resultType="com.muyu.enterprise.domain.vo.CarVO">
SELECT
cman.*,
cc.config_name,
cc.energy_type,
cc.gear_type
FROM
`car_manage` cman
LEFT JOIN `car_config` cc ON cman.config_id = cc.config_id
<where>
<if test="carVin != null and carVin != ''">
and cman.car_vin = #{carVin}
</if>
<if test="typeName != null and typeName != ''">
and cc.config_name like concat('%',#{typeName},'%')
</if>
<if test="energyType != null and energyType > 0 ">
and cc.energy_type = #{energyType}
</if>
<if test="gearType != null and gearType > 0 ">
and cc.gear_type = #{gearType}
</if>
</where>
</select>
<select id="CarListShow" resultType="com.muyu.enterprise.domain.vo.CarVO">
SELECT
tc.*,
tt.energy_type,
tt.gear_type,
tt.type_name
FROM
`t_car` tc
LEFT JOIN `t_type` tt ON tc.type_id = tt.type_id
<where>
<if test="carVin != null and carVin != ''">
and tc.car_vin = #{carVin}
</if>
<if test="carLastJoinTime != null and carLastJoinTime != ''">
and tc.car_last_join_time = #{carLastJoinTime}
</if>
<if test="carLastOfflineTime != null and carLastOfflineTime != ''">
and tc.car_last_offline_time = #{carVin}
</if>
<if test="typeName != null and typeName != ''">
and tt.type_name like concat('%',#{typeName},'%')
</if>
<if test="energyType != null and energyType > 0 ">
and tt.energy_type = #{energyType}
</if>
<if test="gearType != null and gearType > 0 ">
and tt.gear_type = #{gearType}
</if>
</where>
</select>
<!-- 通过id查询 -->
<select id="CarListShowByCarId" resultType="com.muyu.enterprise.domain.vo.CarVO">
SELECT
tc.*,
tt.energy_type,
tt.gear_type,
tt.type_name
FROM
`t_car` tc
LEFT JOIN `t_type` tt ON tc.type_id = tt.type_id
where tc.car_id = #{carId}
</select>
</mapper> </mapper>

View File

@ -4,17 +4,4 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.muyu.enterprise.mapper.CarMessageMapper"> <mapper namespace="com.muyu.enterprise.mapper.CarMessageMapper">
<!-- 查询所有报文信息 -->
<!-- 查询所有报文信息 -->
<select id="selectMessageShow" resultType="com.muyu.enterprise.domain.CarMessage">
SELECT
tcm.*
FROM
`t_car_message` tcm
WHERE
tcm.template_id = #{templateId}
</select>
</mapper> </mapper>

View File

@ -4,10 +4,4 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.muyu.enterprise.mapper.CarTemplateMapper"> <mapper namespace="com.muyu.enterprise.mapper.CarTemplateMapper">
<!-- 查询所有报文信息 -->
<select id="selectTemplateShow" resultType="com.muyu.enterprise.domain.CarTemplate">
select * from `t_template`
</select>
</mapper> </mapper>

View File

@ -15,6 +15,7 @@
<modules> <modules>
<module>cloud-modules-enterprise-server</module> <module>cloud-modules-enterprise-server</module>
<module>cloud-modules-enterprise-common</module> <module>cloud-modules-enterprise-common</module>
<module>cloud-modules-enterprise-cache</module>
</modules> </modules>
<description> <description>

91
pom.xml
View File

@ -43,16 +43,6 @@
<knife4j-openapi3.version>4.1.0</knife4j-openapi3.version> <knife4j-openapi3.version>4.1.0</knife4j-openapi3.version>
<xxl-job-core.version>2.4.1</xxl-job-core.version> <xxl-job-core.version>2.4.1</xxl-job-core.version>
<swagger.an.jakarta.verison>2.2.8</swagger.an.jakarta.verison> <swagger.an.jakarta.verison>2.2.8</swagger.an.jakarta.verison>
<ecs20140526.version>5.1.8</ecs20140526.version>
<tea-openapi.version>0.3.2</tea-openapi.version>
<tea-console.version>0.0.1</tea-console.version>
<tea-util.version>0.2.21</tea-util.version>
<cloudapi20160714.version>3.10.1</cloudapi20160714.version>
<kafka.clients.verison>3.0.0</kafka.clients.verison>
<iotdb.session.verison>1.3.1</iotdb.session.verison>
<mybatis.plus.join.version>1.4.13</mybatis.plus.join.version>
<org.eclipse.paho.client.mqttv3.version>1.2.5</org.eclipse.paho.client.mqttv3.version>
<caffeine.version>3.1.8</caffeine.version>
</properties> </properties>
<!-- 依赖声明 --> <!-- 依赖声明 -->
@ -200,76 +190,6 @@
<version>${swagger.an.jakarta.verison}</version> <version>${swagger.an.jakarta.verison}</version>
</dependency> </dependency>
<!-- MyBatisPlusJoin 依赖包 -->
<dependency>
<groupId>com.github.yulichang</groupId>
<artifactId>mybatis-plus-join</artifactId>
<version>1.4.13</version>
</dependency>
<!-- kafka客户端 -->
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>${kafka.clients.verison}</version>
</dependency>
<!-- IotDB会话 -->
<dependency>
<groupId>org.apache.iotdb</groupId>
<artifactId>iotdb-session</artifactId>
<version>${iotdb.session.verison}</version>
</dependency>
<!-- 阿里云创建ecs实例 -->
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>ecs20140526</artifactId>
<version>${ecs20140526.version}</version>
</dependency>
<!-- 阿里云创建ecs实例 -->
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>tea-openapi</artifactId>
<version>${tea-openapi.version}</version>
</dependency>
<!-- 阿里云创建ecs实例 -->
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>tea-console</artifactId>
<version>${tea-console.version}</version>
</dependency>
<!-- 阿里云创建ecs实例 -->
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>tea-util</artifactId>
<version>${tea-util.version}</version>
</dependency>
<!-- 阿里云创建ecs实例 -->
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>cloudapi20160714</artifactId>
<version>${cloudapi20160714.version}</version>
</dependency>
<!-- Mqtt3包 -->
<dependency>
<groupId>org.eclipse.paho</groupId>
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
<version>${org.eclipse.paho.client.mqttv3.version}</version>
</dependency>
<!-- Caffeine本地缓存 -->
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
<version>${caffeine.version}</version>
</dependency>
<!-- 核心模块 --> <!-- 核心模块 -->
<dependency> <dependency>
<groupId>com.muyu</groupId> <groupId>com.muyu</groupId>
@ -361,10 +281,17 @@
<version>${muyu.version}</version> <version>${muyu.version}</version>
</dependency> </dependency>
<!-- kafka模块--> <!-- 公共缓存模块 -->
<dependency> <dependency>
<groupId>com.muyu</groupId> <groupId>com.muyu</groupId>
<artifactId>cloud-common-kafka</artifactId> <artifactId>cloud-common-cache</artifactId>
<version>${muyu.version}</version>
</dependency>
<!-- 企业缓存模块 -->
<dependency>
<groupId>com.muyu</groupId>
<artifactId>cloud-modules-enterprise-cache</artifactId>
<version>${muyu.version}</version> <version>${muyu.version}</version>
</dependency> </dependency>