修改代码,mybatis->mybatis-plus
parent
fa36d029af
commit
83312b8e37
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.muyu.domain.req.FaultCodeAddReq;
|
import com.muyu.domain.req.FaultCodeAddReq;
|
||||||
|
import com.muyu.domain.req.FaultCodeUpdReq;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
|
@ -74,6 +75,18 @@ public class FaultCode {
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static FaultCode updfaultcode(FaultCodeUpdReq faultCodeUpdReq){
|
||||||
|
return FaultCode.builder()
|
||||||
|
.faultcodeId(0)
|
||||||
|
.messageTypeId(faultCodeUpdReq.getMessageTypeId())
|
||||||
|
.faultcodeNumber(faultCodeUpdReq.getFaultcodeNumber())
|
||||||
|
.faultGroup(faultCodeUpdReq.getFaultGroup())
|
||||||
|
.faultBit(faultCodeUpdReq.getFaultBit())
|
||||||
|
.faultValue(faultCodeUpdReq.getFaultValue())
|
||||||
|
.isWarning(faultCodeUpdReq.getIsWarning())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.muyu.domain;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.muyu.domain.req.FaultCodeAddReq;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
@ -30,7 +31,7 @@ public class FaultLabel {
|
||||||
*自增主键
|
*自增主键
|
||||||
*/
|
*/
|
||||||
@TableId(value = "message_type_id",type = IdType.AUTO)
|
@TableId(value = "message_type_id",type = IdType.AUTO)
|
||||||
private String messageTypeId;
|
private long messageTypeId;
|
||||||
/**
|
/**
|
||||||
*报文编码
|
*报文编码
|
||||||
*/
|
*/
|
||||||
|
@ -45,6 +46,14 @@ public class FaultLabel {
|
||||||
private String messageTypeBelongs;
|
private String messageTypeBelongs;
|
||||||
|
|
||||||
|
|
||||||
|
public static FaultLabel addfaultLabel(FaultCodeAddReq faultCodeAddReq){
|
||||||
|
return FaultLabel.builder()
|
||||||
|
.messageTypeId(0)
|
||||||
|
.messageTypeId(faultCodeAddReq.getMessageTypeId())
|
||||||
|
.messageTypeName(faultCodeAddReq.getMessageTypeName())
|
||||||
|
.messageTypeBelongs(faultCodeAddReq.getMessageTypeBelongs())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -59,16 +59,6 @@ public class FaultLog {
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@Schema(description = "结束报警时间",defaultValue = "2024-8-9 10:47:57",type = "Date")
|
@Schema(description = "结束报警时间",defaultValue = "2024-8-9 10:47:57",type = "Date")
|
||||||
private Date endwarningTime;
|
private Date endwarningTime;
|
||||||
/**
|
|
||||||
* 故障码
|
|
||||||
*/
|
|
||||||
private String faultcodeNumber;
|
|
||||||
/**
|
|
||||||
* 车辆vin
|
|
||||||
*/
|
|
||||||
private String carInformationVIN;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,18 +30,6 @@ public class FaultCodeController {
|
||||||
private FaultCodeService faultCodeService;
|
private FaultCodeService faultCodeService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 故障码展示(仅故障码单表)
|
|
||||||
* @param faultCodeListReq
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping(path = "/list")
|
|
||||||
@Operation(summary = "故障码列表(单)",description = "展示故障码信息")
|
|
||||||
public Result<FaultCodeTotalListResp> selectlist(@Validated @RequestBody FaultCodeListReq faultCodeListReq){
|
|
||||||
return Result.success(faultCodeService.selectlist(faultCodeListReq));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 故障码展示(故障码联查)
|
* 故障码展示(故障码联查)
|
||||||
* @param faultCodeListReq
|
* @param faultCodeListReq
|
||||||
|
|
|
@ -2,11 +2,13 @@ package com.muyu.server.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
import com.muyu.domain.FaultCode;
|
import com.muyu.domain.FaultCode;
|
||||||
import com.muyu.domain.FaultLabel;
|
import com.muyu.domain.FaultLabel;
|
||||||
import com.muyu.domain.req.FaultCodeAddReq;
|
import com.muyu.domain.req.FaultCodeAddReq;
|
||||||
import com.muyu.domain.req.FaultCodeListReq;
|
import com.muyu.domain.req.FaultCodeListReq;
|
||||||
import com.muyu.domain.req.FaultCodeUpdReq;
|
import com.muyu.domain.req.FaultCodeUpdReq;
|
||||||
|
import com.muyu.domain.resp.FaultCodeListResp;
|
||||||
import com.muyu.domain.vo.FaultCodeVO;
|
import com.muyu.domain.vo.FaultCodeVO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
@ -22,24 +24,6 @@ import java.util.List;
|
||||||
* @Date:2024/9/17 14:52
|
* @Date:2024/9/17 14:52
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface FaultCodeMapper extends BaseMapper<FaultCodeVO> {
|
public interface FaultCodeMapper extends MPJBaseMapper<FaultCode> {
|
||||||
|
|
||||||
List<FaultCodeVO> selectfaultcodelist(FaultCodeListReq faultCodeListReq);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//新增故障码
|
|
||||||
FaultLabel selectfaultName(@Param("messageTypeName") String messageTypeName);
|
|
||||||
FaultCode selectfaultCode(@Param("faultcodeNumber") String faultcodeNumber);
|
|
||||||
Integer insertfaultlabel(FaultCodeAddReq faultCodeAddReq);
|
|
||||||
Integer insertfaultcode(FaultCodeAddReq faultCodeAddReq);
|
|
||||||
|
|
||||||
//修改故障码
|
|
||||||
Integer updfaultlabel(FaultCodeUpdReq faultCodeUpdReq);
|
|
||||||
Integer updfaultcode(FaultCodeUpdReq faultCodeUpdReq);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Integer delfaultcode(@Param("messageTypeId") long messageTypeId);
|
|
||||||
Integer delfaultlabel(@Param("messageTypeId") long messageTypeId);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,8 +20,4 @@ import java.util.List;
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface FaultConditionMapper extends MPJBaseMapper<FaultCondition> {
|
public interface FaultConditionMapper extends MPJBaseMapper<FaultCondition> {
|
||||||
|
|
||||||
List<FaultCondition> selectfaultconditionlist(FaultConditionListReq faultConditionListReq);
|
|
||||||
|
|
||||||
|
|
||||||
List<FaultCondition> selectBytypeAndlabel(FaultConditionAddReq faultConditionAddReq);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.muyu.server.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
import com.muyu.domain.FaultLog;
|
import com.muyu.domain.FaultLog;
|
||||||
import com.muyu.domain.req.FaultLogListReq;
|
import com.muyu.domain.req.FaultLogListReq;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
@ -17,9 +18,7 @@ import java.util.List;
|
||||||
* @Date:2024/9/20 9:33
|
* @Date:2024/9/20 9:33
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface FaultLogMapper extends BaseMapper<FaultLog> {
|
public interface FaultLogMapper extends MPJBaseMapper<FaultLog> {
|
||||||
|
|
||||||
|
|
||||||
List<FaultLog> selectfaultLogMapper(FaultLogListReq faultLogListReq);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,11 @@ package com.muyu.server.service;
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.domain.FaultCode;
|
||||||
import com.muyu.domain.req.FaultCodeAddReq;
|
import com.muyu.domain.req.FaultCodeAddReq;
|
||||||
import com.muyu.domain.req.FaultCodeListReq;
|
import com.muyu.domain.req.FaultCodeListReq;
|
||||||
import com.muyu.domain.req.FaultCodeUpdReq;
|
import com.muyu.domain.req.FaultCodeUpdReq;
|
||||||
|
import com.muyu.domain.resp.FaultCodeListResp;
|
||||||
import com.muyu.domain.resp.FaultCodeTotalListResp;
|
import com.muyu.domain.resp.FaultCodeTotalListResp;
|
||||||
import com.muyu.domain.vo.FaultCodeVO;
|
import com.muyu.domain.vo.FaultCodeVO;
|
||||||
|
|
||||||
|
@ -17,14 +19,9 @@ import com.muyu.domain.vo.FaultCodeVO;
|
||||||
* @name:FaultCodeService
|
* @name:FaultCodeService
|
||||||
* @Date:2024/9/17 14:53
|
* @Date:2024/9/17 14:53
|
||||||
*/
|
*/
|
||||||
public interface FaultCodeService extends IService<FaultCodeVO> {
|
public interface FaultCodeService extends IService<FaultCode> {
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 故障码展示
|
|
||||||
* @param faultCodeListReq
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
FaultCodeTotalListResp selectlist(FaultCodeListReq faultCodeListReq);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 故障码展示(故障码联查)
|
* 故障码展示(故障码联查)
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.muyu.server.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.muyu.domain.FaultLabel;
|
import com.muyu.domain.FaultLabel;
|
||||||
|
import com.muyu.domain.req.FaultCodeAddReq;
|
||||||
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -21,4 +22,24 @@ public interface FaultLabelService extends IService<FaultLabel> {
|
||||||
*/
|
*/
|
||||||
List<FaultLabel> select();
|
List<FaultLabel> select();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断故障名称是否存在
|
||||||
|
* @param messageTypeName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
FaultLabel selectfaultName(String messageTypeName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加故障项表
|
||||||
|
* @param faultCodeAddReq
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Integer insertfaultlabel(FaultCodeAddReq faultCodeAddReq);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除对应的故障名称表信息
|
||||||
|
* @param messageTypeId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Integer delfaultlabel(Integer messageTypeId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.muyu.server.service.impl;
|
package com.muyu.server.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.db.Page;
|
||||||
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.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package com.muyu.server.service.impl;
|
package com.muyu.server.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
import com.muyu.common.core.utils.StringUtils;
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
import com.muyu.domain.FaultCode;
|
import com.muyu.domain.FaultCode;
|
||||||
import com.muyu.domain.FaultLabel;
|
import com.muyu.domain.FaultLabel;
|
||||||
|
@ -13,6 +15,7 @@ import com.muyu.domain.resp.FaultCodeTotalListResp;
|
||||||
import com.muyu.domain.vo.FaultCodeVO;
|
import com.muyu.domain.vo.FaultCodeVO;
|
||||||
import com.muyu.server.mapper.FaultCodeMapper;
|
import com.muyu.server.mapper.FaultCodeMapper;
|
||||||
import com.muyu.server.service.FaultCodeService;
|
import com.muyu.server.service.FaultCodeService;
|
||||||
|
import com.muyu.server.service.FaultLabelService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@ -27,32 +30,11 @@ import java.util.List;
|
||||||
* @Date:2024/9/17 14:53
|
* @Date:2024/9/17 14:53
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class FaultCodeServiceImpl extends ServiceImpl<FaultCodeMapper, FaultCodeVO> implements FaultCodeService {
|
public class FaultCodeServiceImpl extends ServiceImpl<FaultCodeMapper, FaultCode> implements FaultCodeService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private FaultCodeMapper faultCodeMapper;
|
private FaultCodeMapper faultCodeMapper;
|
||||||
|
@Autowired
|
||||||
/**
|
private FaultLabelService faultLabelService;
|
||||||
* 故障码展示
|
|
||||||
* @param faultCodeListReq
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public FaultCodeTotalListResp selectlist(FaultCodeListReq faultCodeListReq) {
|
|
||||||
Integer pageNum = faultCodeListReq.getPageNum();
|
|
||||||
Integer pageSize = faultCodeListReq.getPageSize();
|
|
||||||
LambdaQueryWrapper<FaultCodeVO> queryWrapper = new LambdaQueryWrapper<>();
|
|
||||||
queryWrapper.eq(StringUtils.isNotEmpty(faultCodeListReq.getFaultcodeNumber()),
|
|
||||||
FaultCodeVO::getFaultcodeNumber,faultCodeListReq.getFaultcodeNumber());
|
|
||||||
queryWrapper.eq(StringUtils.isNotEmpty(faultCodeListReq.getFaultBit()),
|
|
||||||
FaultCodeVO::getFaultBit,faultCodeListReq.getFaultBit());
|
|
||||||
long count = this.count(queryWrapper);
|
|
||||||
queryWrapper.last("LIMIT "+ ((pageNum-1)*pageSize)+", "+pageSize);
|
|
||||||
List<FaultCodeVO> faultCodeVOList = this.list(queryWrapper);
|
|
||||||
List<FaultCodeListResp> faultCodeListRespList = faultCodeVOList.stream()
|
|
||||||
.map(FaultCodeListResp::faultCodeListResp)
|
|
||||||
.toList();
|
|
||||||
return FaultCodeTotalListResp.faultCodeTotalListResp(faultCodeListRespList,count);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -62,17 +44,31 @@ public class FaultCodeServiceImpl extends ServiceImpl<FaultCodeMapper, FaultCode
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public FaultCodeTotalListResp selectfaultcodelist(FaultCodeListReq faultCodeListReq) {
|
public FaultCodeTotalListResp selectfaultcodelist(FaultCodeListReq faultCodeListReq) {
|
||||||
LambdaQueryWrapper<FaultCodeVO> queryWrapper = new LambdaQueryWrapper<>();
|
|
||||||
long count = this.count(queryWrapper);
|
MPJLambdaWrapper<FaultCode> wrapper = new MPJLambdaWrapper<>();
|
||||||
int offset = (faultCodeListReq.getPageNum() - 1) * faultCodeListReq.getPageSize();
|
wrapper.select(
|
||||||
faultCodeListReq.setPageNum(offset);
|
FaultCode::getFaultcodeId,
|
||||||
List<FaultCodeVO> selectfaultcodelist = faultCodeMapper.selectfaultcodelist(faultCodeListReq);
|
FaultCode::getMessageTypeId,
|
||||||
List<FaultCodeListResp> faultCodeListRespList = selectfaultcodelist.stream()
|
FaultCode::getFaultcodeNumber,
|
||||||
.map(FaultCodeListResp::faultCodeListResp)
|
FaultCode::getFaultGroup,
|
||||||
.toList();
|
FaultCode::getFaultcodeId,
|
||||||
return FaultCodeTotalListResp.faultCodeTotalListResp(faultCodeListRespList,count);
|
FaultCode::getFaultValue,
|
||||||
|
FaultCode::getIsWarning)
|
||||||
|
.select(
|
||||||
|
FaultLabel::getMessageTypeCode,
|
||||||
|
FaultLabel::getMessageTypeName)
|
||||||
|
.leftJoin(FaultLabel.class,FaultLabel::getMessageTypeId,FaultCode::getMessageTypeId)
|
||||||
|
.eq(StringUtils.isNotEmpty(faultCodeListReq.getFaultcodeNumber()),
|
||||||
|
FaultCode::getFaultcodeNumber,faultCodeListReq.getFaultcodeNumber())
|
||||||
|
.eq(StringUtils.isNotEmpty(faultCodeListReq.getFaultBit()),
|
||||||
|
FaultCode::getFaultBit, faultCodeListReq.getFaultBit());
|
||||||
|
Page<FaultCodeListResp> page = faultCodeMapper.selectJoinPage(new Page<>(faultCodeListReq.getPageNum(), faultCodeListReq.getPageSize()),
|
||||||
|
FaultCodeListResp.class, wrapper);
|
||||||
|
|
||||||
|
return FaultCodeTotalListResp.faultCodeTotalListResp(page.getRecords(),page.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增故障码
|
* 新增故障码
|
||||||
* @param faultCodeAddReq
|
* @param faultCodeAddReq
|
||||||
|
@ -83,13 +79,23 @@ public class FaultCodeServiceImpl extends ServiceImpl<FaultCodeMapper, FaultCode
|
||||||
//判断故障名称或故障码是否存在,若都不存在先添加故障名称表,在添加故障码表
|
//判断故障名称或故障码是否存在,若都不存在先添加故障名称表,在添加故障码表
|
||||||
//1.判断故障名称是否存在
|
//1.判断故障名称是否存在
|
||||||
String messageTypeName = faultCodeAddReq.getMessageTypeName();
|
String messageTypeName = faultCodeAddReq.getMessageTypeName();
|
||||||
FaultLabel faultLabel = faultCodeMapper.selectfaultName(messageTypeName);
|
FaultLabel faultLabel = faultLabelService.selectfaultName(messageTypeName);
|
||||||
//2.判断故障码是否存在
|
//2.判断故障码是否存在
|
||||||
String faultcodeNumber = faultCodeAddReq.getFaultcodeNumber();
|
String faultcodeNumber = faultCodeAddReq.getFaultcodeNumber();
|
||||||
FaultCode faultCode = faultCodeMapper.selectfaultCode(faultcodeNumber);
|
LambdaQueryWrapper<FaultCode> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(StringUtils.isNotEmpty(faultcodeNumber),
|
||||||
|
FaultCode::getFaultcodeNumber, faultcodeNumber);
|
||||||
|
List<FaultCode> list = this.list(queryWrapper);
|
||||||
|
FaultCode faultCode=null;
|
||||||
|
if (!list.isEmpty()){
|
||||||
|
faultCode=list.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
if (faultLabel==null && faultCode==null){
|
if (faultLabel==null && faultCode==null){
|
||||||
faultCodeMapper.insertfaultlabel(faultCodeAddReq);
|
//添加故障项表
|
||||||
faultCodeMapper.insertfaultcode(faultCodeAddReq);
|
faultLabelService.insertfaultlabel(faultCodeAddReq);
|
||||||
|
//添加故障码表
|
||||||
|
faultCodeMapper.insert(FaultCode.addfaultcode(faultCodeAddReq));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,9 +107,7 @@ public class FaultCodeServiceImpl extends ServiceImpl<FaultCodeMapper, FaultCode
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void upd(FaultCodeUpdReq faultCodeUpdReq) {
|
public void upd(FaultCodeUpdReq faultCodeUpdReq) {
|
||||||
//修改故障名称表信息和故障码表信息
|
faultCodeMapper.updateById(FaultCode.updfaultcode(faultCodeUpdReq));
|
||||||
// faultCodeMapper.updfaultlabel(faultCodeUpdReq);
|
|
||||||
faultCodeMapper.updfaultcode(faultCodeUpdReq);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -114,10 +118,12 @@ public class FaultCodeServiceImpl extends ServiceImpl<FaultCodeMapper, FaultCode
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void del(Integer messageTypeId) {
|
public void del(Integer messageTypeId) {
|
||||||
|
// 使用LambdaQueryWrapper来构建查询条件
|
||||||
|
LambdaQueryWrapper<FaultCode> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(FaultCode::getMessageTypeId, messageTypeId); // 假设FaultCode实体类中有一个getMessageTypeId方法
|
||||||
//删除故障码表信息
|
//删除故障码表信息
|
||||||
faultCodeMapper.delfaultcode(messageTypeId);
|
faultCodeMapper.delete(queryWrapper);
|
||||||
//删除对应的故障名称表信息
|
//删除对应的故障名称表信息
|
||||||
faultCodeMapper.delfaultlabel(messageTypeId);
|
faultLabelService.delfaultlabel(messageTypeId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
package com.muyu.server.service.impl;
|
package com.muyu.server.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
|
import com.muyu.domain.CarType;
|
||||||
import com.muyu.domain.FaultCondition;
|
import com.muyu.domain.FaultCondition;
|
||||||
|
import com.muyu.domain.FaultLabel;
|
||||||
import com.muyu.domain.req.FaultConditionAddReq;
|
import com.muyu.domain.req.FaultConditionAddReq;
|
||||||
import com.muyu.domain.req.FaultConditionListReq;
|
import com.muyu.domain.req.FaultConditionListReq;
|
||||||
import com.muyu.domain.resp.FaultConditionListResp;
|
import com.muyu.domain.resp.FaultConditionListResp;
|
||||||
|
@ -38,17 +42,22 @@ public class FaultConditionServiceImpl extends ServiceImpl<FaultConditionMapper,
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public FaultConditionTotalListResp getfaultrulelist(FaultConditionListReq faultConditionListReq) {
|
public FaultConditionTotalListResp getfaultrulelist(FaultConditionListReq faultConditionListReq) {
|
||||||
LambdaQueryWrapper<FaultCondition> queryWrapper = new LambdaQueryWrapper<>();
|
MPJLambdaWrapper<FaultCondition> wrapper = new MPJLambdaWrapper<>();
|
||||||
long count = this.count(queryWrapper);
|
wrapper.selectAll(FaultCondition.class)
|
||||||
int offset = (faultConditionListReq.getPageNum() - 1) * faultConditionListReq.getPageSize();
|
.select(CarType::getCarTypeName)
|
||||||
faultConditionListReq.setPageNum(offset);
|
.select(FaultLabel::getMessageTypeName,
|
||||||
|
FaultLabel::getMessageTypeCode)
|
||||||
List<FaultCondition> selectfaultconditionlist = faultConditionMapper.selectfaultconditionlist(faultConditionListReq);
|
.leftJoin(CarType.class,CarType::getCarTypeId,FaultCondition::getCarTypeId)
|
||||||
List<FaultConditionListResp> faultConditionListRespList = selectfaultconditionlist
|
.leftJoin(FaultLabel.class,FaultLabel::getMessageTypeId,FaultCondition::getMessageTypeId);
|
||||||
.stream()
|
if (faultConditionListReq.getCarTypeId()!=0){
|
||||||
.map(FaultConditionListResp::faultConditionListResp)
|
wrapper.eq(CarType::getCarTypeId, faultConditionListReq.getCarTypeId());
|
||||||
.toList();
|
}
|
||||||
return FaultConditionTotalListResp.faultConditionTotalListResp(faultConditionListRespList,count);
|
if (faultConditionListReq.getMessageTypeId()!=0){
|
||||||
|
wrapper.eq(FaultLabel::getMessageTypeId, faultConditionListReq.getMessageTypeId());
|
||||||
|
}
|
||||||
|
Page<FaultConditionListResp> page = faultConditionMapper.selectJoinPage(new Page<>(faultConditionListReq.getPageNum(), faultConditionListReq.getPageSize()),
|
||||||
|
FaultConditionListResp.class, wrapper);
|
||||||
|
return FaultConditionTotalListResp.faultConditionTotalListResp(page.getRecords(),page.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,7 +68,11 @@ public class FaultConditionServiceImpl extends ServiceImpl<FaultConditionMapper,
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<FaultCondition> selectBytypeAndlabel(FaultConditionAddReq faultConditionAddReq) {
|
public List<FaultCondition> selectBytypeAndlabel(FaultConditionAddReq faultConditionAddReq) {
|
||||||
List<FaultCondition> faultConditionList = faultConditionMapper.selectBytypeAndlabel(faultConditionAddReq);
|
|
||||||
return faultConditionList;
|
LambdaQueryWrapper<FaultCondition> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(FaultCondition::getCarTypeId,faultConditionAddReq.getCarTypeId())
|
||||||
|
.eq(FaultCondition::getMessageTypeId,faultConditionAddReq.getMessageTypeId());
|
||||||
|
List<FaultCondition> list = this.list(queryWrapper);
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,10 @@ package com.muyu.server.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
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.common.core.utils.StringUtils;
|
||||||
|
import com.muyu.domain.FaultCode;
|
||||||
import com.muyu.domain.FaultLabel;
|
import com.muyu.domain.FaultLabel;
|
||||||
|
import com.muyu.domain.req.FaultCodeAddReq;
|
||||||
import com.muyu.server.mapper.FaultLabelMapper;
|
import com.muyu.server.mapper.FaultLabelMapper;
|
||||||
import com.muyu.server.service.FaultLabelService;
|
import com.muyu.server.service.FaultLabelService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -33,4 +36,44 @@ public class FaultLabelServiceImpl extends ServiceImpl<FaultLabelMapper, FaultLa
|
||||||
LambdaQueryWrapper<FaultLabel> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<FaultLabel> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
return this.list(queryWrapper);
|
return this.list(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断故障名称是否存在
|
||||||
|
* @param messageTypeName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public FaultLabel selectfaultName(String messageTypeName) {
|
||||||
|
LambdaQueryWrapper<FaultLabel> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(StringUtils.isNotEmpty(messageTypeName),
|
||||||
|
FaultLabel::getMessageTypeName, messageTypeName);
|
||||||
|
List<FaultLabel> list = this.list(queryWrapper);
|
||||||
|
if (!list.isEmpty()){
|
||||||
|
return list.get(0);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加故障项表
|
||||||
|
* @param faultCodeAddReq
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Integer insertfaultlabel(FaultCodeAddReq faultCodeAddReq) {
|
||||||
|
return faultLabelMapper.insert(FaultLabel.addfaultLabel(faultCodeAddReq));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除对应的故障名称表信息
|
||||||
|
* @param messageTypeId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Integer delfaultlabel(Integer messageTypeId) {
|
||||||
|
// 使用LambdaQueryWrapper来构建查询条件
|
||||||
|
LambdaQueryWrapper<FaultLabel> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(FaultLabel::getMessageTypeId, messageTypeId); // 假设FaultCode实体类中有一个getMessageTypeId方法
|
||||||
|
return faultLabelMapper.delete(queryWrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
package com.muyu.server.service.impl;
|
package com.muyu.server.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
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.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
|
import com.muyu.domain.CarInformation;
|
||||||
|
import com.muyu.domain.FaultCode;
|
||||||
import com.muyu.domain.FaultLog;
|
import com.muyu.domain.FaultLog;
|
||||||
import com.muyu.domain.req.FaultLogListReq;
|
import com.muyu.domain.req.FaultLogListReq;
|
||||||
import com.muyu.domain.resp.FaultLogListResp;
|
import com.muyu.domain.resp.FaultLogListResp;
|
||||||
|
@ -10,9 +15,6 @@ import com.muyu.server.mapper.FaultLogMapper;
|
||||||
import com.muyu.server.service.FaultLogService;
|
import com.muyu.server.service.FaultLogService;
|
||||||
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.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 故障日志业务实现层
|
* 故障日志业务实现层
|
||||||
* @Author:weiran
|
* @Author:weiran
|
||||||
|
@ -33,14 +35,23 @@ public class FaultLogServiceImpl extends ServiceImpl<FaultLogMapper, FaultLog> i
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public FaultLogTotalListResp selectfaultlog(FaultLogListReq faultLogListReq) {
|
public FaultLogTotalListResp selectfaultlog(FaultLogListReq faultLogListReq) {
|
||||||
LambdaQueryWrapper<FaultLog> queryWrapper = new LambdaQueryWrapper<>();
|
|
||||||
long count = this.count(queryWrapper);
|
MPJLambdaWrapper<FaultLog> wrapper = new MPJLambdaWrapper<>();
|
||||||
int offset = (faultLogListReq.getPageNum() - 1) * faultLogListReq.getPageSize();
|
wrapper.selectAll(FaultLog.class)
|
||||||
faultLogListReq.setPageNum(offset);
|
.select(FaultCode::getFaultcodeNumber)
|
||||||
List<FaultLog> faultLogListResps = faultLogMapper.selectfaultLogMapper(faultLogListReq);
|
.select(CarInformation::getCarInformationVin)
|
||||||
List<FaultLogListResp> faultLogListRespList = faultLogListResps.stream()
|
.leftJoin(FaultCode.class,FaultCode::getFaultcodeId,FaultLog::getFaultcodeId)
|
||||||
.map(FaultLogListResp::faultLogListResp)
|
.leftJoin(CarInformation.class,CarInformation::getCarInformationId,FaultLog::getCarInformationId)
|
||||||
.toList();
|
.eq(StringUtils.isNotEmpty(faultLogListReq.getCarVin()),
|
||||||
return FaultLogTotalListResp.faultLogTotalListResp(faultLogListRespList,count);
|
FaultLog::getCarVin,faultLogListReq.getCarVin());
|
||||||
|
if (faultLogListReq.getStartwarningTime()!=null){
|
||||||
|
wrapper.eq(FaultLog::getStartwarningTime,faultLogListReq.getStartwarningTime());
|
||||||
|
}
|
||||||
|
if (faultLogListReq.getEndwarningTime()!=null){
|
||||||
|
wrapper.eq(FaultLog::getEndwarningTime,faultLogListReq.getEndwarningTime());
|
||||||
|
}
|
||||||
|
Page<FaultLogListResp> ipage = faultLogMapper.selectJoinPage(new Page<>(faultLogListReq.getPageNum(),
|
||||||
|
faultLogListReq.getPageSize()), FaultLogListResp.class, wrapper);
|
||||||
|
return FaultLogTotalListResp.faultLogTotalListResp(ipage.getRecords(),ipage.getTotal());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,102 +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.server.mapper.FaultCodeMapper">
|
|
||||||
<resultMap id="FaultCodeVoResult" type="com.muyu.domain.vo.FaultCodeVO">
|
|
||||||
<id property="faultcodeId" column="faultcode_id"></id>
|
|
||||||
<result property="messageTypeId" column="message_type_id"></result>
|
|
||||||
<result property="faultcodeNumber" column="faultcode_number"></result>
|
|
||||||
<result property="faultGroup" column="fault_group"></result>
|
|
||||||
<result property="faultBit" column="fault_bit"></result>
|
|
||||||
<result property="faultValue" column="fault_value"></result>
|
|
||||||
<result property="isWarning" column="is_warning"></result>
|
|
||||||
<result property="faulttypeName" column="faulttype_name"></result>
|
|
||||||
<result property="messageTypeName" column="message_type_name"></result>
|
|
||||||
<result property="messageTypeCode" column="message_type_code"></result>
|
|
||||||
<result property="messageTypeBelongs" column="message_type_belongs"></result>
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
<sql id="selectfaultcodelist" >
|
|
||||||
SELECT
|
|
||||||
car_faultcode.faultcode_id,
|
|
||||||
car_faultcode.message_type_id,
|
|
||||||
car_fault_label.message_type_code,
|
|
||||||
car_faultcode.faultcode_number,
|
|
||||||
car_faultcode.fault_group,
|
|
||||||
car_faultcode.fault_bit,
|
|
||||||
car_faultcode.fault_value,
|
|
||||||
car_fault_label.message_type_name,
|
|
||||||
car_faultcode.is_warning
|
|
||||||
FROM
|
|
||||||
car_faultcode
|
|
||||||
LEFT JOIN car_fault_label ON car_faultcode.message_type_id = car_fault_label.message_type_id
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!--故障码列表展示-->
|
|
||||||
<select id="selectfaultcodelist" resultMap="FaultCodeVoResult">
|
|
||||||
<include refid="selectfaultcodelist"></include>
|
|
||||||
<where>
|
|
||||||
<if test="faultcodeNumber!=null and faultcodeNumber!=''">
|
|
||||||
and car_faultcode.faultcode_number=#{faultcodeNumber}
|
|
||||||
</if>
|
|
||||||
<if test="faultBit!=null and faultBit!=''">
|
|
||||||
and car_faultcode.fault_bit=#{faultBit}
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
limit #{pageNum},#{pageSize}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<!--新增故障码-->
|
|
||||||
<select id="selectfaultName" resultType="com.muyu.domain.FaultLabel">
|
|
||||||
select * from car_fault_label where message_type_name=#{messageTypeName}
|
|
||||||
</select>
|
|
||||||
<select id="selectfaultCode" resultType="com.muyu.domain.FaultCode">
|
|
||||||
select * from car_faultcode where faultcode_number=#{faultcodeNumber}
|
|
||||||
</select>
|
|
||||||
<insert id="insertfaultlabel" keyProperty="messageTypeId" useGeneratedKeys="true">
|
|
||||||
INSERT INTO `eight`.`car_fault_label`
|
|
||||||
(`message_type_id`, `message_type_code`, `message_type_name`, `message_type_belongs`) VALUES
|
|
||||||
(0, #{messageTypeCode}, #{messageTypeName}, '车辆基础');
|
|
||||||
</insert>
|
|
||||||
<insert id="insertfaultcode">
|
|
||||||
INSERT INTO `eight`.`car_faultcode`
|
|
||||||
(`faultcode_id`, `message_type_id`, `faultcode_number`, `fault_group`, `fault_bit`, `fault_value`, `is_warning`) VALUES
|
|
||||||
(0, #{messageTypeId}, #{faultcodeNumber}, #{faultGroup}, #{faultBit}, #{faultValue}, #{isWarning});
|
|
||||||
|
|
||||||
</insert>
|
|
||||||
|
|
||||||
|
|
||||||
<!--修改故障码-->
|
|
||||||
<update id="updfaultlabel">
|
|
||||||
UPDATE `eight`.`car_fault_label`
|
|
||||||
SET `message_type_code` = #{messageTypeCode},
|
|
||||||
`message_type_name` = #{messageTypeName},
|
|
||||||
`message_type_belongs` =#{messageTypeBelongs}
|
|
||||||
WHERE `message_type_id` = #{messageTypeId};
|
|
||||||
</update>
|
|
||||||
<update id="updfaultcode">
|
|
||||||
UPDATE `eight`.`car_faultcode`
|
|
||||||
SET `message_type_id` = #{messageTypeId},
|
|
||||||
`faultcode_number` = #{faultcodeNumber},
|
|
||||||
`fault_group` = #{faultGroup},
|
|
||||||
`fault_bit` = #{faultBit},
|
|
||||||
`fault_value` = #{faultValue},
|
|
||||||
`is_warning` = #{isWarning}
|
|
||||||
WHERE `faultcode_id` = #{faultcodeId};
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<!--删除故障码-->
|
|
||||||
<select id="findByfaultcodeId" resultType="com.muyu.domain.FaultCode">
|
|
||||||
select * from car_faultcode where faultcode_id=#{faultcodeId}
|
|
||||||
</select>
|
|
||||||
<delete id="delfaultcode">
|
|
||||||
delete from car_faultcode where message_type_id=#{messageTypeId}
|
|
||||||
</delete>
|
|
||||||
<delete id="delfaultlabel">
|
|
||||||
delete from car_fault_label where message_type_id=#{messageTypeId}
|
|
||||||
</delete>
|
|
||||||
</mapper>
|
|
|
@ -1,56 +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.server.mapper.FaultConditionMapper">
|
|
||||||
<resultMap id="FaultConditionResult" type="com.muyu.domain.FaultCondition">
|
|
||||||
<id property="carconditionId" column="carcondition_id"></id>
|
|
||||||
<result property="carTypeId" column="car_type_id"></result>
|
|
||||||
<result property="messageTypeId" column="message_type_id"></result>
|
|
||||||
<result property="faultconditionIdentification" column="faultcondition_identification"></result>
|
|
||||||
<result property="faultconditionParameter" column="faultcondition_parameter"></result>
|
|
||||||
<result property="carTypeName" column="car_type_name"></result>
|
|
||||||
<result property="messageTypeName" column="message_type_name"></result>
|
|
||||||
<result property="messageTypeCode" column="message_type_code"></result>
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
<sql id="selectfaultconditionlist" >
|
|
||||||
SELECT
|
|
||||||
car_fault_condition.*,
|
|
||||||
car_type.car_type_name,
|
|
||||||
car_fault_label.message_type_name,
|
|
||||||
car_fault_label.message_type_code
|
|
||||||
FROM
|
|
||||||
car_fault_condition
|
|
||||||
LEFT JOIN car_type ON car_fault_condition.car_type_id = car_type.car_type_id
|
|
||||||
LEFT JOIN car_fault_label ON car_fault_condition.message_type_id = car_fault_label.message_type_id
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
|
|
||||||
<select id="selectfaultconditionlist" resultType="com.muyu.domain.FaultCondition">
|
|
||||||
<include refid="selectfaultconditionlist"></include>
|
|
||||||
<where>
|
|
||||||
<if test="carTypeId!=null and carTypeId!=''">
|
|
||||||
and car_type.car_type_id=#{carTypeId}
|
|
||||||
</if>
|
|
||||||
<if test="messageTypeId!=null and messageTypeId!=''">
|
|
||||||
and car_fault_label.message_type_id=#{messageTypeId}
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
limit #{pageNum},#{pageSize}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectBytypeAndlabel" resultType="com.muyu.domain.FaultCondition">
|
|
||||||
SELECT
|
|
||||||
car_fault_condition.*
|
|
||||||
FROM
|
|
||||||
car_fault_condition
|
|
||||||
where
|
|
||||||
car_fault_condition.car_type_id=#{carTypeId}
|
|
||||||
and car_fault_condition.message_type_id=#{messageTypeId}
|
|
||||||
|
|
||||||
</select>
|
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
|
|
@ -1,45 +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.server.mapper.FaultLogMapper">
|
|
||||||
<resultMap id="FaultCodeLogResult" type="com.muyu.domain.FaultLog">
|
|
||||||
<id property="logId" column="log_id"></id>
|
|
||||||
<result property="faultcodeId" column="faultcode_id"></result>
|
|
||||||
<result property="carInformationId" column="car_information_id"></result>
|
|
||||||
<result property="carVin" column="car_vin"></result>
|
|
||||||
<result property="startwarningTime" column="startwarning_time"></result>
|
|
||||||
<result property="endwarningTime" column="endwarning_time"></result>
|
|
||||||
<result property="carInformationVIN" column="car_information_VIN"></result>
|
|
||||||
<result property="faultcodeNumber" column="faultcode_number"></result>
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
<sql id="selectfaultloglist">
|
|
||||||
SELECT
|
|
||||||
car_fault_log.*,
|
|
||||||
car_faultcode.faultcode_number,
|
|
||||||
car_information.car_information_VIN
|
|
||||||
FROM
|
|
||||||
car_fault_log
|
|
||||||
LEFT JOIN car_faultcode ON car_fault_log.faultcode_id = car_faultcode.faultcode_id
|
|
||||||
LEFT JOIN car_information ON car_fault_log.car_information_id = car_information.car_information_id
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
<!--日志列表-->
|
|
||||||
<select id="selectfaultLogMapper" resultType="com.muyu.domain.FaultLog">
|
|
||||||
<include refid="selectfaultloglist"></include>
|
|
||||||
<where>
|
|
||||||
<if test="carVin!=null and carVin!=''">
|
|
||||||
and car_fault_log.car_vin=#{carVin}
|
|
||||||
</if>
|
|
||||||
<if test="startwarningTime!=null and startwarningTime!=''">
|
|
||||||
and car_fault_log.startwarning_time=#{startwarningTime}
|
|
||||||
</if>
|
|
||||||
<if test="endwarningTime!=null and endwarningTime!=''">
|
|
||||||
and car_fault_log.endwarning_time=#{endwarningTime}
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
limit #{pageNum},#{pageSize}
|
|
||||||
</select>
|
|
||||||
</mapper>
|
|
Loading…
Reference in New Issue