故障码基本功能实现
parent
2356746be8
commit
3ff308b45c
|
@ -77,7 +77,22 @@
|
|||
<artifactId>jjwt</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- mybatis - plus 依赖 -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>3.5.3.1</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.github.jsqlparser</groupId>
|
||||
<artifactId>jsqlparser</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.mybatis</groupId>
|
||||
<artifactId>mybatis</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- Apache Lang3 -->
|
||||
<dependency>
|
||||
|
|
|
@ -11,11 +11,6 @@
|
|||
|
||||
<artifactId>muyu-business-common</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>20</maven.compiler.source>
|
||||
<maven.compiler.target>20</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
|
|
|
@ -0,0 +1,119 @@
|
|||
package com.muyu.business.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.fasterxml.jackson.annotation.*;
|
||||
import com.muyu.business.domain.req.*;
|
||||
import lombok.*;
|
||||
import lombok.experimental.*;
|
||||
import org.springframework.format.annotation.*;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 故障码对象 fault_codes
|
||||
*
|
||||
* @author Li YongJie
|
||||
* @date 2024-03-28
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName("fault_code_info")
|
||||
public class FaultCodeInfo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 故障码主键 */
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long faultId;
|
||||
|
||||
/** 故障名称 */
|
||||
private String faultName;
|
||||
|
||||
/** 故障码 */
|
||||
private String faultCode;
|
||||
|
||||
/** 故障类型:1-通讯丢失故障 2-车身故障 3-底盘故障 4-电子围栏故障 5-其他故障 */
|
||||
private Integer faultType;
|
||||
|
||||
/** 故障等级:1-高级故障 2-中级故障 3-低级故障 */
|
||||
private Integer faultLevel;
|
||||
|
||||
/** 是否产生报警(Y正常 N报警) */
|
||||
private String alarmFlag;
|
||||
|
||||
/** 故障描述 */
|
||||
private String faultDesc;
|
||||
|
||||
/** 故障位 */
|
||||
private Integer faultLocation;
|
||||
|
||||
/** 故障值 */
|
||||
private Long faultValue;
|
||||
|
||||
/** 故障码状态(0正常 1停用) */
|
||||
private String status;
|
||||
|
||||
/** 删除标志(0存在 2删除) */
|
||||
private String delFlag;
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
private String createBy;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
/**
|
||||
* 更新者
|
||||
*/
|
||||
private String updateBy;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
public static FaultCodeInfo addFaultCodesReq(FaultCodesAddReq faultCodes) {
|
||||
return FaultCodeInfo.builder()
|
||||
.faultName(faultCodes.getFaultName())
|
||||
.faultCode(faultCodes.getFaultCode())
|
||||
.faultType(faultCodes.getFaultType())
|
||||
.faultLevel(faultCodes.getFaultLevel())
|
||||
.alarmFlag(faultCodes.getAlarmFlag())
|
||||
.faultDesc(faultCodes.getFaultDesc())
|
||||
.faultLocation(faultCodes.getFaultLocation())
|
||||
.faultValue(faultCodes.getFaultValue())
|
||||
.status(faultCodes.getStatus())
|
||||
.delFlag(faultCodes.getDelFlag())
|
||||
.createBy(faultCodes.getCreateBy())
|
||||
.createTime(faultCodes.getCreateTime())
|
||||
.build();
|
||||
}
|
||||
|
||||
public static FaultCodeInfo updFaultCodesReq(FaultCodesUpdReq faultCodes) {
|
||||
return FaultCodeInfo.builder()
|
||||
.faultId(faultCodes.getFaultId())
|
||||
.faultName(faultCodes.getFaultName())
|
||||
.faultCode(faultCodes.getFaultCode())
|
||||
.faultType(faultCodes.getFaultType())
|
||||
.faultLevel(faultCodes.getFaultLevel())
|
||||
.alarmFlag(faultCodes.getAlarmFlag())
|
||||
.faultDesc(faultCodes.getFaultDesc())
|
||||
.faultLocation(faultCodes.getFaultLocation())
|
||||
.faultValue(faultCodes.getFaultValue())
|
||||
.status(faultCodes.getStatus())
|
||||
.delFlag(faultCodes.getDelFlag())
|
||||
.updateBy(faultCodes.getUpdateBy())
|
||||
.updateTime(faultCodes.getUpdateTime())
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.muyu.business.domain.req;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.*;
|
||||
import com.baomidou.mybatisplus.core.conditions.segments.*;
|
||||
import com.muyu.business.domain.*;
|
||||
import lombok.*;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
/**
|
||||
* 查询故障码对象
|
||||
* @Author LiYonJie
|
||||
* @Date 2024/3/28
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class FaultCodeReq implements Serializable {
|
||||
/** 故障名称 */
|
||||
private String faultName;
|
||||
|
||||
/** 故障码 */
|
||||
private String faultCode;
|
||||
|
||||
/** 是否产生报警(Y正常 N报警) */
|
||||
private String alarmFlag;
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package com.muyu.business.domain.req;
|
||||
|
||||
import com.fasterxml.jackson.annotation.*;
|
||||
import lombok.*;
|
||||
import org.springframework.format.annotation.*;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 新增故障码对象
|
||||
* @author LiYonJie
|
||||
* @date 2024/3/28
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class FaultCodesAddReq implements Serializable {
|
||||
/** 故障名称 */
|
||||
@NotBlank(message = "故障名称不能为空")
|
||||
private String faultName;
|
||||
|
||||
/** 故障码 */
|
||||
@NotBlank(message = "故障码不能为空")
|
||||
private String faultCode;
|
||||
|
||||
/** 故障类型:1-通讯丢失故障 2-车身故障 3-底盘故障 4-电子围栏故障 5-其他故障 */
|
||||
@NotNull(message = "故障类型不能为空")
|
||||
private Integer faultType;
|
||||
|
||||
/** 故障等级:1-高级故障 2-中级故障 3-低级故障 */
|
||||
@NotNull(message = "故障等级不能为空")
|
||||
private Integer faultLevel;
|
||||
|
||||
/** 是否产生报警(Y正常 N报警) */
|
||||
private String alarmFlag;
|
||||
|
||||
/** 故障描述 */
|
||||
@NotBlank(message = "故障描述不能为空")
|
||||
private String faultDesc;
|
||||
|
||||
/** 故障位 */
|
||||
@NotNull(message = "故障位不能为空")
|
||||
private Integer faultLocation;
|
||||
|
||||
/** 故障值 */
|
||||
@NotNull(message = "故障值不能为空")
|
||||
private Long faultValue;
|
||||
|
||||
/** 故障码状态(0正常 1停用) */
|
||||
private String status;
|
||||
|
||||
/** 删除标志(0存在 2删除) */
|
||||
private String delFlag;
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
private String createBy;
|
||||
/*
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
package com.muyu.business.domain.req;
|
||||
|
||||
import com.fasterxml.jackson.annotation.*;
|
||||
import lombok.*;
|
||||
import org.springframework.format.annotation.*;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 编辑故障码对象
|
||||
* @author LiYonJie
|
||||
* @date 2024/3/28
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class FaultCodesUpdReq implements Serializable {
|
||||
/** 故障码主键 */
|
||||
private Long faultId;
|
||||
|
||||
/** 故障名称 */
|
||||
@NotBlank(message = "故障名称不能为空")
|
||||
private String faultName;
|
||||
|
||||
/** 故障码 */
|
||||
@NotBlank(message = "故障码不能为空")
|
||||
private String faultCode;
|
||||
|
||||
/** 故障类型:1-通讯丢失故障 2-车身故障 3-底盘故障 4-电子围栏故障 5-其他故障 */
|
||||
@NotNull(message = "故障类型不能为空")
|
||||
private Integer faultType;
|
||||
|
||||
/** 故障等级:1-高级故障 2-中级故障 3-低级故障 */
|
||||
@NotNull(message = "故障等级不能为空")
|
||||
private Integer faultLevel;
|
||||
|
||||
/** 是否产生报警(Y正常 N报警) */
|
||||
private String alarmFlag;
|
||||
|
||||
/** 故障描述 */
|
||||
@NotBlank(message = "故障描述不能为空")
|
||||
private String faultDesc;
|
||||
|
||||
/** 故障位 */
|
||||
@NotNull(message = "故障位不能为空")
|
||||
private Integer faultLocation;
|
||||
|
||||
/** 故障值 */
|
||||
@NotNull(message = "故障值不能为空")
|
||||
private Long faultValue;
|
||||
|
||||
/** 故障码状态(0正常 1停用) */
|
||||
private String status;
|
||||
|
||||
/** 删除标志(0存在 2删除) */
|
||||
private String delFlag;
|
||||
/**
|
||||
* 更新者
|
||||
*/
|
||||
private String updateBy;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package com.muyu.business.domain.res;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.muyu.business.domain.*;
|
||||
import lombok.*;
|
||||
import lombok.experimental.*;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
/**
|
||||
* 故障码响应类
|
||||
*
|
||||
* @Author LiYonJie
|
||||
* @Date 2024/3/29
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
public class FaultCodeResponse implements Serializable {
|
||||
/** 故障码主键 */
|
||||
private Long faultId;
|
||||
|
||||
/** 故障名称 */
|
||||
private String faultName;
|
||||
|
||||
/** 故障码 */
|
||||
private String faultCode;
|
||||
|
||||
/** 故障类型:1-通讯丢失故障 2-车身故障 3-底盘故障 4-电子围栏故障 5-其他故障 */
|
||||
private Integer faultType;
|
||||
|
||||
/** 故障等级:1-高级故障 2-中级故障 3-低级故障 */
|
||||
private Integer faultLevel;
|
||||
|
||||
/** 是否产生报警(0正常 1报警) */
|
||||
private String alarmFlag;
|
||||
|
||||
/** 故障描述 */
|
||||
private String faultDesc;
|
||||
|
||||
/** 故障位 */
|
||||
private Integer faultLocation;
|
||||
|
||||
/** 故障值 */
|
||||
private Long faultValue;
|
||||
|
||||
/** 故障码状态(0正常 1停用) */
|
||||
private String status;
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
package com.muyu.business.controller;
|
||||
|
||||
import com.muyu.business.domain.*;
|
||||
import com.muyu.business.domain.req.*;
|
||||
import com.muyu.business.domain.res.*;
|
||||
import com.muyu.business.service.*;
|
||||
import com.muyu.common.core.domain.*;
|
||||
import com.muyu.common.core.web.controller.*;
|
||||
import com.muyu.common.core.web.page.*;
|
||||
import com.muyu.common.log.annotation.*;
|
||||
import com.muyu.common.log.enums.*;
|
||||
import com.muyu.common.security.annotation.*;
|
||||
import org.springframework.beans.factory.annotation.*;
|
||||
import org.springframework.validation.annotation.*;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 故障码Controller
|
||||
*
|
||||
* @author Li YongJie
|
||||
* @date 2024-03-28
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/faultCodes")
|
||||
public class FaultCodesController extends BaseController {
|
||||
|
||||
/**
|
||||
* 注入故障码Service
|
||||
*/
|
||||
@Autowired
|
||||
private FaultCodesService faultCodesService;
|
||||
|
||||
/**
|
||||
* 查询故障码列表
|
||||
*/
|
||||
@RequiresPermissions("business:faultCodes:list")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo> list(FaultCodeReq faultCodes) {
|
||||
startPage();
|
||||
List<FaultCodeInfo> list = faultCodesService.selectFaultCodesList(faultCodes);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增故障码
|
||||
*/
|
||||
@RequiresPermissions("business:faultCodes:add")
|
||||
@Log(title = "故障码", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add(@RequestBody @Validated FaultCodesAddReq faultCodesAddReq) {
|
||||
return toAjax(faultCodesService.insertFaultCodes(FaultCodeInfo.addFaultCodesReq(faultCodesAddReq)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取故障码详细信息
|
||||
*/
|
||||
@RequiresPermissions("business:faultCodes:query")
|
||||
@GetMapping(value = "/{faultId}")
|
||||
public Result getInfo(@PathVariable("faultId") Long faultId) {
|
||||
return success(faultCodesService.selectFaultCodesByFaultId(faultId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改故障码
|
||||
*/
|
||||
@RequiresPermissions("business:faultCodes:edit")
|
||||
@Log(title = "故障码", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result edit(@RequestBody @Validated FaultCodesUpdReq faultCodesUpdReq) {
|
||||
return toAjax(faultCodesService.updateFaultCodesStatus(FaultCodeInfo.updFaultCodesReq(faultCodesUpdReq)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改故障码状态
|
||||
*/
|
||||
@RequiresPermissions("business:faultCodes:edit")
|
||||
@Log(title = "故障码", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/changeStatus")
|
||||
public Result changeStatus(@RequestBody FaultCodesUpdReq faultCodesUpdReq) {
|
||||
return toAjax(faultCodesService.updateFaultCodes(FaultCodeInfo.updFaultCodesReq(faultCodesUpdReq)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除故障码
|
||||
*/
|
||||
@RequiresPermissions("business:faultCodes:remove")
|
||||
@Log(title = "故障码", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{faultIds}")
|
||||
public Result remove(@PathVariable Long[] faultIds) {
|
||||
return toAjax(faultCodesService.deleteFaultCodesByFaultIds(faultIds));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
package com.muyu.business.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.*;
|
||||
import com.muyu.business.domain.*;
|
||||
import com.muyu.business.domain.req.*;
|
||||
import com.muyu.business.domain.res.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 故障码Mapper接口
|
||||
*
|
||||
* @author Li YongJie
|
||||
* @date 2024-03-28
|
||||
*/
|
||||
public interface FaultCodesMapper extends BaseMapper<FaultCodeInfo> {
|
||||
|
||||
/**
|
||||
* 查询故障码列表
|
||||
*
|
||||
* @param faultCodeReq 故障码
|
||||
* @return 故障码集合
|
||||
*/
|
||||
// public List<FaultCodeResponse> selectFaultCodesList(FaultCodeReq faultCodeReq);
|
||||
|
||||
/**
|
||||
* 新增故障码
|
||||
*
|
||||
* @param faultCodes 故障码
|
||||
* @return 结果
|
||||
*/
|
||||
// public int insertFaultCodes(FaultCodeInfo faultCodes);
|
||||
|
||||
/**
|
||||
* 查询故障码
|
||||
*
|
||||
* @param faultId 故障码主键
|
||||
* @return 故障码
|
||||
*/
|
||||
// public FaultCodeInfo selectFaultCodesByFaultId(Long faultId);
|
||||
|
||||
/**
|
||||
* 修改故障码
|
||||
*
|
||||
* @param faultCodes 故障码
|
||||
* @return 结果
|
||||
*/
|
||||
// public int updateFaultCodes(FaultCodeInfo faultCodes);
|
||||
|
||||
/**
|
||||
* 删除故障码
|
||||
*
|
||||
* @param faultId 故障码主键
|
||||
* @return 结果
|
||||
*/
|
||||
// public int deleteFaultCodesByFaultId(Long faultId);
|
||||
|
||||
/**
|
||||
* 批量删除故障码
|
||||
*
|
||||
* @param faultIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
// public int deleteFaultCodesByFaultIds(Long[] faultIds);
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
package com.muyu.business.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.*;
|
||||
import com.muyu.business.domain.*;
|
||||
import com.muyu.business.domain.req.*;
|
||||
import com.muyu.business.domain.res.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 故障码Service接口
|
||||
*
|
||||
* @author Li YongJie
|
||||
* @date 2024-03-28
|
||||
*/
|
||||
public interface FaultCodesService extends IService<FaultCodeInfo> {
|
||||
/**
|
||||
* 查询故障码列表
|
||||
*
|
||||
* @param faultCodes 故障码
|
||||
* @return 故障码集合
|
||||
*/
|
||||
public List<FaultCodeInfo> selectFaultCodesList(FaultCodeReq faultCodes);
|
||||
|
||||
/**
|
||||
* 新增故障码
|
||||
*
|
||||
* @param faultCodes 故障码
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertFaultCodes(FaultCodeInfo faultCodes);
|
||||
|
||||
/**
|
||||
* 故障码详情
|
||||
*
|
||||
* @param faultId 故障码主键
|
||||
* @return 故障码
|
||||
*/
|
||||
public FaultCodeInfo selectFaultCodesByFaultId(Long faultId);
|
||||
|
||||
/**
|
||||
* 修改故障码
|
||||
*
|
||||
* @param faultCodes 故障码
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateFaultCodes(FaultCodeInfo faultCodes);
|
||||
|
||||
/**
|
||||
* 删除故障码信息
|
||||
*
|
||||
* @param faultId 故障码主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteFaultCodesByFaultId(Long faultId);
|
||||
|
||||
/**
|
||||
* 批量删除故障码
|
||||
*
|
||||
* @param faultIds 需要删除的故障码主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteFaultCodesByFaultIds(Long[] faultIds);
|
||||
|
||||
/**
|
||||
* 修改故障码状态
|
||||
*
|
||||
* @param faultCodeInfo
|
||||
* @return
|
||||
*/
|
||||
int updateFaultCodesStatus(FaultCodeInfo faultCodeInfo);
|
||||
}
|
|
@ -0,0 +1,119 @@
|
|||
package com.muyu.business.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.*;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.*;
|
||||
import com.muyu.business.domain.*;
|
||||
import com.muyu.business.domain.req.*;
|
||||
import com.muyu.business.domain.res.*;
|
||||
import com.muyu.business.mapper.*;
|
||||
import com.muyu.business.service.*;
|
||||
import com.muyu.common.core.utils.*;
|
||||
import com.muyu.common.security.utils.*;
|
||||
import org.springframework.beans.factory.annotation.*;
|
||||
import org.springframework.stereotype.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 故障码Service业务层处理
|
||||
*
|
||||
* @author Li YongJie
|
||||
* @date 2024-03-28
|
||||
*/
|
||||
@Service
|
||||
public class FaultCodesServiceImpl extends ServiceImpl<FaultCodesMapper, FaultCodeInfo>
|
||||
implements FaultCodesService {
|
||||
|
||||
/**
|
||||
* 注入故障码Mapper
|
||||
*/
|
||||
@Autowired
|
||||
private FaultCodesMapper faultCodesMapper;
|
||||
|
||||
/**
|
||||
* 查询故障码列表
|
||||
*
|
||||
* @param faultCodeReq 故障码查询对象
|
||||
* @return 故障码
|
||||
*/
|
||||
@Override
|
||||
public List<FaultCodeInfo> selectFaultCodesList(FaultCodeReq faultCodeReq) {
|
||||
LambdaQueryWrapper<FaultCodeInfo> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.like(StringUtils.isNotEmpty(faultCodeReq.getFaultName()),FaultCodeInfo::getFaultName, faultCodeReq.getFaultName());
|
||||
wrapper.eq(StringUtils.isNotNull(faultCodeReq.getFaultCode()),FaultCodeInfo::getFaultCode, faultCodeReq.getFaultCode());
|
||||
wrapper.eq(StringUtils.isNotEmpty(faultCodeReq.getAlarmFlag()),FaultCodeInfo::getAlarmFlag, faultCodeReq.getAlarmFlag());
|
||||
return faultCodesMapper.selectList(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增故障码
|
||||
*
|
||||
* @param faultCodes 故障码
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertFaultCodes(FaultCodeInfo faultCodes) {
|
||||
faultCodes.setCreateBy(SecurityUtils.getUsername());
|
||||
faultCodes.setCreateTime(DateUtils.getNowDate());
|
||||
return faultCodesMapper.insert(faultCodes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 故障码详情
|
||||
*
|
||||
* @param faultId 故障码主键
|
||||
* @return 故障码
|
||||
*/
|
||||
@Override
|
||||
public FaultCodeInfo selectFaultCodesByFaultId(Long faultId) {
|
||||
return faultCodesMapper.selectById(faultId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改故障码
|
||||
*
|
||||
* @param faultCodes 故障码
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateFaultCodes(FaultCodeInfo faultCodes) {
|
||||
faultCodes.setUpdateBy(SecurityUtils.getUsername());
|
||||
faultCodes.setUpdateTime(DateUtils.getNowDate());
|
||||
return faultCodesMapper.updateById(faultCodes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除故障码信息
|
||||
*
|
||||
* @param faultId 故障码主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteFaultCodesByFaultId(Long faultId) {
|
||||
return faultCodesMapper.deleteById(faultId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除故障码
|
||||
*
|
||||
* @param faultIds 需要删除的故障码主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteFaultCodesByFaultIds(Long[] faultIds) {
|
||||
return faultCodesMapper.deleteBatchIds(Arrays.asList(faultIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改故障码状态
|
||||
*
|
||||
* @param faultCodeInfo 故障码
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int updateFaultCodesStatus(FaultCodeInfo faultCodeInfo) {
|
||||
faultCodeInfo.setUpdateBy(SecurityUtils.getUsername());
|
||||
faultCodeInfo.setUpdateTime(DateUtils.getNowDate());
|
||||
return faultCodesMapper.updateById(faultCodeInfo);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
<?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">
|
||||
<!-- mybatis数据层 namespace命名空间-->
|
||||
<mapper namespace="com.muyu.business.mapper.FaultCodesMapper">
|
||||
<!-- <resultMap type="com.muyu.business.domain.FaultCodeInfo" id="FaultCodeInfoResult">-->
|
||||
<!-- <result property="faultId" column="fault_id" />-->
|
||||
<!-- <result property="faultName" column="fault_name" />-->
|
||||
<!-- <result property="faultCode" column="fault_code" />-->
|
||||
<!-- <result property="faultType" column="fault_type" />-->
|
||||
<!-- <result property="faultLevel" column="fault_level" />-->
|
||||
<!-- <result property="alarmFlag" column="alarm_flag" />-->
|
||||
<!-- <result property="faultDesc" column="fault_desc" />-->
|
||||
<!-- <result property="faultLocation" column="fault_location" />-->
|
||||
<!-- <result property="faultValue" column="fault_value" />-->
|
||||
<!-- <result property="status" column="status" />-->
|
||||
<!-- <result property="delFlag" column="del_flag" />-->
|
||||
<!-- <result property="createBy" column="create_by" />-->
|
||||
<!-- <result property="createTime" column="create_time" />-->
|
||||
<!-- <result property="updateBy" column="update_by" />-->
|
||||
<!-- <result property="updateTime" column="update_time" />-->
|
||||
<!-- <result property="remark" column="remark" />-->
|
||||
<!-- </resultMap>-->
|
||||
|
||||
<!-- <sql id="selectFaultCodeInfoVo">-->
|
||||
<!-- select fault_id, fault_name, fault_code, fault_type, fault_level, alarm_flag, fault_desc, fault_location, fault_value, status, del_flag, create_by, create_time, update_by, update_time, remark from fault_code_info-->
|
||||
<!-- </sql>-->
|
||||
|
||||
<!-- <select id="selectFaultCodesList" parameterType="com.muyu.business.domain.FaultCodeInfo" resultMap="FaultCodeInfoResult">-->
|
||||
<!-- <include refid="selectFaultCodeInfoVo"/>-->
|
||||
<!-- <where>-->
|
||||
<!-- <if test="faultName != null and faultName != ''"> and fault_name like concat('%', #{faultName}, '%')</if>-->
|
||||
<!-- <if test="faultCode != null"> and fault_code = #{faultCode}</if>-->
|
||||
<!-- <if test="alarmFlag != null"> and alarm_flag = #{alarmFlag}</if>-->
|
||||
<!-- </where>-->
|
||||
<!-- </select>-->
|
||||
</mapper>
|
|
@ -0,0 +1,27 @@
|
|||
-- 故障码管理
|
||||
-- 故障码信息表
|
||||
drop table if exists fault_code_info;
|
||||
create table fault_code_info(
|
||||
fault_id int(11) comment '故障码主键' primary key auto_increment,
|
||||
fault_name varchar(32) comment '故障名称',
|
||||
fault_code varchar(32) comment '故障码',
|
||||
fault_type tinyint(4) comment '故障类型:1-通讯丢失故障 2-车身故障 3-底盘故障 4-电子围栏故障 5-其他故障',
|
||||
fault_level tinyint(4) comment '故障等级:1-高级故障 2-中级故障 3-低级故障',
|
||||
alarm_flag char(1) default 'Y' comment '是否产生报警(Y正常 N报警)',
|
||||
fault_desc varchar(100) comment '故障描述',
|
||||
fault_location tinyint(4) comment '故障位置',
|
||||
fault_value bigint(20) comment '故障值',
|
||||
status char(1) default '0' comment '故障码状态(0正常 1停用)',
|
||||
del_flag char(1) default '0' comment '删除标志(0存在 2删除)',
|
||||
create_by varchar(64) default '' comment '创建者',
|
||||
create_time datetime comment '创建时间',
|
||||
update_by varchar(64) default '' comment '更新者',
|
||||
update_time datetime comment '更新时间',
|
||||
remark varchar(200) comment '备注'
|
||||
) engine=innodb auto_increment=200 comment = '故障码表';
|
||||
insert into fault_code_info(fault_name, fault_code, fault_type, fault_level, alarm_flag, fault_desc, fault_location, fault_value, status, del_flag, create_by, create_time, remark) values ('通讯丢失故障', '0001', 1, 1, '0', '通讯丢失故障', '车辆', 0, '0', '0', 'admin', now(), '通讯丢失故障');
|
||||
insert into fault_code_info(fault_name, fault_code, fault_type, fault_level, alarm_flag, fault_desc, fault_location, fault_value, status, del_flag, create_by, create_time, remark) values ('车身故障', '0002', 2, 1, '0', '车身故障', '车辆', 0, '0', '0', 'admin', now(), '车身故障');
|
||||
insert into fault_code_info(fault_name, fault_code, fault_type, fault_level, alarm_flag, fault_desc, fault_location, fault_value, status, del_flag, create_by, create_time, remark) values ('底盘故障', '0003', 3, 1, '0', '底盘故障', '车辆', 0, '0', '0', 'admin', now(),'底盘故障');
|
||||
insert into fault_code_info(fault_name, fault_code, fault_type, fault_level, alarm_flag, fault_desc, fault_location, fault_value, status, del_flag, create_by, create_time, remark) values ('电子围栏故障', '0004', 4, 1, '0', '电子围栏故障', '车辆', 0, '0', '0', 'admin', now(),'电子围栏故障');
|
||||
insert into fault_code_info(fault_name, fault_code, fault_type, fault_level, alarm_flag, fault_desc, fault_location, fault_value, status, del_flag, create_by, create_time, remark) values ('其他故障', '0005', 5, 1, '0', '其他故障', '车辆', 0, '0', '0', 'admin', now(), '其他故障');
|
||||
select fault_id,fault_name, fault_code, fault_type, fault_level, alarm_flag, fault_desc, fault_location, fault_value, status, del_flag from fault_code_info;
|
Loading…
Reference in New Issue