diff --git a/cloud-common/cloud-common-core/src/main/java/com/muyu/common/core/utils/StringUtils.java b/cloud-common/cloud-common-core/src/main/java/com/muyu/common/core/utils/StringUtils.java index ec8f557..1298353 100644 --- a/cloud-common/cloud-common-core/src/main/java/com/muyu/common/core/utils/StringUtils.java +++ b/cloud-common/cloud-common-core/src/main/java/com/muyu/common/core/utils/StringUtils.java @@ -501,4 +501,5 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils { } return sb.toString(); } + } diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/CarInformation.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/CarInformation.java index 007d651..5369142 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/CarInformation.java +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/CarInformation.java @@ -5,14 +5,20 @@ import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; +import com.muyu.common.core.web.domain.BaseEntity; +import com.muyu.domain.req.CarInformationAddReq; +import com.muyu.domain.req.CarInformationUpdReq; +import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; import org.springframework.format.annotation.DateTimeFormat; import java.util.Date; +import java.util.function.Supplier; /** * 企业车辆管理实体类 @@ -25,16 +31,16 @@ import java.util.Date; @Data @AllArgsConstructor @NoArgsConstructor -@Builder +@SuperBuilder @Tag(name = "企业车辆管理实体类") @TableName(value = "car_information",autoResultMap = true) -public class CarInformation { +public class CarInformation extends BaseEntity { /** * 车辆ID */ @TableId(value = "car_information_id",type = IdType.AUTO) - private Integer carInformationId; + private Long carInformationId; /** * 车辆唯一VIN */ @@ -56,7 +62,8 @@ public class CarInformation { /** * 车辆电子围栏外键ID */ - private String carInformationFence; + @Schema(title = "车辆电子围栏外键ID", type = "Integer") + private Integer carInformationFence; /** * 车检到期日期 */ @@ -66,6 +73,7 @@ public class CarInformation { /** * 车辆类型外键ID */ + @Schema(title = "车辆类型外键ID", type = "Integer") private Integer carInformationType; /** * 车辆品牌外键ID @@ -107,4 +115,38 @@ public class CarInformation { .carInformationLicensePlate(carInformation.getCarInformationLicensePlate()) .build(); } + + public static CarInformation carInformationUpdBuilder(CarInformationUpdReq carInformation, Supplier idSupplier) { + return CarInformation.builder() + .carInformationId(idSupplier.get()) + .carInformationBrand(carInformation.getCarInformationBrand()) + .carInformationColor(carInformation.getCarInformationColor()) + .carInformationDriver(carInformation.getCarInformationDriver()) + .carInformationMotorManufacturer(carInformation.getCarInformationMotorManufacturer()) + .carInformationMotorModel(carInformation.getCarInformationMotorModel()) + .carInformationBatteryManufacturer(carInformation.getCarInformationBatteryManufacturer()) + .carInformationBatteryModel(carInformation.getCarInformationBatteryModel()) + .carInformationFence(carInformation.getCarInformationFence()) + .carInformationType(carInformation.getCarInformationType()) + .carInformationFocus(carInformation.getCarInformationFocus()) + .carInformationMotorModel(carInformation.getCarInformationMotorModel()) + .build(); + } + + public static CarInformation carInformationAddBuilder(CarInformationAddReq carInformation) { + return CarInformation.builder() + .carInformationVin(carInformation.getCarInformationVin()) + .carInformationLicensePlate(carInformation.getCarInformationLicensePlate()) + .carInformationBrand(carInformation.getCarInformationBrand()) + .carInformationColor(carInformation.getCarInformationColor()) + .carInformationDriver(carInformation.getCarInformationDriver()) + .carInformationMotorManufacturer(carInformation.getCarInformationMotorManufacturer()) + .carInformationMotorModel(carInformation.getCarInformationMotorModel()) + .carInformationBatteryManufacturer(carInformation.getCarInformationBatteryManufacturer()) + .carInformationBatteryModel(carInformation.getCarInformationBatteryModel()) + .carInformationFence(carInformation.getCarInformationFence()) + .carInformationType(carInformation.getCarInformationType()) + .carInformationMotorModel(carInformation.getCarInformationMotorModel()) + .build(); + } } diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/CarMessage.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/CarMessage.java index caba776..93d6336 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/CarMessage.java +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/CarMessage.java @@ -1,20 +1,24 @@ package com.muyu.domain; import com.baomidou.mybatisplus.annotation.TableName; +import com.muyu.common.core.web.domain.BaseEntity; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import lombok.experimental.SuperBuilder; +import java.util.function.Supplier; + /** * 车辆报文模板实体类 + * @author 17353 */ @Data @AllArgsConstructor @NoArgsConstructor @SuperBuilder @TableName(value = "车辆报文模板实体类",autoResultMap = true) -public class CarMessage { +public class CarMessage extends BaseEntity { //报文类型模块表 /** * 自增主键 @@ -41,7 +45,7 @@ public class CarMessage { /** * 车辆类型外键 */ - private Integer carMessageCartype; + private Integer carMessageCarType; /** * 车辆报文类型外键 */ @@ -63,6 +67,48 @@ public class CarMessage { */ private Integer carMessageState; + /** + * 修改方法 + * @param carMessage + * @param supplier + * @return + */ + public static CarMessage carMessageUpdBuilder(CarMessage carMessage, Supplier supplier) { + return CarMessage.builder() + .messageTypeId(supplier.get()) + .messageTypeCode(carMessage.messageTypeCode) + .messageTypeName(carMessage.messageTypeName) + .messageTypeBelongs(carMessage.messageTypeBelongs) + .carMessageId(carMessage.carMessageId) + .carMessageCarType(carMessage.carMessageCarType) + .carMessageType(carMessage.carMessageType) + .carMessageStartIndex(carMessage.carMessageStartIndex) + .carMessageEndIndex(carMessage.carMessageEndIndex) + .messageTypeClass(carMessage.messageTypeClass) + .carMessageState(carMessage.carMessageState) + .build(); + } + + /** + * 添加方法 + * @param carMessage + * @return + */ + public static CarMessage carMessageAddBuilder(CarMessage carMessage) { + return CarMessage.builder() + .messageTypeCode(carMessage.messageTypeCode) + .messageTypeName(carMessage.messageTypeName) + .messageTypeBelongs(carMessage.messageTypeBelongs) + .carMessageId(carMessage.carMessageId) + .carMessageCarType(carMessage.carMessageCarType) + .carMessageType(carMessage.carMessageType) + .carMessageStartIndex(carMessage.carMessageStartIndex) + .carMessageEndIndex(carMessage.carMessageEndIndex) + .messageTypeClass(carMessage.messageTypeClass) + .carMessageState(carMessage.carMessageState) + .build(); + } + /* diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/CarMiddle.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/CarMiddle.java index 014eb6d..cee9e88 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/CarMiddle.java +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/CarMiddle.java @@ -37,9 +37,9 @@ public class CarMiddle { /** * 车辆ID */ - private Integer carInformationId; + private Long carInformationId; - public CarMiddle(Integer fenceGroupId, Integer carInformationId) { + public CarMiddle(Integer fenceGroupId, Long carInformationId) { this.fenceGroupId = fenceGroupId; this.carInformationId = carInformationId; } diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/FaultLog.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/FaultLog.java index e9dc9c4..c541035 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/FaultLog.java +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/FaultLog.java @@ -47,6 +47,15 @@ public class FaultLog { * 车辆VIN */ private String carVin; + + /** + * 故障码 + */ + private String faultcodeNumber; + /** + * 车辆VIN + */ + private String carInformationVin; /** * 开始报警时间 */ diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/req/CarInformationAddReq.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/req/CarInformationAddReq.java index ac596f9..5f4f200 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/req/CarInformationAddReq.java +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/req/CarInformationAddReq.java @@ -21,7 +21,7 @@ public class CarInformationAddReq { /** * 车辆唯一VIN */ - private String carInformationVIN; + private String carInformationVin; /** * 车牌号 @@ -31,7 +31,7 @@ public class CarInformationAddReq { /** * 车辆品牌 */ - private String carInformationBrand; + private Integer carInformationBrand; /** * 车辆颜色 diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/req/CarInformationUpdReq.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/req/CarInformationUpdReq.java index 6b1324d..c2629bc 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/req/CarInformationUpdReq.java +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/req/CarInformationUpdReq.java @@ -26,8 +26,8 @@ public class CarInformationUpdReq { /** * 车辆品牌 */ - @Schema(title = "车辆品牌", type = "String") - private String carInformationBrand; + @Schema(title = "车辆品牌", type = "Integer") + private Integer carInformationBrand; /** * 车辆颜色 diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/resp/CarInformationResp.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/resp/CarInformationResp.java index 8ece634..fddcef3 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/resp/CarInformationResp.java +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/resp/CarInformationResp.java @@ -32,7 +32,7 @@ public class CarInformationResp { * 车辆ID */ @TableId(value = "car_information_id",type = IdType.AUTO) - private Integer carInformationId; + private Long carInformationId; /** * 车辆唯一VIN */ diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/resp/FaultLogListResp.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/resp/FaultLogListResp.java index 0b2b0c6..8d1b61f 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/resp/FaultLogListResp.java +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/domain/resp/FaultLogListResp.java @@ -77,7 +77,7 @@ public class FaultLogListResp { .startwarningTime(faultLog.getStartwarningTime()) .endwarningTime(faultLog.getEndwarningTime()) .faultcodeNumber(faultLog.getFaultcodeNumber()) - .carInformationVIN(faultLog.getCarInformationVIN()) + .carInformationVIN(faultLog.getCarInformationVin()) .build(); } } diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/server/controller/CarInformationController.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/server/controller/CarInformationController.java index 9dabadb..a40ac1f 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/server/controller/CarInformationController.java +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/server/controller/CarInformationController.java @@ -1,5 +1,6 @@ package com.muyu.server.controller; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.github.pagehelper.PageInfo; import com.muyu.common.core.domain.Result; @@ -48,8 +49,8 @@ public class CarInformationController { */ @PostMapping("/selectCarInformationList") @Operation(summary = "企业车辆管理列表") - public Result> selectCarInformationList(@Validated @RequestBody CarInformationListReq carInformationListReq) { - PageInfo pageInfo = carInformationService.selectCarInformationList(carInformationListReq); + public Result> selectCarInformationList(@Validated @RequestBody CarInformationListReq carInformationListReq) { + Page pageInfo = carInformationService.selectCarInformationList(carInformationListReq); log.info("企业车辆管理列表查询",carInformationListReq,pageInfo); return Result.success(pageInfo); @@ -64,7 +65,9 @@ public class CarInformationController { @PostMapping("/addCarInformation") @Operation(summary = "企业车辆添加管理") public Result addCarInformation(@Validated @RequestBody CarInformationAddReq carInformationAddReq){ - return carInformationService.addCarInformation(carInformationAddReq); + return carInformationService.addCarInformation(carInformationAddReq) + ?Result.success("添加车辆成功") + :Result.error(402,"添加车辆失败"); } /** @@ -75,7 +78,11 @@ public class CarInformationController { @GetMapping("/delBycarInformationId/{carInformationId}") @Operation(summary = "企业车辆删除") public Result delBycarInformationId(@Validated @PathVariable("carInformationId") Integer carInformationId){ - return carInformationService.delBycarInformationId(carInformationId); + boolean delBycarInformationId = carInformationService.delBycarInformationId(carInformationId); + if (delBycarInformationId){ + return Result.success(delBycarInformationId ,"删除车辆成功"); + } + return Result.error(402,"删除车辆失败"); } @@ -87,12 +94,14 @@ public class CarInformationController { @PostMapping("/updatecarInformation") @Operation(summary = "企业车辆修改管理") public Result updateCarMessage(@Validated @RequestBody CarInformationUpdReq carInformationUpdReq){ - Result updatecarInformation = carInformationService.updatecarInformation(carInformationUpdReq); + boolean updatecarInformation = carInformationService.updatecarInformation(carInformationUpdReq); log.info(updatecarInformation); System.out.println("我在这个里:"+updatecarInformation); - - return Result.success(updatecarInformation,"修改成功"); - + if(updatecarInformation) + { + return Result.success(carInformationUpdReq,"修改成功"); + } + return Result.error( 402,"修改失败"); } diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/server/controller/CarMessageController.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/server/controller/CarMessageController.java index 0bca82d..0ad206b 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/server/controller/CarMessageController.java +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/server/controller/CarMessageController.java @@ -44,9 +44,12 @@ public class CarMessageController { */ @PostMapping("/insertCarMessage") @Operation(summary = "添加报文信息") - public Result insertCarMessage(@Validated @RequestBody CarMessage carMessage){ - Result carMessage1 = carMessageService.insertCarMessage(carMessage); - return Result.success(carMessage1); + public Result insertCarMessage(@Validated @RequestBody CarMessage carMessage){ + boolean inserted = carMessageService.insertCarMessage(carMessage); + if (inserted){ + return Result.success(200,"添加成功"); + } + return Result.error(402,"添加失败"); } /** @@ -55,9 +58,12 @@ public class CarMessageController { */ @PostMapping("/delectByCarMessageId") @Operation(summary = "删除报文信息") - public Result delectByCarMessageId(Integer carMessageId){ - Result carMessage1 = carMessageService.delectByCarMessageId(carMessageId); - return Result.success(carMessage1); + public Result delectByCarMessageId(Integer carMessageId){ + boolean deleteByCarMessageId = carMessageService.delectByCarMessageId(carMessageId); + if (deleteByCarMessageId){ + return Result.success(200,"删除成功"); + } + return Result.error(402,"删除失败"); } /** @@ -65,9 +71,13 @@ public class CarMessageController { */ @PostMapping("/updateCarMessage") @Operation(summary = "修改报文信息") - public Result updateCarMessage(@Validated @RequestBody CarMessage carMessage){ - Result updateCarMessage = carMessageService.updateCarMessage(carMessage); - return Result.success(updateCarMessage,"修改成功"); + public Result updateCarMessage(@Validated @RequestBody CarMessage carMessage){ + boolean updateCarMessage = carMessageService.updateCarMessage(carMessage); + if(updateCarMessage) + { + return Result.success(200,"修改成功"); + } + return Result.error( 402,"修改失败"); } diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/server/mapper/CarInformationMapper.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/server/mapper/CarInformationMapper.java index bfc379c..1e08ebc 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/server/mapper/CarInformationMapper.java +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/server/mapper/CarInformationMapper.java @@ -2,6 +2,7 @@ package com.muyu.server.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.github.yulichang.base.MPJBaseMapper; import com.muyu.domain.CarInformation; import com.muyu.domain.req.CarInformationAddReq; import com.muyu.domain.req.CarInformationListReq; @@ -15,57 +16,6 @@ import java.util.List; * 车辆信息管理持久层 */ @Mapper -public interface CarInformationMapper extends BaseMapper { -/** - * 企业车辆管理列表 - * 联查--> 车辆管理--车辆类型表--车辆电子围栏 - * 搜索-->(车辆唯一VIN carInformationVIN 精确查 - * 车辆类型ID carTypeId 精确查 - * 车辆电子围栏外键ID carInformationFence 精确查 - * 启用状态(1.在线 2.离线 3.已断开 4.待连接 5.维修中) - * carInformationState 精确查 - * 车辆电机厂商 carInformationMotorManufacturer 模糊查 - * 车辆电机型号 carInformationMotorModel 精确查 - * 车辆电池厂商 carInformationBatteryManufacturer 模糊查 - * 车辆电池型号 carInformationBatteryModel 精确查 - * ) - * 分页--> 分页页数 pageNum 分页条数 pageSize - * @param carInformationListReq - * @return - */ - List selectCarInformationList(CarInformationListReq carInformationListReq); - -/** - * 企业车辆添加管理 - * @param carInformationAddReq - * @return - */ - Integer addCarInformation(CarInformationAddReq carInformationAddReq); - -/** - * 企业车辆删除 - * @param carInformationId - * @return - */ - Integer delBycarInformationId(Integer carInformationId); - - -/** - * 企业车辆修改管理 - * @param carInformationUpdReq - * @return - */ - Integer updatecarInformation(CarInformationUpdReq carInformationUpdReq); - -/** - * To 电子围栏负责人 - * 查询企业车辆 carInformationID 和 carInformationLicensePlate - * 无参 - * @return - */ - List selectBycarInformationIDAndLicensePlate(); - - - +public interface CarInformationMapper extends MPJBaseMapper { } diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/server/mapper/CarMessageMapper.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/server/mapper/CarMessageMapper.java index 7120a50..60e1b95 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/server/mapper/CarMessageMapper.java +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/server/mapper/CarMessageMapper.java @@ -11,28 +11,5 @@ import java.util.List; */ @Mapper public interface CarMessageMapper extends MPJBaseMapper { - /** - * 根据所属车类别 解析 车辆报文模板 - * @param - * @return - */ - List selectCarMessageList(); - - - /** - * 添加车辆报文规则 - */ - Integer insertCarMessage(CarMessage carMessage); - - - /** - * 删除车辆报文规则 - */ - Integer deleteByCarMessageId(Integer carMessageId); - - /** - * 修改车辆报文规则 - */ - Integer updateCarMessage(CarMessage carMessage); } diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/server/service/CarInformationService.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/server/service/CarInformationService.java index 9851d9e..c33c641 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/server/service/CarInformationService.java +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/server/service/CarInformationService.java @@ -1,5 +1,7 @@ package com.muyu.server.service; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; import com.github.pagehelper.PageInfo; import com.muyu.common.core.domain.Result; @@ -14,7 +16,7 @@ import java.util.List; /** * 车辆信息管理业务层 */ -public interface CarInformationService { +public interface CarInformationService extends IService { /** * 企业车辆管理列表 * 联查--> 车辆管理--车辆类型表--车辆电子围栏 @@ -32,7 +34,7 @@ public interface CarInformationService { * @param carInformationListReq * @return */ - PageInfo selectCarInformationList(CarInformationListReq carInformationListReq); + Page selectCarInformationList(CarInformationListReq carInformationListReq); /** @@ -40,14 +42,14 @@ public interface CarInformationService { * @param carInformationAddReq * @return */ - Result addCarInformation(CarInformationAddReq carInformationAddReq); + boolean addCarInformation(CarInformationAddReq carInformationAddReq); /** * 企业车辆删除 * @param carInformationId * @return */ - Result delBycarInformationId(Integer carInformationId); + boolean delBycarInformationId(Integer carInformationId); /** @@ -55,7 +57,7 @@ public interface CarInformationService { * @param carInformationUpdReq * @return */ - Result updatecarInformation(CarInformationUpdReq carInformationUpdReq); + boolean updatecarInformation(CarInformationUpdReq carInformationUpdReq); /** diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/server/service/CarMessageService.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/server/service/CarMessageService.java index e9ea9ed..3199524 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/server/service/CarMessageService.java +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/server/service/CarMessageService.java @@ -23,19 +23,19 @@ public interface CarMessageService extends IService { /** * 添加车辆报文规则 */ - Result insertCarMessage(CarMessage carMessage); + boolean insertCarMessage(CarMessage carMessage); /** * 删除车辆报文规则 */ - Result delectByCarMessageId(Integer carMessageId); + boolean delectByCarMessageId(Integer carMessageId); /** * 修改车辆报文规则 */ - Result updateCarMessage(CarMessage carMessage); + boolean updateCarMessage(CarMessage carMessage); /** * 查询 diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/server/service/impl/CarFenceServiceImpl.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/server/service/impl/CarFenceServiceImpl.java index e30f1e3..ba39498 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/server/service/impl/CarFenceServiceImpl.java +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/server/service/impl/CarFenceServiceImpl.java @@ -133,7 +133,7 @@ public class CarFenceServiceImpl carInformations.forEach(carInformation -> { Integer carFenceGroupId = carFenceGroup.getId(); - Integer carInformationId = carInformation.getCarInformationId(); + Long carInformationId = carInformation.getCarInformationId(); carMiddles.add(new CarMiddle(carFenceGroupId,carInformationId)); }); }); diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/server/service/impl/CarInformationServiceImpl.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/server/service/impl/CarInformationServiceImpl.java index 7890b12..f0eab84 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/server/service/impl/CarInformationServiceImpl.java +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/server/service/impl/CarInformationServiceImpl.java @@ -1,9 +1,16 @@ package com.muyu.server.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import com.github.yulichang.wrapper.MPJLambdaWrapper; import com.muyu.common.core.domain.Result; +import com.muyu.common.core.utils.StringUtils; +import com.muyu.domain.CarFence; import com.muyu.domain.CarInformation; +import com.muyu.domain.CarType; import com.muyu.domain.req.CarInformationAddReq; import com.muyu.domain.req.CarInformationListReq; import com.muyu.domain.req.CarInformationUpdReq; @@ -15,13 +22,17 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.ArrayList; import java.util.List; /** * 车辆信息管理业务实现层 + * @author 17353 */ @Service -public class CarInformationServiceImpl implements CarInformationService { +public class CarInformationServiceImpl + extends ServiceImpl + implements CarInformationService { @Resource private CarInformationMapper carInformationMapper; @Autowired @@ -46,11 +57,41 @@ public class CarInformationServiceImpl implements CarInformationService { * @return */ @Override - public PageInfo selectCarInformationList(CarInformationListReq carInformationListReq) { - PageHelper.startPage(carInformationListReq.getPageNum(),carInformationListReq.getPageSize()); - List carInformations = carInformationMapper.selectCarInformationList(carInformationListReq); - PageInfo pageInfo = new PageInfo<>(carInformations); - return pageInfo; + public Page selectCarInformationList(CarInformationListReq carInformationListReq) { + Page carInformationRespPage = carInformationMapper.selectJoinPage( + new Page<>(carInformationListReq.getPageNum(), carInformationListReq.getPageSize()), + CarInformationResp.class, + new MPJLambdaWrapper() + .selectAll(CarInformation.class) + .select(CarType::getCarTypeId, CarType::getCarTypeName) + .select(CarFence::getId, CarFence::getName) + .leftJoin(CarType.class, CarType::getCarTypeId, CarInformation::getCarInformationType) + .leftJoin(CarFence.class, CarFence::getId, CarInformation::getCarInformationFence) + .eq(StringUtils.isNotEmpty(carInformationListReq.getCarInformationVIN()) + ,CarInformation::getCarInformationVin + , carInformationListReq.getCarInformationVIN()) + .eq(StringUtils.isNotNull(carInformationListReq.getCarTypeId()) + ,CarType::getCarTypeId, carInformationListReq.getCarTypeId()) + .eq(StringUtils.isNotNull(carInformationListReq.getCarInformationFence()) + ,CarInformation::getCarInformationFence + , carInformationListReq.getCarInformationFence()) + .eq(StringUtils.isNotEmpty(carInformationListReq.getCarInformationVIN()) + ,CarInformation::getCarInformationState + , carInformationListReq.getCarInformationState()) + .like(StringUtils.isNotEmpty(carInformationListReq.getCarInformationVIN()) + ,CarInformation::getCarInformationVin + , carInformationListReq.getCarInformationVIN()) + .eq(StringUtils.isNotEmpty( carInformationListReq.getCarInformationMotorModel()) + ,CarInformation::getCarInformationMotorModel + ,carInformationListReq.getCarInformationMotorModel()) + .like(StringUtils.isNotEmpty(carInformationListReq.getCarInformationBatteryManufacturer()) + ,CarInformation::getCarInformationBatteryManufacturer + ,carInformationListReq.getCarInformationBatteryManufacturer()) + .eq(StringUtils.isNotEmpty( carInformationListReq.getCarInformationBatteryModel()) + ,CarInformation::getCarInformationBatteryModel + ,carInformationListReq.getCarInformationBatteryModel()) + ); + return carInformationRespPage; } /** @@ -59,12 +100,10 @@ public class CarInformationServiceImpl implements CarInformationService { * @return */ @Override - public Result addCarInformation(CarInformationAddReq carInformationAddReq) { - Integer addCarInformation = carInformationMapper.addCarInformation(carInformationAddReq); - if(addCarInformation > 0){ - return Result.success(addCarInformation,"添加车辆成功"); - } - return Result.error(402,"添加车辆失败"); + public boolean addCarInformation(CarInformationAddReq carInformationAddReq) { + boolean addCarInformation = this.save(CarInformation.carInformationAddBuilder(carInformationAddReq)); + + return addCarInformation; } /** @@ -73,12 +112,9 @@ public class CarInformationServiceImpl implements CarInformationService { * @return */ @Override - public Result delBycarInformationId(Integer carInformationId) { - Integer delBycarInformationId = carInformationMapper.delBycarInformationId(carInformationId); - if (delBycarInformationId > 0){ - return Result.success(delBycarInformationId ,"删除车辆成功"); - } - return Result.error(402,"删除车辆失败"); + public boolean delBycarInformationId(Integer carInformationId) { + boolean delBycarInformationId = this.removeById(carInformationId); + return delBycarInformationId; } @@ -88,13 +124,12 @@ public class CarInformationServiceImpl implements CarInformationService { * @return */ @Override - public Result updatecarInformation(CarInformationUpdReq carInformationUpdReq) { - Integer updatecarInformation = carInformationMapper.updatecarInformation(carInformationUpdReq); - if(updatecarInformation > 0) - { - return Result.success(carInformationUpdReq,"修改成功"); - } - return Result.error( 402,"修改失败"); + public boolean updatecarInformation(CarInformationUpdReq carInformationUpdReq) { + Long carInformationId = carInformationUpdReq.getCarInformationId(); + boolean updatecarInformation = this.updateById( + CarInformation.carInformationUpdBuilder( + carInformationUpdReq, ()->carInformationId)); + return updatecarInformation; } /** @@ -105,6 +140,17 @@ public class CarInformationServiceImpl implements CarInformationService { */ @Override public List selectBycarInformationIDAndLicensePlate() { - return carInformationMapper.selectBycarInformationIDAndLicensePlate(); + List list = this.list() + .stream() + .map(CarInformation::carInformationBuilder) + .toList(); + ArrayList carInformationResps = new ArrayList<>(); + CarInformationResp carInformation1 = new CarInformationResp(); + list.forEach(carInformation -> { + carInformation1.setCarInformationId(carInformation.getCarInformationId()); + carInformation1.setCarInformationLicensePlate( carInformation.getCarInformationLicensePlate()); + carInformationResps.add(carInformation1); + }); + return carInformationResps; } } diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/server/service/impl/CarMessageServiceImpl.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/server/service/impl/CarMessageServiceImpl.java index 6cae031..76b4da6 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/server/service/impl/CarMessageServiceImpl.java +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/server/service/impl/CarMessageServiceImpl.java @@ -3,14 +3,14 @@ package com.muyu.server.service.impl; import cn.hutool.db.Page; 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.utils.StringUtils; import com.muyu.domain.CarMessage; import com.muyu.domain.CarMessageType; +import com.muyu.domain.CarType; import com.muyu.domain.resp.CarMessageResp; import com.muyu.server.mapper.CarMessageMapper; import com.muyu.server.service.CarMessageService; import org.springframework.stereotype.Service; - import javax.annotation.Resource; import java.util.List; @@ -31,41 +31,47 @@ public class CarMessageServiceImpl */ @Override public List selectCarMessageList() { - return carMessageMapper.selectCarMessageList(); + + return carMessageMapper.selectJoinList( + CarMessage.class + ,new MPJLambdaWrapper() + .select(CarMessage::getCarMessageId + ,CarMessage::getCarMessageCarType + ,CarMessage::getCarMessageType + ,CarMessage::getCarMessageStartIndex + ,CarMessage::getCarMessageEndIndex + ,CarMessage::getMessageTypeClass + ,CarMessage::getCarMessageState) + .select(CarMessageType::getMessageTypeId + ,CarMessageType::getMessageTypeName + ,CarMessageType::getMessageTypeBelongs) + .select(CarType::getCarTypeId + ,CarType::getCarTypeName) + .leftJoin(CarMessageType.class,CarMessageType::getMessageTypeId,CarMessage::getCarMessageType) + .leftJoin(CarType.class,CarType::getCarTypeId,CarMessage::getCarMessageCarType)); } /** * 添加车辆报文规则 */ @Override - public Result insertCarMessage(CarMessage carMessage) { - Integer inserted = carMessageMapper.insertCarMessage(carMessage); - if (inserted > 0){ - return Result.success(inserted,"添加成功"); - } - return Result.error(402,"添加失败"); + public boolean insertCarMessage(CarMessage carMessage) { + return this.save(CarMessage.carMessageAddBuilder(carMessage)); } /** * 删除车辆报文规则 */ @Override - public Result delectByCarMessageId(Integer carMessageId) { - Integer deleteByCarMessageId = carMessageMapper.deleteByCarMessageId(carMessageId); - if (deleteByCarMessageId >0){ - return Result.success(carMessageId ,"删除成功"); - } - return Result.error(402,"删除失败"); + public boolean delectByCarMessageId(Integer carMessageId) { + return this.removeById(carMessageId); + } /** * 修改车辆报文规则 */ @Override - public Result updateCarMessage(CarMessage carMessage) { - Integer integer = carMessageMapper.updateCarMessage(carMessage); - if(integer > 0) - { - return Result.success(carMessage,"修改成功"); - } - return Result.error( 402,"修改失败"); + public boolean updateCarMessage(CarMessage carMessage) { +// Integer integer = carMessageMapper.updateCarMessage(carMessage); + return this.updateById(CarMessage.carMessageUpdBuilder(carMessage, carMessage::getMessageTypeId)); } /** * 查询 @@ -76,14 +82,14 @@ public class CarMessageServiceImpl public List selectJoinList(Long id) { return carMessageMapper.selectJoinList(CarMessageResp.class, new MPJLambdaWrapper() .select(CarMessage::getCarMessageId, - CarMessage::getCarMessageCartype, + CarMessage::getCarMessageCarType, CarMessage::getCarMessageType, CarMessage::getCarMessageStartIndex, CarMessage::getCarMessageEndIndex, CarMessage::getCarMessageState) .select(CarMessageType::getMessageTypeName) .leftJoin(CarMessageType.class, CarMessageType::getMessageTypeId, CarMessage::getCarMessageType) - .eq(CarMessage::getCarMessageCartype, id)); + .eq(StringUtils.isNotNull(id),CarMessage::getCarMessageCarType, id)); } diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/resources/mapper/CarInformationMapper.xml b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/resources/mapper/CarInformationMapper.xml deleted file mode 100644 index 6060630..0000000 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/resources/mapper/CarInformationMapper.xml +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - SELECT - car_information_id, - car_information_VIN, - car_information_license_plate, - car_information_brand, - car_information_color, - car_information_driver, - car_information_examine_enddata, - car_information_motor_manufacturer, - car_information_motor_model, - car_information_battery_manufacturer, - car_information_battery_model, - car_information_fence, - car_information_type, - car_information_focus, - car_information_state - FROM `car_information` - - - - - - - - - INSERT INTO `car_information` - ( - car_information_VIN, - car_information_license_plate, - car_information_brand, - car_information_color, - car_information_driver, - car_information_examine_enddata, - car_information_motor_manufacturer, - car_information_motor_model, - car_information_battery_manufacturer, - car_information_battery_model, - car_information_fence, - car_information_type ) - VALUES ( - #{carInformationVin}, - #{carInformationLicensePlate}, - #{carInformationBrand} , - #{carInformationColor}, - #{carInformationDriver}, - #{carInformationExamineEnddata}, - #{carInformationMotorManufacturer}, - #{carInformationMotorModel}, - #{carInformationBatteryManufacturer}, - #{carInformationBatteryModel}, - #{carInformationFence}, - #{carInformationType} ); - - - - UPDATE `car_information` - SET - - ` car_information_VIN` = #{carInformationVin}, - - - ` car_information_license_plate ` = #{carInformationLicensePlate}, - - - `car_information_brand` = #{carInformationBrand}, - - - `car_information_color` = #{carInformationColor}, - - - `car_information_driver` = #{carInformationDriver}, - - - `car_information_motor_manufacturer` = #{carInformationMotorManufacturer}, - - - `car_information_motor_model` = #{carInformationMotorModel} , - - - `car_information_battery_manufacturer `= #{carInformationBatteryManufacturer}, - - - `car_information_battery_model` = #{carInformationBatteryModel}, - - - `car_information_fence` = #{carInformationFence}, - - - `car_information_type` = #{carInformationType} , - - - `car_information_focus` = #{carInformationFocus}, - - - `car_information_state` = #{carInformationState} - - WHERE `car_information_id` = #{carInformationId} - - - - - DELETE FROM `car_information` - WHERE `car_information`.car_information_id= #{carInformationId} - - - - - - - diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/resources/mapper/CarMessageMapper.xml b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/resources/mapper/CarMessageMapper.xml deleted file mode 100644 index cbed4ec..0000000 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/resources/mapper/CarMessageMapper.xml +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - INSERT INTO `car_message` ( - car_message_cartype, - car_message_type, - car_message_start_index, - car_message_end_index, - message_type_class, - car_message_state - ) - VALUES( - #{carMessageCartype}, - #{carMessageType}, - #{carMessageStartIndex}, - #{carMessageEndIndex}, - #{messageTypeClass}, - #{carMessageState} - ) - - - - UPDATE `car_message` - SET - - car_message_cartype = #{carMessageCartype} , - - - car_message_type = #{carMessageType} , - - - car_message_start_index = #{carMessageStartIndex} , - - - car_message_end_index = #{carMessageEndIndex} , - - - message_type_class = #{messageTypeClass} , - - - car_message_state = #{carMessageState} - - - - - - DELETE FROM `car_message` - WHERE `car_message`.car_message_id = #{carMessageId} - - - - -