修改故障码信息
parent
5308c1a566
commit
38bd0be5aa
|
@ -53,5 +53,8 @@ public class FaultCodeController {
|
|||
Result<String> result=faultCodeService.addFaultCode(faultCode);
|
||||
return result;
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public Result updateFaultCode(@RequestBody FaultCode faultCode){
|
||||
return faultCodeService.updateFaultCode(faultCode);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ package com.february.fault.controller;
|
|||
|
||||
import com.february.common.core.domain.R;
|
||||
import com.february.common.core.domain.Result;
|
||||
import com.february.fault.aspect.WebLog;
|
||||
import com.february.fault.domain.FaultCode;
|
||||
import com.february.fault.domain.FaultLog;
|
||||
import com.february.fault.service.FaultLogService;
|
||||
|
@ -33,11 +34,28 @@ public class FaultLogController {
|
|||
private FaultLogService faultLogService;
|
||||
@Autowired
|
||||
private HttpServletRequest request;
|
||||
|
||||
/**
|
||||
* 故障日志列表
|
||||
* @param faultLog
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
@WebLog(description = "故障日志列表")
|
||||
public Result<List<FaultLog>> faultLogList(@RequestBody FaultLog faultLog){
|
||||
log.info("功能名称:故障日志列表,请求路径:{},请求方式:{}",request.getRequestURI(),request.getMethod());
|
||||
Result<List<FaultLog>> result=faultLogService.faultLogList(faultLog);
|
||||
log.info("响应结果:{}",result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增故障日志
|
||||
* @param faultLog
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
@WebLog(description = "新增故障日志")
|
||||
public Result addFaultLog(@RequestBody FaultLog faultLog){
|
||||
return faultLogService.addFaultLog(faultLog);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,4 +18,6 @@ public interface FaultCodeService extends IService<FaultCode> {
|
|||
|
||||
|
||||
Result<String> addFaultCode(FaultCode faultCode);
|
||||
|
||||
Result updateFaultCode(FaultCode faultCode);
|
||||
}
|
||||
|
|
|
@ -14,4 +14,6 @@ import java.util.List;
|
|||
**/
|
||||
public interface FaultLogService extends IService<FaultLog> {
|
||||
Result<List<FaultLog>> faultLogList(FaultLog faultLog);
|
||||
|
||||
Result addFaultLog(FaultLog faultLog);
|
||||
}
|
||||
|
|
|
@ -49,6 +49,11 @@ public class FaultCodeServiceImpl extends ServiceImpl<FaultCodeMapper, FaultCode
|
|||
return Result.success(records,"列表展示成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加车辆故障码
|
||||
* @param faultCode
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Result<String> addFaultCode(FaultCode faultCode) {
|
||||
int insert = faultCodeMapper.insert(faultCode);
|
||||
|
@ -58,5 +63,22 @@ public class FaultCodeServiceImpl extends ServiceImpl<FaultCodeMapper, FaultCode
|
|||
return Result.error("添加失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改车辆故障码信息
|
||||
* @param faultCode
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Result updateFaultCode(FaultCode faultCode) {
|
||||
QueryWrapper<FaultCode> faultCodeQueryWrapper = new QueryWrapper<>();
|
||||
faultCodeQueryWrapper.eq("fault_code_id", faultCode.getFaultCodeId());
|
||||
int update = faultCodeMapper.update(faultCode, faultCodeQueryWrapper);
|
||||
FaultCode faultCode1 = faultCodeMapper.selectOne(faultCodeQueryWrapper);
|
||||
if(update>0){
|
||||
return Result.success(faultCode1,"修改成功");
|
||||
}
|
||||
return Result.error(faultCode1,"修改失败");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,13 +1,19 @@
|
|||
package com.february.fault.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.february.common.core.domain.Result;
|
||||
import com.february.fault.domain.FaultLog;
|
||||
import com.february.fault.mapper.FaultLogMapper;
|
||||
import com.february.fault.service.FaultLogService;
|
||||
import com.february.fault.utils.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @program: february-fault-information
|
||||
|
@ -17,9 +23,34 @@ import java.util.List;
|
|||
**/
|
||||
@Service
|
||||
public class FaultLogServiceImpl extends ServiceImpl<FaultLogMapper, FaultLog> implements FaultLogService {
|
||||
@Autowired
|
||||
private FaultLogMapper faultLogMapper;
|
||||
@Override
|
||||
public Result<List<FaultLog>> faultLogList(FaultLog faultLog) {
|
||||
QueryWrapper<FaultLog> faultLogQueryWrapper = new QueryWrapper<>();
|
||||
if(!Objects.equals(faultLog.getFaultBh(), "") && faultLog.getFaultBh()!=null){
|
||||
faultLogQueryWrapper.eq("fault_bh",faultLog.getFaultBh());
|
||||
}
|
||||
if(!Objects.equals(faultLog.getCarVin(), "") && faultLog.getCarVin()!=null){
|
||||
faultLogQueryWrapper.eq("car_vin",faultLog.getCarVin());
|
||||
}
|
||||
if(!StringUtils.isNull(faultLog.getFaultStartTime())){
|
||||
faultLogQueryWrapper.ge("fault_start_time",faultLog.getFaultStartTime());
|
||||
}
|
||||
if(!StringUtils.isNull(faultLog.getFaultEndTime())){
|
||||
faultLogQueryWrapper.le("fault_end_time",faultLog.getFaultEndTime());
|
||||
}
|
||||
Page<FaultLog> faultLogPage = new Page<>(1,2);
|
||||
List<FaultLog> records = faultLogMapper.selectPage(faultLogPage, faultLogQueryWrapper).getRecords();
|
||||
return Result.success(records,"故障日志列表");
|
||||
}
|
||||
|
||||
return null;
|
||||
@Override
|
||||
public Result addFaultLog(FaultLog faultLog) {
|
||||
int insert = faultLogMapper.insert(faultLog);
|
||||
if(insert>0){
|
||||
return Result.success("添加成功");
|
||||
}
|
||||
return Result.error("添加失败");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue