feat:()优化代码结构
parent
ac8e4bcc94
commit
1565dd577c
|
@ -1,5 +1,6 @@
|
||||||
package com.muyu.domain;
|
package com.muyu.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
|
@ -13,6 +14,10 @@ import lombok.experimental.SuperBuilder;
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@TableName(value = "fault_rule", autoResultMap = true)
|
@TableName(value = "fault_rule", autoResultMap = true)
|
||||||
public class FaultRule {
|
public class FaultRule {
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
@TableId(value = "fault_rule_id")
|
||||||
private Long faultRuleId;
|
private Long faultRuleId;
|
||||||
private Long vehicleTypeId;
|
private Long vehicleTypeId;
|
||||||
private Long messageValueId;
|
private Long messageValueId;
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
package com.muyu.domain;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.muyu.common.core.annotation.Excel;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.experimental.SuperBuilder;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author:ChenYan
|
|
||||||
* @Project:2112-car-cloud-server
|
|
||||||
* @Package:com.muyu.fault.domain
|
|
||||||
* @Filename:Custom
|
|
||||||
* @Description TODO
|
|
||||||
* @Date:2024/9/21 18:39
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@SuperBuilder
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
@TableName(value = "rule")
|
|
||||||
public class Rule {
|
|
||||||
|
|
||||||
@TableId(value = "id", type = IdType.AUTO)
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@Excel(name = "messageId")
|
|
||||||
private Long messageId;
|
|
||||||
|
|
||||||
@Excel(name = "carId")
|
|
||||||
private Integer carId;
|
|
||||||
|
|
||||||
@Excel(name = "cId")
|
|
||||||
private Integer cId;
|
|
||||||
|
|
||||||
@Excel(name = "tId")
|
|
||||||
private Integer tId;
|
|
||||||
|
|
||||||
@Excel(name = "ruleValue")
|
|
||||||
private Integer ruleValue;
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
package com.muyu.domain;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.experimental.SuperBuilder;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author:ChenYan
|
|
||||||
* @Project:2112-car-cloud-server
|
|
||||||
* @Package:com.muyu.fault.domain
|
|
||||||
* @Filename:Type
|
|
||||||
* @Description TODO
|
|
||||||
* @Date:2024/9/22 10:03
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@SuperBuilder
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
@TableName(value = "type")
|
|
||||||
public class Type {
|
|
||||||
@TableId(value = "t_id", type = IdType.AUTO)
|
|
||||||
private Integer tId;
|
|
||||||
private String typeName;
|
|
||||||
}
|
|
|
@ -47,7 +47,8 @@ public class FaultInfoController extends BaseController {
|
||||||
public Result<TableDataInfo<FaultInfo>> list(FaultInfo faultInfo) {
|
public Result<TableDataInfo<FaultInfo>> list(FaultInfo faultInfo) {
|
||||||
startPage();
|
startPage();
|
||||||
List<FaultInfo> list = service.pageQuery(faultInfo);
|
List<FaultInfo> list = service.pageQuery(faultInfo);
|
||||||
allFaultCacheService.put(faultInfo.getFaultCode(),list);
|
// allFaultCacheService.put(faultInfo.getFaultCode(),list);
|
||||||
|
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,4 +61,7 @@ public class FaultRuleController {
|
||||||
faultRuleService.removeById(faultRuleId);
|
faultRuleService.removeById(faultRuleId);
|
||||||
return Result.success("删除成功");
|
return Result.success("删除成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,142 +0,0 @@
|
||||||
package com.muyu.enterprise.controller;
|
|
||||||
|
|
||||||
import com.muyu.common.core.domain.Result;
|
|
||||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
|
||||||
import com.muyu.common.core.web.controller.BaseController;
|
|
||||||
import com.muyu.common.core.web.page.TableDataInfo;
|
|
||||||
import com.muyu.common.log.annotation.Log;
|
|
||||||
import com.muyu.common.log.enums.BusinessType;
|
|
||||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
|
||||||
|
|
||||||
import com.muyu.domain.*;
|
|
||||||
import com.muyu.domain.vo.RuleVo;
|
|
||||||
import com.muyu.enterprise.service.RuleService;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
import lombok.extern.log4j.Log4j2;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 故障规则
|
|
||||||
*/
|
|
||||||
@Log4j2
|
|
||||||
@RestController
|
|
||||||
@Tag(name = "规则", description = "故障管理列")
|
|
||||||
@RequestMapping("/rules")
|
|
||||||
public class RuleController extends BaseController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RuleService ruleService;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询车辆故障管理列表
|
|
||||||
*/
|
|
||||||
@GetMapping("/list")
|
|
||||||
@RequiresPermissions("fault:rules:list")
|
|
||||||
@Operation(summary = "查询集合", description = "查询车辆故障管理列表")
|
|
||||||
public Result<TableDataInfo<RuleVo>> list(RuleVo fault) {
|
|
||||||
startPage();
|
|
||||||
List<RuleVo> list = ruleService.pageQueryRule(fault);
|
|
||||||
return getDataTable(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出车辆故障管理列表
|
|
||||||
*/
|
|
||||||
@Log(title = "车辆故障管理", businessType = BusinessType.EXPORT)
|
|
||||||
@PostMapping("/export")
|
|
||||||
@RequiresPermissions("fault:rules:export")
|
|
||||||
public void export(HttpServletResponse response, Rule fault) {
|
|
||||||
List<Rule> list = ruleService.pageQuery(fault);
|
|
||||||
ExcelUtil<Rule> util = new ExcelUtil<Rule>(Rule.class);
|
|
||||||
util.exportExcel(response, list, "车辆故障管理数据");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取车辆故障管理详细信息
|
|
||||||
*/
|
|
||||||
@GetMapping(value = "/{id}")
|
|
||||||
public Result<String> getConfigKey(@PathVariable("id") String id) {
|
|
||||||
return success(ruleService.getById(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增车辆故障管理
|
|
||||||
*/
|
|
||||||
@Log(title = "车辆故障管理", businessType = BusinessType.INSERT)
|
|
||||||
@PostMapping
|
|
||||||
@RequiresPermissions("fault:rules:add")
|
|
||||||
public Result add(@RequestBody Rule fault) {
|
|
||||||
return Result.success(ruleService.insertFault(fault), "成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改车故障管理
|
|
||||||
*/
|
|
||||||
@Log(title = "车辆故障管理", businessType = BusinessType.UPDATE)
|
|
||||||
@PutMapping
|
|
||||||
@RequiresPermissions("fault:rules:edit")
|
|
||||||
public Result edit(@RequestBody Rule fault) {
|
|
||||||
return Result.success(ruleService.updateFault(fault), "成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除车辆故障管理
|
|
||||||
*/
|
|
||||||
@Log(title = "车辆故障管理删除", businessType = BusinessType.DELETE)
|
|
||||||
@DeleteMapping("/{id}")
|
|
||||||
@RequiresPermissions("fault:rules:remove")
|
|
||||||
public Result remove(@PathVariable("id") Long[] id) {
|
|
||||||
return Result.success(ruleService.removeBatchByIds(Arrays.asList(id)), "成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询车辆故障管理列表
|
|
||||||
*/
|
|
||||||
@GetMapping("/custom")
|
|
||||||
@Operation(summary = "查询集合", description = "查询车辆故障管理列表")
|
|
||||||
public Result<List<Custom>> custom(Custom fault) {
|
|
||||||
return ruleService.pageQueryList(fault);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询车辆故障管理列表
|
|
||||||
*/
|
|
||||||
@GetMapping("/car")
|
|
||||||
@Operation(summary = "查询集合", description = "查询车辆故障管理列表")
|
|
||||||
public Result<List<Vehicle>> car(Vehicle fault) {
|
|
||||||
return ruleService.pageQueryCar(fault);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询车辆故障管理列表
|
|
||||||
*/
|
|
||||||
@GetMapping("/type")
|
|
||||||
@Operation(summary = "查询集合", description = "查询车辆故障管理列表")
|
|
||||||
public Result<List<Type>> type(Type fault) {
|
|
||||||
return ruleService.pageQueryType(fault);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询车辆故障管理列表
|
|
||||||
*/
|
|
||||||
@GetMapping("/MessageValue")
|
|
||||||
@Operation(summary = "查询集合", description = "查询车辆故障管理列表")
|
|
||||||
public Result<List<MessageValue>> MessageValue(MessageValue fault) {
|
|
||||||
return ruleService.pageQueryMessageValue(fault);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,35 +1,33 @@
|
||||||
package com.muyu.enterprise.controller;
|
package com.muyu.enterprise.controller;
|
||||||
|
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
|
||||||
import com.muyu.common.system.domain.LoginUser;
|
|
||||||
import com.muyu.domain.WarnStrategy;
|
|
||||||
import com.muyu.domain.req.BoundFenceGroupReq;
|
|
||||||
import com.muyu.domain.resp.BoundFenceGroup;
|
|
||||||
import com.muyu.domain.resp.WarnRuleResp;
|
|
||||||
import com.muyu.domain.resp.WarnStrategyAndVinResp;
|
|
||||||
import com.muyu.enterprise.cache.*;
|
|
||||||
import com.muyu.enterprise.service.VehicleService;
|
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||||
import com.muyu.common.core.web.controller.BaseController;
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
import com.muyu.common.core.web.page.TableDataInfo;
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
import com.muyu.domain.BoundMiddle;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
|
import com.muyu.common.system.domain.LoginUser;
|
||||||
import com.muyu.domain.Vehicle;
|
import com.muyu.domain.Vehicle;
|
||||||
|
import com.muyu.domain.req.BoundFenceGroupReq;
|
||||||
import com.muyu.domain.req.VehicleAddReq;
|
import com.muyu.domain.req.VehicleAddReq;
|
||||||
import com.muyu.domain.req.VehicleManageReq;
|
import com.muyu.domain.req.VehicleManageReq;
|
||||||
import com.muyu.domain.req.VehicleUpdReq;
|
import com.muyu.domain.req.VehicleUpdReq;
|
||||||
|
import com.muyu.domain.resp.BoundFenceGroup;
|
||||||
import com.muyu.domain.resp.VehicleManageResp;
|
import com.muyu.domain.resp.VehicleManageResp;
|
||||||
|
import com.muyu.domain.resp.WarnRuleResp;
|
||||||
|
import com.muyu.enterprise.cache.AllFenceGroupCahceService;
|
||||||
|
import com.muyu.enterprise.cache.FenceGroupCahceService;
|
||||||
|
import com.muyu.enterprise.cache.VehicleCacheService;
|
||||||
|
import com.muyu.enterprise.cache.WarnStrategyCacheService;
|
||||||
|
import com.muyu.enterprise.service.VehicleService;
|
||||||
import com.muyu.enterprise.service.WarnStrategyService;
|
import com.muyu.enterprise.service.WarnStrategyService;
|
||||||
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 jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -47,12 +45,6 @@ public class VehicleController extends BaseController {
|
||||||
//添加车辆缓存
|
//添加车辆缓存
|
||||||
@Autowired
|
@Autowired
|
||||||
private VehicleCacheService vehicleCacheService;
|
private VehicleCacheService vehicleCacheService;
|
||||||
//车辆信息
|
|
||||||
@Autowired
|
|
||||||
private AllVehicleCacheService allVehicleCacheService;
|
|
||||||
//缓存策略和vin
|
|
||||||
@Autowired
|
|
||||||
private AllWarnStrategyAndVinCacheService allWarnStrategyAndVinCacheService;
|
|
||||||
//缓存策略
|
//缓存策略
|
||||||
@Autowired
|
@Autowired
|
||||||
private WarnStrategyService warnStrategyService;
|
private WarnStrategyService warnStrategyService;
|
||||||
|
@ -80,7 +72,7 @@ public class VehicleController extends BaseController {
|
||||||
List<Vehicle> vehicleList = vehicleService.list();
|
List<Vehicle> vehicleList = vehicleService.list();
|
||||||
vehicleList.forEach(vehicle -> {
|
vehicleList.forEach(vehicle -> {
|
||||||
vehicleCacheService.put(vehicle.getVehicleVin(), vehicle);
|
vehicleCacheService.put(vehicle.getVehicleVin(), vehicle);
|
||||||
//根据车辆vin存储策略已经规则信息
|
//根据车辆vin存储策略规则信息
|
||||||
if(vehicle.getWarnStrategyId()!=null){
|
if(vehicle.getWarnStrategyId()!=null){
|
||||||
WarnRuleResp respList = warnStrategyService.findByWarnStrategyId(vehicle.getWarnStrategyId());
|
WarnRuleResp respList = warnStrategyService.findByWarnStrategyId(vehicle.getWarnStrategyId());
|
||||||
warnStrategyCacheService.put(vehicle.getVehicleVin(), respList);
|
warnStrategyCacheService.put(vehicle.getVehicleVin(), respList);
|
||||||
|
@ -107,6 +99,7 @@ public class VehicleController extends BaseController {
|
||||||
boolean save = vehicleService.save(Vehicle.addBuild(vehicleAddReq));
|
boolean save = vehicleService.save(Vehicle.addBuild(vehicleAddReq));
|
||||||
//获取用户信息
|
//获取用户信息
|
||||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
|
loginUser.getSysUser();
|
||||||
//存到redis
|
//存到redis
|
||||||
vehicleCacheService.put(vehicleAddReq.getVehicleVin(), Vehicle.addBuild(vehicleAddReq));
|
vehicleCacheService.put(vehicleAddReq.getVehicleVin(), Vehicle.addBuild(vehicleAddReq));
|
||||||
return Result.success(save? "新增成功" : "新增失败");
|
return Result.success(save? "新增成功" : "新增失败");
|
||||||
|
@ -155,7 +148,6 @@ public class VehicleController extends BaseController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除车辆
|
* 批量删除车辆
|
||||||
*
|
|
||||||
* @param vehicleIds
|
* @param vehicleIds
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -29,13 +29,6 @@ public class WarnStrategyController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private WarnStrategyService warnStrategyService;
|
private WarnStrategyService warnStrategyService;
|
||||||
|
|
||||||
//缓存策略
|
|
||||||
@Autowired
|
|
||||||
private WarnStrategyCacheService warnStrategyCacheService;
|
|
||||||
|
|
||||||
//列表
|
|
||||||
@Autowired
|
|
||||||
private AllWarnStrategyCacheService allWarnStrategyCacheService;
|
|
||||||
|
|
||||||
//缓存策略和vin
|
//缓存策略和vin
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -50,10 +43,6 @@ public class WarnStrategyController {
|
||||||
@Operation(summary = "策略列表", description = "获取所有策略列表")
|
@Operation(summary = "策略列表", description = "获取所有策略列表")
|
||||||
public Result<List<WarnVehicleResp>> strategyList(@RequestBody @Validated WarnVehicleReq req) {
|
public Result<List<WarnVehicleResp>> strategyList(@RequestBody @Validated WarnVehicleReq req) {
|
||||||
List<WarnVehicleResp> list = warnStrategyService.selectList(req);
|
List<WarnVehicleResp> list = warnStrategyService.selectList(req);
|
||||||
// for (WarnVehicleResp warnVehicleResp : list) {
|
|
||||||
// //存进Redis
|
|
||||||
// allWarnStrategyCacheService.put(String.valueOf(warnVehicleResp.getVehicleVin()), warnVehicleResp);
|
|
||||||
// }
|
|
||||||
return Result.success(list);
|
return Result.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,12 +67,6 @@ public class WarnStrategyController {
|
||||||
public Result strategyAdd(@Validated @RequestBody WarnStrategy warnStrategy){
|
public Result strategyAdd(@Validated @RequestBody WarnStrategy warnStrategy){
|
||||||
|
|
||||||
boolean save = warnStrategyService.save(warnStrategy);
|
boolean save = warnStrategyService.save(warnStrategy);
|
||||||
// //存进Redis
|
|
||||||
// //获取用户信息
|
|
||||||
// LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
||||||
// //获取租户唯一标识
|
|
||||||
// String databaseName = loginUser.getSysUser().getDatabaseName();
|
|
||||||
// warnStrategyCacheService.put(databaseName+warnStrategy.getWarnStrategyId(),warnStrategy);
|
|
||||||
return Result.success(save);
|
return Result.success(save);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
package com.muyu.enterprise.mapper;
|
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.muyu.domain.*;
|
|
||||||
import com.muyu.domain.vo.RuleVo;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author:ChenYan
|
|
||||||
* @Project:2112-car-cloud-server
|
|
||||||
* @Package:com.muyu.fault.mapper
|
|
||||||
* @Filename:RuleMapper
|
|
||||||
* @Description TODO
|
|
||||||
* @Date:2024/9/21 18:50
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface RuleMapper extends BaseMapper<Rule> {
|
|
||||||
int insertFault(Rule faultInfo);
|
|
||||||
|
|
||||||
int updateFault(Rule faultInfo);
|
|
||||||
|
|
||||||
|
|
||||||
List<RuleVo> pageQueryRule(RuleVo fault);
|
|
||||||
|
|
||||||
List<Custom> pageQueryList(Custom fault);
|
|
||||||
|
|
||||||
List<Vehicle> pageQueryCar(Vehicle fault);
|
|
||||||
List<Type> pageQueryType(Type fault);
|
|
||||||
|
|
||||||
List<MessageValue> pageQueryMessageValue(MessageValue fault);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,52 +0,0 @@
|
||||||
package com.muyu.enterprise.service;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import com.muyu.common.core.domain.Result;
|
|
||||||
import com.muyu.domain.*;
|
|
||||||
import com.muyu.domain.vo.RuleVo;
|
|
||||||
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author:ChenYan
|
|
||||||
* @Project:2112-car-cloud-server
|
|
||||||
* @Package:com.muyu.fault.service
|
|
||||||
* @Filename:RuleService
|
|
||||||
* @Description TODO
|
|
||||||
* @Date:2024/9/21 18:47
|
|
||||||
*/
|
|
||||||
public interface RuleService extends IService<Rule> {
|
|
||||||
/**
|
|
||||||
* 查询车辆故障管理
|
|
||||||
*
|
|
||||||
* @param fault 车辆故障管理主键
|
|
||||||
* @return 车辆故障管理
|
|
||||||
*/
|
|
||||||
List<Rule> pageQuery(Rule fault);
|
|
||||||
List<RuleVo> pageQueryRule(RuleVo fault);
|
|
||||||
/**
|
|
||||||
* 新增车辆故障管理
|
|
||||||
*
|
|
||||||
* @param fault 车辆故障管理
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int insertFault(Rule fault);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改车辆故障管理
|
|
||||||
*
|
|
||||||
* @param fault 车辆故障管理
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int updateFault(Rule fault);
|
|
||||||
|
|
||||||
Result<List<Custom>> pageQueryList(Custom fault);
|
|
||||||
|
|
||||||
Result<List<Vehicle>> pageQueryCar(Vehicle fault);
|
|
||||||
Result<List<Type>> pageQueryType(Type fault);
|
|
||||||
|
|
||||||
|
|
||||||
Result<List<MessageValue>> pageQueryMessageValue(MessageValue fault);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,106 +0,0 @@
|
||||||
package com.muyu.enterprise.service.impl;
|
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.muyu.common.core.domain.Result;
|
|
||||||
|
|
||||||
import com.muyu.domain.*;
|
|
||||||
import com.muyu.domain.vo.RuleVo;
|
|
||||||
import com.muyu.enterprise.mapper.RuleMapper;
|
|
||||||
import com.muyu.enterprise.service.RuleService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author:ChenYan
|
|
||||||
* @Project:2112-car-cloud-server
|
|
||||||
* @Package:com.muyu.fault.service
|
|
||||||
* @Filename:RuleServiceImpl
|
|
||||||
* @Description TODO
|
|
||||||
* @Date:2024/9/21 18:49
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class RuleServiceImpl extends ServiceImpl<RuleMapper, Rule> implements RuleService {
|
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RuleMapper ruleMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param fault 车辆故障管理主键
|
|
||||||
* @return fault
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<Rule> pageQuery(Rule fault) {
|
|
||||||
LambdaQueryWrapper<Rule> queryWrapper = new LambdaQueryWrapper<>();
|
|
||||||
if (fault.getRuleValue()!=null) {
|
|
||||||
queryWrapper.like(Rule::getRuleValue, fault.getRuleValue());
|
|
||||||
}
|
|
||||||
return this.list(queryWrapper);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<RuleVo> pageQueryRule(RuleVo fault) {
|
|
||||||
List<RuleVo>list=ruleMapper.pageQueryRule(fault);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 下拉框
|
|
||||||
* @param fault
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Result<List<Custom>> pageQueryList(Custom fault) {
|
|
||||||
List<Custom>list=ruleMapper.pageQueryList(fault);
|
|
||||||
return Result.success(list,"成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result<List<Vehicle>> pageQueryCar(Vehicle fault) {
|
|
||||||
List<Vehicle>list=ruleMapper.pageQueryCar(fault);
|
|
||||||
return Result.success(list,"成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result<List<Type>> pageQueryType(Type fault) {
|
|
||||||
List<Type>list=ruleMapper.pageQueryType(fault);
|
|
||||||
return Result.success(list,"成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result<List<MessageValue>> pageQueryMessageValue(MessageValue fault) {
|
|
||||||
List<MessageValue>list=ruleMapper.pageQueryMessageValue(fault);
|
|
||||||
return Result.success(list,"成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***
|
|
||||||
* 车辆故障管理insertFault
|
|
||||||
* @param faultInfo
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int insertFault(Rule faultInfo) {
|
|
||||||
int i = ruleMapper.insertFault(faultInfo);
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 车辆故障管理updateFault
|
|
||||||
* @param faultInfo
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int updateFault(Rule faultInfo) {
|
|
||||||
int i = ruleMapper.updateFault(faultInfo);
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -3,7 +3,6 @@ package com.muyu.enterprise.service.impl;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
import com.muyu.common.core.utils.StringUtils;
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
import com.muyu.domain.BoundMiddle;
|
|
||||||
import com.muyu.domain.FenceGroup;
|
import com.muyu.domain.FenceGroup;
|
||||||
import com.muyu.domain.Vehicle;
|
import com.muyu.domain.Vehicle;
|
||||||
import com.muyu.domain.VehicleType;
|
import com.muyu.domain.VehicleType;
|
||||||
|
@ -11,13 +10,11 @@ import com.muyu.domain.req.BoundFenceGroupReq;
|
||||||
import com.muyu.domain.req.VehicleManageReq;
|
import com.muyu.domain.req.VehicleManageReq;
|
||||||
import com.muyu.domain.resp.BoundFenceGroup;
|
import com.muyu.domain.resp.BoundFenceGroup;
|
||||||
import com.muyu.domain.resp.VehicleManageResp;
|
import com.muyu.domain.resp.VehicleManageResp;
|
||||||
import com.muyu.enterprise.cache.AllVehicleCacheService;
|
|
||||||
import com.muyu.enterprise.mapper.VehicleMapper;
|
import com.muyu.enterprise.mapper.VehicleMapper;
|
||||||
import com.muyu.enterprise.service.VehicleService;
|
import com.muyu.enterprise.service.VehicleService;
|
||||||
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,54 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!DOCTYPE mapper
|
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.muyu.enterprise.mapper.RuleMapper">
|
|
||||||
<insert id="insertFault">
|
|
||||||
INSERT INTO `vehicle-basic`.`rule` ( `message_id`, `car_id`, `c_id`, `t_id`, `rule_value`)
|
|
||||||
VALUES ( #{messageId}, #{carId}, #{cId}, #{tId}, #{ruleValue})
|
|
||||||
|
|
||||||
</insert>
|
|
||||||
|
|
||||||
<update id="updateFault">
|
|
||||||
UPDATE `rule`
|
|
||||||
SET `message_id`=#{messageId},
|
|
||||||
`car_id` = #{carId},
|
|
||||||
`c_id` = #{cId},
|
|
||||||
`t_id` = #{tId},
|
|
||||||
`rule_value` = #{ruleValue}
|
|
||||||
WHERE `id` = #{id};
|
|
||||||
|
|
||||||
</update>
|
|
||||||
<select id="pageQueryRule" resultType="com.muyu.domain.vo.RuleVo">
|
|
||||||
SELECT
|
|
||||||
rule.id,
|
|
||||||
rule.car_id,
|
|
||||||
rule.c_id,
|
|
||||||
rule.t_id,
|
|
||||||
rule.message_id,
|
|
||||||
rule_value,
|
|
||||||
custom_name AS customName,
|
|
||||||
type_name AS typeName,
|
|
||||||
car.car_name AS carName,
|
|
||||||
message_value.message_label AS messageLabel
|
|
||||||
FROM
|
|
||||||
rule
|
|
||||||
LEFT JOIN custom ON rule.c_id = custom.c_id
|
|
||||||
LEFT JOIN type ON rule.t_id = type.t_id
|
|
||||||
LEFT JOIN car ON rule.car_id = car.car_id
|
|
||||||
LEFT JOIN message_value ON rule.message_id = message_value.message_id
|
|
||||||
</select>
|
|
||||||
<select id="pageQueryList" resultType="com.muyu.domain.Custom">
|
|
||||||
select * from custom
|
|
||||||
</select>
|
|
||||||
<select id="pageQueryCar" resultType="com.muyu.domain.Vehicle">
|
|
||||||
select * from vehicle
|
|
||||||
</select>
|
|
||||||
<select id="pageQueryType" resultType="com.muyu.domain.Type">
|
|
||||||
select * from type
|
|
||||||
</select>
|
|
||||||
<select id="pageQueryMessageValue" resultType="com.muyu.domain.MessageValue">
|
|
||||||
select * from message_value
|
|
||||||
</select>
|
|
||||||
|
|
||||||
</mapper>
|
|
Loading…
Reference in New Issue