feat():修改车辆管理

dev
SuiXxx 2024-09-24 09:58:07 +08:00
parent f4772c7799
commit 154b26d7a6
9 changed files with 52 additions and 29 deletions

View File

@ -20,10 +20,9 @@ public class SysCar extends BaseEntity {
private String carVin; private String carVin;
private Long carTypeId; private Long carTypeId;
private String state; private String state;
private Long fenceId;
private String carMotorManufacturer; private String carMotorManufacturer;
private String carMotorModel; private String carMotorModel;
private String carBatteryManufacturer; private String carBatteryManufacturer;
private String carBatteryModel; private String carBatteryModel;
private Long strategyId;
} }

View File

@ -1,5 +1,6 @@
package com.muyu.domain.resp; package com.muyu.domain.resp;
import com.muyu.common.core.annotation.Excel;
import com.muyu.domain.SysCar; import com.muyu.domain.SysCar;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
@ -12,8 +13,10 @@ import lombok.NoArgsConstructor;
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class SysCarVo extends SysCar { public class SysCarVo extends SysCar {
@Excel(name = "车辆类型名称")
private String typeName; private String typeName;
private String fenceName; @Excel(name = "策略名称")
private Long strategyName;

View File

@ -4,10 +4,10 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.muyu.mapper.SysCarMapper"> <mapper namespace="com.muyu.mapper.SysCarMapper">
<select id="selectSysCarVoList" resultType="com.muyu.domain.resp.SysCarVo"> <select id="selectSysCarVoList" resultType="com.muyu.domain.resp.SysCarVo">
SELECT * ,car_type.type_name,tb_fence.fence_name SELECT * ,car_type.type_name,warn_strategy.strategy_name
FROM `sys_car` FROM `sys_car`
LEFT JOIN car_type ON sys_car.car_type_id=car_type.id LEFT JOIN car_type ON sys_car.car_type_id=car_type.id
LEFT JOIN tb_fence ON sys_car.fence_id=tb_fence.fence_id LEFT JOIN warn_strategy ON sys_car.strategy_id=warn_strategy.id
<where> <where>
<if test="carVin!=null and carVin!=''"> <if test="carVin!=null and carVin!=''">
sys_car.car_vin=#{carVin} sys_car.car_vin=#{carVin}
@ -32,10 +32,10 @@
<select id="selectSysCarVoById" resultType="com.muyu.domain.resp.SysCarVo"> <select id="selectSysCarVoById" resultType="com.muyu.domain.resp.SysCarVo">
SELECT * ,car_type.type_name,tb_fence.fence_name SELECT * ,car_type.type_name,warn_strategy.strategy_name
FROM `sys_car` FROM `sys_car`
LEFT JOIN car_type ON sys_car.car_type_id=car_type.id LEFT JOIN car_type ON sys_car.car_type_id=car_type.id
LEFT JOIN tb_fence ON sys_car.fence_id=tb_fence.fence_id LEFT JOIN warn_strategy ON sys_car.strategy_id=warn_strategy.id
where sys_car.id=#{id} where sys_car.id=#{id}
</select> </select>
<select id="findFenceByCarVin" resultType="com.muyu.domain.resp.SysCarFaultLogVo"> <select id="findFenceByCarVin" resultType="com.muyu.domain.resp.SysCarFaultLogVo">

View File

@ -36,11 +36,9 @@ public class WarnLogsController extends BaseController
/** /**
* *
*/ */
@GetMapping("/list") @GetMapping("/selectWarnLogsList")
public Result<TableDataInfo<WarnLogs>> list(@RequestBody WarnLogs warnLogs) public Result selectWarnLogsList(){
{ return Result.success(warnLogsService.selectWarnLogsList());
List<WarnLogs> list = warnLogsService.selectWarnLogsList(warnLogs);
return getDataTable(list);
} }
@ -48,7 +46,7 @@ public class WarnLogsController extends BaseController
* *
*/ */
@GetMapping(value = "selectWarnLogsById/{id}") @GetMapping(value = "selectWarnLogsById/{id}")
public Result<List<WarnLogs>> selectWarnLogsById(@PathVariable("id") Long id) public Result selectWarnLogsById(@PathVariable("id") Long id)
{ {
return success(warnLogsService.selectWarnLogsById(id)); return success(warnLogsService.selectWarnLogsById(id));
} }

View File

@ -10,7 +10,7 @@ import lombok.NoArgsConstructor;
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class WarnLogsResq extends WarnLogs { public class WarnLogsResp extends WarnLogs {
/** 规则名称 */ /** 规则名称 */
@Excel(name = "规则名称") @Excel(name = "规则名称")
private String ruleName; private String ruleName;

View File

@ -3,7 +3,9 @@ package com.muyu.mapper;
import java.util.List; import java.util.List;
import com.muyu.domain.WarnLogs ; import com.muyu.domain.WarnLogs ;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.domain.resp.WarnLogsResp;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/** /**
* Mapper * Mapper
@ -13,5 +15,7 @@ import org.apache.ibatis.annotations.Mapper;
*/ */
@Mapper @Mapper
public interface WarnLogsMapper extends BaseMapper<WarnLogs>{ public interface WarnLogsMapper extends BaseMapper<WarnLogs>{
List<WarnLogsResp> selectWarnLogsList();
WarnLogsResp selectWarnLogs(@Param("id")Long id);
} }

View File

@ -3,6 +3,8 @@ package com.muyu.service;
import java.util.List; import java.util.List;
import com.muyu.domain.WarnLogs ; import com.muyu.domain.WarnLogs ;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.domain.resp.WarnLogsResp;
import org.apache.ibatis.annotations.Param;
/** /**
* Service * Service
@ -17,16 +19,13 @@ public interface WarnLogsService extends IService<WarnLogs> {
* @param id * @param id
* @return * @return
*/ */
public WarnLogs selectWarnLogsById(Long id); public WarnLogsResp selectWarnLogsById(Long id);
/** /**
* *
*
* @param warnLogs
* @return * @return
*/ */
public List<WarnLogs> selectWarnLogsList(WarnLogs warnLogs); List<WarnLogsResp> selectWarnLogsList();
/** /**
* *

View File

@ -3,6 +3,7 @@ package com.muyu.service.impl;
import java.util.List; import java.util.List;
import com.muyu.common.core.utils.StringUtils; import com.muyu.common.core.utils.StringUtils;
import com.muyu.domain.resp.WarnLogsResp;
import com.muyu.mapper.WarnLogsMapper; import com.muyu.mapper.WarnLogsMapper;
import com.muyu.service.WarnLogsService; import com.muyu.service.WarnLogsService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -32,26 +33,20 @@ public class WarnLogsServiceImpl
* @return * @return
*/ */
@Override @Override
public WarnLogs selectWarnLogsById(Long id) public WarnLogsResp selectWarnLogsById(Long id)
{ {
return warnLogsMapper.selectById(id); return warnLogsMapper.selectWarnLogs(id);
} }
/** /**
* *
*
* @param warnLogs
* @return * @return
*/ */
@Override @Override
public List<WarnLogs> selectWarnLogsList(WarnLogs warnLogs) public List<WarnLogsResp> selectWarnLogsList()
{ {
LambdaQueryWrapper<WarnLogs> queryWrapper = new LambdaQueryWrapper<>(); return warnLogsMapper.selectWarnLogsList();
if (StringUtils.isNotEmpty(warnLogs.getVin())){
queryWrapper.eq(WarnLogs::getVin, warnLogs.getVin());
}
return warnLogsMapper.selectList(queryWrapper);
} }
@Override @Override

View File

@ -0,0 +1,25 @@
<?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.mapper.WarnLogsMapper">
<select id="selectWarnLogsList" resultType="com.muyu.domain.resp.WarnLogsResp">
SELECT
*,
warn_rule.rule_name
FROM
warn_logs
LEFT JOIN warn_rule
ON warn_logs.warn_rule_id = warn_rule.id
</select>
<select id="selectWarnLogs" resultType="com.muyu.domain.resp.WarnLogsResp">
SELECT
*,
warn_rule.rule_name
FROM
warn_logs
LEFT JOIN warn_rule
ON warn_logs.warn_rule_id = warn_rule.id
where warn_rule.id=#{id}
</select>
</mapper>