text:修改故障码添加
parent
6de8bc74b8
commit
abe99dccce
|
@ -72,8 +72,12 @@ public class SysCarFaultController extends BaseController
|
||||||
public Result<Integer> add(
|
public Result<Integer> add(
|
||||||
@Validated @RequestBody SysCarFault sysCarFault)
|
@Validated @RequestBody SysCarFault sysCarFault)
|
||||||
{
|
{
|
||||||
|
List<SysCarFault> sysCarFaults = sysCarFaultService.selectFaultByFaultCode(sysCarFault.getFaultCode());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (sysCarFaultService.checkIdUnique(sysCarFault)) {
|
if (sysCarFaultService.checkIdUnique(sysCarFault)) {
|
||||||
return error("新增 车辆故障管理 ,失败,车辆故障码已存在");
|
return error("新增 车辆故障管理 ,失败");
|
||||||
}
|
}
|
||||||
sysCarFault.setCreateBy(SecurityUtils.getUsername());
|
sysCarFault.setCreateBy(SecurityUtils.getUsername());
|
||||||
return toAjax(sysCarFaultService.save(sysCarFault));
|
return toAjax(sysCarFaultService.save(sysCarFault));
|
||||||
|
|
|
@ -3,6 +3,9 @@ package com.muyu.breakdown.mapper;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.muyu.breakdown.domain.SysCarFault;
|
import com.muyu.breakdown.domain.SysCarFault;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ClassDescription: 车辆故障管理Mapper接口
|
* @ClassDescription: 车辆故障管理Mapper接口
|
||||||
|
@ -13,4 +16,6 @@ import org.apache.ibatis.annotations.Mapper;
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface SysCarFaultMapper extends BaseMapper<SysCarFault>{
|
public interface SysCarFaultMapper extends BaseMapper<SysCarFault>{
|
||||||
|
|
||||||
|
@Select("select fault_code from sys_car_fault where fault_code=#{}")
|
||||||
|
List<SysCarFault>selectFaultByFaultCode(String faultCode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,5 +36,8 @@ public interface SysCarFaultService extends IService<SysCarFault> {
|
||||||
Boolean checkIdUnique(SysCarFault sysCarFault);
|
Boolean checkIdUnique(SysCarFault sysCarFault);
|
||||||
|
|
||||||
|
|
||||||
|
List<SysCarFault>selectFaultByFaultCode(String faultCode);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import com.muyu.breakdown.domain.SysCarFault;
|
||||||
import com.muyu.breakdown.mapper.SysCarFaultMapper;
|
import com.muyu.breakdown.mapper.SysCarFaultMapper;
|
||||||
import com.muyu.breakdown.service.SysCarFaultService;
|
import com.muyu.breakdown.service.SysCarFaultService;
|
||||||
import com.muyu.common.core.utils.StringUtils;
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
|
@ -22,6 +23,9 @@ public class SysCarFaultServiceImpl
|
||||||
extends ServiceImpl<SysCarFaultMapper, SysCarFault>
|
extends ServiceImpl<SysCarFaultMapper, SysCarFault>
|
||||||
implements SysCarFaultService {
|
implements SysCarFaultService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysCarFaultMapper mapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 精确查询车辆故障管理
|
* 精确查询车辆故障管理
|
||||||
*
|
*
|
||||||
|
@ -72,10 +76,14 @@ public class SysCarFaultServiceImpl
|
||||||
public Boolean checkIdUnique(SysCarFault sysCarFault) {
|
public Boolean checkIdUnique(SysCarFault sysCarFault) {
|
||||||
LambdaQueryWrapper<SysCarFault> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<SysCarFault> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.eq(SysCarFault::getId, sysCarFault.getId());
|
queryWrapper.eq(SysCarFault::getId, sysCarFault.getId());
|
||||||
queryWrapper.eq(SysCarFault::getFaultCode,sysCarFault.getFaultCode());
|
|
||||||
return this.count(queryWrapper) == 0;
|
return this.count(queryWrapper) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SysCarFault> selectFaultByFaultCode(String faultCode) {
|
||||||
|
return mapper.selectFaultByFaultCode(faultCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue