故障类型的编写
parent
2ed82cdd80
commit
5cd6840e2a
|
@ -29,10 +29,10 @@ public class SysCarFault extends BaseEntity {
|
||||||
@Schema(defaultValue = "车辆故障编码",type = "String",description = "车辆故障编码")
|
@Schema(defaultValue = "车辆故障编码",type = "String",description = "车辆故障编码")
|
||||||
private String faultCode;
|
private String faultCode;
|
||||||
/**
|
/**
|
||||||
* 车辆故障类型
|
* 车辆故障类型ID
|
||||||
*/
|
*/
|
||||||
@Schema(defaultValue = "车辆故障类型",type = "String",description = "车辆故障类型")
|
@Schema(defaultValue = "车辆故障类型ID",type = "Integer",description = "车辆故障类型ID")
|
||||||
private String faultType;
|
private Integer faultTypeId;
|
||||||
/**
|
/**
|
||||||
* 故障VIN编码
|
* 故障VIN编码
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -6,9 +6,9 @@ import com.muyu.fault.common.FaultType;
|
||||||
import com.muyu.fault.service.FaultTypeService;
|
import com.muyu.fault.service.FaultTypeService;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import java.util.List;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/type")
|
@RequestMapping("/type")
|
||||||
|
@ -22,8 +22,41 @@ public class FaultTypeController {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "faultTypeList",method = RequestMethod.GET)
|
@RequestMapping(value = "faultTypeList",method = RequestMethod.GET)
|
||||||
public Result faultTypeList(){
|
public Result<List<FaultType>> faultTypeList(@RequestBody FaultType faultType){
|
||||||
LambdaQueryWrapper<FaultType> queryWrapper = new LambdaQueryWrapper<>();
|
return Result.success(faultTypeService.faultTypeList(faultType));
|
||||||
return Result.success(faultTypeService.list(queryWrapper));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加故障类型
|
||||||
|
* @param faultType
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "insertType",method = RequestMethod.POST)
|
||||||
|
public Result insertType(@RequestBody FaultType faultType){
|
||||||
|
return Result.success(faultTypeService.save(faultType));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改故障类型
|
||||||
|
* @param faultType
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "updateType",method = RequestMethod.POST)
|
||||||
|
public Result updtaeType(@RequestBody FaultType faultType){
|
||||||
|
return Result.success(faultTypeService.updateById(faultType));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除故障类型
|
||||||
|
* @param faultTypeId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "deleteType/{faultTypeId}",method = RequestMethod.DELETE)
|
||||||
|
public Result deleteType(@PathVariable(name = "faultTypeId") Long faultTypeId){
|
||||||
|
return Result.success(faultTypeService.removeById(faultTypeId));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,5 +3,8 @@ package com.muyu.fault.service;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.muyu.fault.common.FaultType;
|
import com.muyu.fault.common.FaultType;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface FaultTypeService extends IService<FaultType> {
|
public interface FaultTypeService extends IService<FaultType> {
|
||||||
|
List<FaultType> faultTypeList(FaultType faultType);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,26 @@
|
||||||
package com.muyu.fault.service.impl;
|
package com.muyu.fault.service.impl;
|
||||||
|
|
||||||
|
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.fault.common.FaultType;
|
import com.muyu.fault.common.FaultType;
|
||||||
import com.muyu.fault.mapper.FaultTypeMapper;
|
import com.muyu.fault.mapper.FaultTypeMapper;
|
||||||
import com.muyu.fault.service.FaultTypeService;
|
import com.muyu.fault.service.FaultTypeService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class FaultTypeServiceImpl extends ServiceImpl<FaultTypeMapper, FaultType> implements FaultTypeService {
|
public class FaultTypeServiceImpl extends ServiceImpl<FaultTypeMapper, FaultType> implements FaultTypeService {
|
||||||
|
@Override
|
||||||
|
public List<FaultType> faultTypeList(FaultType faultType) {
|
||||||
|
LambdaQueryWrapper<FaultType> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
if (StringUtils.isNotEmpty(faultType.getFaultTypeName())) {
|
||||||
|
queryWrapper.like(FaultType::getFaultTypeName,faultType.getFaultTypeName());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(faultType.getFaultTypeDescription())) {
|
||||||
|
queryWrapper.like(FaultType::getFaultTypeDescription,faultType.getFaultTypeDescription());
|
||||||
|
}
|
||||||
|
return this.list(queryWrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,12 +42,10 @@ public class SysCarFaultServiceImpl
|
||||||
public List<SysCarFault> selectSysCarFaultList(SysCarFault sysCarFault)
|
public List<SysCarFault> selectSysCarFaultList(SysCarFault sysCarFault)
|
||||||
{
|
{
|
||||||
LambdaQueryWrapper<SysCarFault> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<SysCarFault> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.like(StringUtils.isNotEmpty(sysCarFault.getFaultType()),
|
queryWrapper.eq(StringUtils.isNotEmpty(String.valueOf(sysCarFault.getFaultTypeId())),
|
||||||
SysCarFault::getFaultType, sysCarFault.getFaultType());
|
SysCarFault::getFaultTypeId, sysCarFault.getFaultTypeId());
|
||||||
queryWrapper.eq(StringUtils.isNotEmpty(sysCarFault.getState()),
|
queryWrapper.eq(StringUtils.isNotEmpty(sysCarFault.getState()),
|
||||||
SysCarFault::getState, sysCarFault.getState());
|
SysCarFault::getState, sysCarFault.getState());
|
||||||
queryWrapper.eq(StringUtils.isNotEmpty(sysCarFault.getFaultType()),
|
|
||||||
SysCarFault::getFaultType, sysCarFault.getFaultType());
|
|
||||||
queryWrapper.like(StringUtils.isNotEmpty(sysCarFault.getCarVin()),
|
queryWrapper.like(StringUtils.isNotEmpty(sysCarFault.getCarVin()),
|
||||||
SysCarFault::getCarVin, sysCarFault.getCarVin());
|
SysCarFault::getCarVin, sysCarFault.getCarVin());
|
||||||
queryWrapper.eq(StringUtils.isNotEmpty(sysCarFault.getFaultWarn()),
|
queryWrapper.eq(StringUtils.isNotEmpty(sysCarFault.getFaultWarn()),
|
||||||
|
|
Loading…
Reference in New Issue