基本增删查操作
parent
b19c6492fc
commit
bc6545dc21
|
@ -1,12 +1,9 @@
|
|||
package com.february.fault.constants;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @description: 系统常量
|
||||
* @author DongZl
|
||||
*/
|
||||
@Data
|
||||
public class Constants {
|
||||
/**
|
||||
* 成功标记
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
package com.february.fault.constants;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author DongZl
|
||||
* @description: Jwt常量
|
||||
*/
|
||||
@Data
|
||||
public class JwtConstants {
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
package com.february.fault.constants;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author DongZl
|
||||
* @description: 令牌常量
|
||||
*/
|
||||
@Data
|
||||
public class TokenConstants {
|
||||
/**
|
||||
* 缓存有效期,默认720(分钟)
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
package com.february.fault.domain;
|
||||
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @program: february-fault-information
|
||||
* @description: 车辆故障告警表
|
||||
* @author: Mr.Wang
|
||||
* @create: 2023-11-20 09:12
|
||||
**/
|
||||
|
||||
/**
|
||||
* 车辆故障告警表
|
||||
*/
|
||||
@Data
|
||||
public class FaultAlarm {
|
||||
/**
|
||||
* 车辆故障告警id
|
||||
*/
|
||||
private Integer faultAlarmId;
|
||||
/**
|
||||
* 车牌号
|
||||
*/
|
||||
private String carBh;
|
||||
/**
|
||||
* vin码
|
||||
*/
|
||||
private String carVin;
|
||||
/**
|
||||
* 车辆公共型号
|
||||
*/
|
||||
private String faultAlarmType;
|
||||
/**
|
||||
* 故障名称
|
||||
*/
|
||||
private String faultName;
|
||||
/**
|
||||
* 故障码
|
||||
*/
|
||||
private String faultBh;
|
||||
/**
|
||||
* 响应级别
|
||||
*/
|
||||
private String responseLevel;
|
||||
/**
|
||||
* 报警状态
|
||||
*/
|
||||
private Integer alarmState;
|
||||
/**
|
||||
* 处理方式
|
||||
*/
|
||||
private Integer handStyle;
|
||||
/**
|
||||
* 开启告警时间
|
||||
*/
|
||||
private Date alarmStartTime;
|
||||
/**
|
||||
* 最近告警时间
|
||||
*/
|
||||
private Date alarmNearTime;
|
||||
/**
|
||||
* 结束告警时间
|
||||
*/
|
||||
private Date alarmEndTime;
|
||||
/**
|
||||
* 管理人id
|
||||
*/
|
||||
private Integer adminId;
|
||||
/**
|
||||
* 处理人
|
||||
*/
|
||||
private String faultProcessor;
|
||||
/**
|
||||
* 处理时间
|
||||
*/
|
||||
private Date processTime;
|
||||
/**
|
||||
* 警告状态
|
||||
*/
|
||||
private Integer faultAlarmState;
|
||||
}
|
|
@ -28,12 +28,6 @@
|
|||
<version>3.6.3</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- RuoYi Common Log -->
|
||||
<dependency>
|
||||
<groupId>com.february</groupId>
|
||||
<artifactId>february-common-log</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
<!-- RuoYi Common DataScope -->
|
||||
<dependency>
|
||||
<groupId>com.february</groupId>
|
||||
|
@ -46,7 +40,11 @@
|
|||
<artifactId>february-common-datasource</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.february</groupId>
|
||||
<artifactId>february-fault-common</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
|
|
|
@ -18,6 +18,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||
@SpringBootApplication
|
||||
public class FaultApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(FaultApplication.class,args);
|
||||
SpringApplication.run(FaultApplication.class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
package com.february.fault.controller;
|
||||
|
||||
import com.february.common.redis.service.RedisService;
|
||||
import com.february.fault.domain.Fault;
|
||||
import com.february.fault.domain.FaultAlarm;
|
||||
import com.february.fault.result.Result;
|
||||
import com.february.fault.service.FaultService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -19,8 +20,73 @@ import java.util.List;
|
|||
public class FaultController {
|
||||
@Autowired
|
||||
private FaultService faultService;
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
/**
|
||||
* 故障列表
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/faultList")
|
||||
public Result<List<Fault>> faultList(){
|
||||
return faultService.faultList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询故障
|
||||
* @param faultId
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/findFault")
|
||||
public Result<Fault> findFault(@RequestParam Integer faultId){
|
||||
return faultService.findFault(faultId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增故障列表
|
||||
* @param fault
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/addFault")
|
||||
public Result addFault(@RequestBody Fault fault){
|
||||
return faultService.addFault(fault);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除某条故障信息
|
||||
* @param faultId
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/delFault")
|
||||
public Result delFault(@RequestParam Integer faultId){
|
||||
return faultService.delFault(faultId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增故障警告信息
|
||||
* @param faultAlarm
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/addFaultAlarm")
|
||||
public Result addFaultAlarm(@RequestBody FaultAlarm faultAlarm){
|
||||
return faultService.addFaultAlarm(faultAlarm);
|
||||
}
|
||||
/**
|
||||
* 查看故障警告信息列表
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/faultAlarmList")
|
||||
public Result<List<FaultAlarm>> faultAlarmList(){
|
||||
return faultService.faultAlarmList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除单条故障警告信息
|
||||
* @param faultAlarmId
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/delFaultAlarm")
|
||||
public Result delFaultAlarm(@RequestParam Integer faultAlarmId){
|
||||
return faultService.delFaultAlarm(faultAlarmId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package com.february.fault.mapper;
|
||||
|
||||
import com.february.fault.domain.Fault;
|
||||
import com.february.fault.domain.FaultAlarm;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -14,4 +16,16 @@ import java.util.List;
|
|||
@Mapper
|
||||
public interface FaultMapper {
|
||||
List<Fault> faultList();
|
||||
|
||||
Fault findFault(@Param("faultId") Integer faultId);
|
||||
|
||||
Integer addFault(Fault fault);
|
||||
|
||||
Integer addFaultAlarm(FaultAlarm faultAlarm);
|
||||
|
||||
List<FaultAlarm> faultAlarmList();
|
||||
|
||||
Integer delFault(@Param("faultId") Integer faultId);
|
||||
|
||||
Integer delFaultAlarm(@Param("faultAlarmId") Integer faultAlarmId);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.february.fault.service;
|
||||
|
||||
import com.february.fault.domain.Fault;
|
||||
import com.february.fault.domain.FaultAlarm;
|
||||
import com.february.fault.result.Result;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
@ -15,4 +16,16 @@ import java.util.List;
|
|||
@Component
|
||||
public interface FaultService {
|
||||
Result<List<Fault>> faultList();
|
||||
|
||||
Result<Fault> findFault(Integer faultId);
|
||||
|
||||
Result addFault(Fault fault);
|
||||
|
||||
Result addFaultAlarm(FaultAlarm faultAlarm);
|
||||
|
||||
Result<List<FaultAlarm>> faultAlarmList();
|
||||
|
||||
Result delFault(Integer faultId);
|
||||
|
||||
Result delFaultAlarm(Integer faultAlarmId);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.february.fault.service.impl;
|
||||
|
||||
import com.february.fault.domain.Fault;
|
||||
import com.february.fault.domain.FaultAlarm;
|
||||
import com.february.fault.mapper.FaultMapper;
|
||||
import com.february.fault.result.Result;
|
||||
import com.february.fault.service.FaultService;
|
||||
|
@ -24,4 +25,52 @@ public class FaultServiceImpl implements FaultService {
|
|||
List<Fault> list=faultMapper.faultList();
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Fault> findFault(Integer faultId) {
|
||||
Fault fault=faultMapper.findFault(faultId);
|
||||
return Result.success(fault);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result addFault(Fault fault) {
|
||||
Integer i=faultMapper.addFault(fault);
|
||||
if(i>0){
|
||||
return Result.success("添加成功");
|
||||
}
|
||||
return Result.error("添加错误");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result addFaultAlarm(FaultAlarm faultAlarm) {
|
||||
Integer i=faultMapper.addFaultAlarm(faultAlarm);
|
||||
if(i>0){
|
||||
return Result.success("添加成功");
|
||||
}
|
||||
return Result.error("添加失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<FaultAlarm>> faultAlarmList() {
|
||||
List<FaultAlarm> faultAlarms=faultMapper.faultAlarmList();
|
||||
return Result.success(faultAlarms);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result delFault(Integer faultId) {
|
||||
Integer i=faultMapper.delFault(faultId);
|
||||
if(i>0){
|
||||
return Result.success("删除成功");
|
||||
}
|
||||
return Result.error("删除失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result delFaultAlarm(Integer faultAlarmId) {
|
||||
Integer i=faultMapper.delFaultAlarm(faultAlarmId);
|
||||
if(i>0){
|
||||
return Result.success("删除成功");
|
||||
}
|
||||
return Result.error("删除失败");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,28 @@
|
|||
<?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.february.fault.mapper.FaultMapper">
|
||||
|
||||
|
||||
<insert id="addFault">
|
||||
INSERT INTO `car`.`t_fault` ( `fault_bh`, `fault_name`, `fault_type_id`, `car_id`, `actuate_id`, `fault_detail`, `fault_rank_id`, `is_alarm`, `respond_style`, `is_create`)
|
||||
VALUES ( #{faultBh}, #{faultName}, #{faultTypeId}, #{carId}, #{actuateId}, #{faultDetail}, #{faultRankId}, #{isAlarm}, #{respondStyle}, #{isCreate})
|
||||
</insert>
|
||||
<insert id="addFaultAlarm">
|
||||
INSERT INTO `car`.`t_fault_alarm` ( `car_bh`, `car_vin`, `fault_alarm_type`, `fault_name`, `fault_bh`, `response_level`, `alarm_state`, `hand_style`, `alarm_start_time`, `alarm_near_time`, `alarm_end_time`, `admin_id`, `fault_processor`, `process_time`, `fault_alarm_state`)
|
||||
VALUES ( #{carBh}, #{carVin}, #{faultAlarmType}, #{faultName}, #{faultBh}, #{responseLevel}, #{alarmState}, #{handStyle}, #{alarmStartTime}, #{alarmNearTime}, #{alarmEndTime}, #{adminId}, #{faultProcessor}, #{processTime}, #{faultAlarmState})
|
||||
</insert>
|
||||
<delete id="delFault">
|
||||
delete from t_fault where fault_id=#{faultId}
|
||||
</delete>
|
||||
<delete id="delFaultAlarm">
|
||||
delete from t_fault_alarm where fault_alarm_id=#{faultAlarmId}
|
||||
</delete>
|
||||
<select id="faultList" resultType="com.february.fault.domain.Fault">
|
||||
select * from t_fault
|
||||
</select>
|
||||
<select id="findFault" resultType="com.february.fault.domain.Fault">
|
||||
select * from t_fault where fault_id=#{faultId}
|
||||
</select>
|
||||
<select id="faultAlarmList" resultType="com.february.fault.domain.FaultAlarm">
|
||||
select * from t_fault_alarm
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
|
|
Loading…
Reference in New Issue