text:修改故障展示(改为双表)

master
袁子龙 2024-09-26 14:58:21 +08:00 committed by Liu Wu
parent e39c5cb11c
commit 4e4d7c2f82
3 changed files with 76 additions and 29 deletions

View File

@ -22,19 +22,15 @@ public interface SysCarFaultLogMapper extends BaseMapper<SysCarFaultLog> {
@Select("SELECT fault.fault_code,log.update_time,log.create_time,log.vin,log.status FROM sys_car_fault_log log \n" +
"LEFT JOIN sys_car_fault fault on log.sys_car_fault_id=fault.id ")
public List<SysCarFaultLog>list(SysCarFaultLog SysCarFaultLog);
@Select("SELECT fault.fault_code,log.update_time,log.create_time,log.vin,log.status FROM sys_car_fault_log log \n" +
"LEFT JOIN sys_car_fault fault on log.sys_car_fault_id=fault.id where log.status=1")
public List<SysCarFaultLog>selectSysCarFaultLogList(SysCarFaultLog SysCarFaultLog);
public List<SysCarFaultLog>listStatusSolve(SysCarFaultLog sysCarFaultLog);
@Select("SELECT fault.fault_code,log.update_time,log.create_time,log.vin,log.status FROM sys_car_fault_log log \n" +
"LEFT JOIN sys_car_fault fault on log.sys_car_fault_id=fault.id where log.status=2")
public List<SysCarFaultLog>listStatusProcess(SysCarFaultLog sysCarFaultLog);
@Select("SELECT fault.fault_code,log.update_time,log.create_time,log.vin,log.status FROM sys_car_fault_log log \n" +
"LEFT JOIN sys_car_fault fault on log.sys_car_fault_id=fault.id where log.status=3")
public List<SysCarFaultLog>listStatusIgnore(SysCarFaultLog sysCarFaultLog);
}

View File

@ -3,6 +3,7 @@ package com.muyu.breakdown.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.breakdown.domain.SysCarFault;
import com.muyu.breakdown.domain.SysCarFaultLog;
import com.muyu.breakdown.domain.SysCarFaultLog;
import com.muyu.breakdown.mapper.SysCarFaultLogMapper;
@ -31,14 +32,8 @@ public class sysCarFaultLogServiceImpl extends ServiceImpl<SysCarFaultLogMapper,
@Override
public List<SysCarFaultLog> selectSysCarFaultLogList(SysCarFaultLog sysCarFaultLog) {
LambdaQueryWrapper<SysCarFaultLog> wrapper = new LambdaQueryWrapper<>();
if (StringUtils.isNotEmpty(sysCarFaultLog.getVin())){
wrapper.eq(SysCarFaultLog::getVin,sysCarFaultLog.getVin());
}
if (sysCarFaultLog.getStatus()!=null){
wrapper.eq(SysCarFaultLog::getStatus,sysCarFaultLog.getStatus());
}
return sysCarFaultLogMapper.list(sysCarFaultLog);
return sysCarFaultLogMapper.selectSysCarFaultLogList(sysCarFaultLog);
}
/**
@ -48,10 +43,7 @@ public class sysCarFaultLogServiceImpl extends ServiceImpl<SysCarFaultLogMapper,
*/
@Override
public List<SysCarFaultLog> listStatusIgnore(SysCarFaultLog sysCarFaultLog) {
LambdaQueryWrapper<SysCarFaultLog> wrapper = new LambdaQueryWrapper<>();
if (StringUtils.isNotEmpty(sysCarFaultLog.getVin())){
wrapper.eq(SysCarFaultLog::getVin,sysCarFaultLog.getVin());
}
return sysCarFaultLogMapper.listStatusIgnore(sysCarFaultLog);
}
@ -62,20 +54,13 @@ public class sysCarFaultLogServiceImpl extends ServiceImpl<SysCarFaultLogMapper,
*/
@Override
public List<SysCarFaultLog> listStatusProcess(SysCarFaultLog sysCarFaultLog) {
LambdaQueryWrapper<SysCarFaultLog> wrapper = new LambdaQueryWrapper<>();
if (StringUtils.isNotEmpty(sysCarFaultLog.getVin())){
wrapper.eq(SysCarFaultLog::getVin,sysCarFaultLog.getVin());
}
return sysCarFaultLogMapper.listStatusProcess(sysCarFaultLog);
}
//只展示已解决的数据
@Override
public List<SysCarFaultLog> listStatusSolve(SysCarFaultLog sysCarFaultLog) {
LambdaQueryWrapper<SysCarFaultLog> wrapper = new LambdaQueryWrapper<>();
if (StringUtils.isNotEmpty(sysCarFaultLog.getVin())){
wrapper.eq(SysCarFaultLog::getVin,sysCarFaultLog.getVin());
}
return sysCarFaultLogMapper.listStatusSolve(sysCarFaultLog);
}

View File

@ -0,0 +1,66 @@
<?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.breakdown.mapper.SysCarFaultLogMapper">
<resultMap type="com.muyu.breakdown.domain.SysCarFaultLog" id="SysCarFaultLogResult">
<result property="id" column="id" />
<result property="sysCarFaultId" column="sys_car_fault_id"/>
<result property="faultCode" column="fault_code"/>
<result property="vin" column="vin"/>
<result property="status" column="status" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectSysCarFaultLogVo">
SELECT fault.fault_code,log.update_time,log.create_time,log.vin,log.status FROM sys_car_fault_log log LEFT JOIN sys_car_fault fault on log.sys_car_fault_id=fault.id
</sql>
<select id="selectSysCarFaultLogList" parameterType="com.muyu.breakdown.domain.SysCarFaultLog" resultMap="SysCarFaultLogResult">
<include refid="selectSysCarFaultLogVo"/>
<where>
<if test="faultCode != null and faultCode != ''"> and fault.fault_code = #{faultCode}</if>
<if test="vin != null and vin != ''"> and log.vin = #{vin}</if>
<if test="status != null "> and log.status = #{status}</if>
</where>
</select>
<select id="listStatusSolve" resultType="com.muyu.breakdown.domain.SysCarFaultLog" resultMap="SysCarFaultLogResult">
<include refid="selectSysCarFaultLogVo" />
<where>
<if test="faultCode!=null and faultCode!=''">and fault.fault_code=#{faultCode}</if>
<if test="vin!=null and vin!=''">and log.vin=#{vin}</if>
and log.status=1
</where>
</select>
<select id="listStatusProcess" resultType="com.muyu.breakdown.domain.SysCarFaultLog" resultMap="SysCarFaultLogResult">
<include refid="selectSysCarFaultLogVo" />
<where>
<if test="faultCode!=null and faultCode!=''">and fault.fault_code=#{faultCode}</if>
<if test="vin!=null and vin!=''">and log.vin=#{vin}</if>
and log.status=2
</where>
</select>
<select id="listStatusIgnore" resultType="com.muyu.breakdown.domain.SysCarFaultLog" resultMap="SysCarFaultLogResult">
<include refid="selectSysCarFaultLogVo" />
<where>
<if test="faultCode!=null and faultCode!=''">and fault.fault_code=#{faultCode}</if>
<if test="vin!=null and vin!=''">and log.vin=#{vin}</if>
and log.status=3
</where>
</select>
<delete id="deleteSysCarFaultByIds" parameterType="String">
delete from sys_car_fault where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>