故障日志更新

master_suzejing
YuanYh 2024-04-10 20:41:16 +08:00
parent 02f71d7baf
commit 46639b77a0
6 changed files with 32 additions and 5 deletions

View File

@ -3,7 +3,9 @@ package com.zhilian.business.controller;
import com.zhilian.business.domain.BreakLog;
import com.zhilian.business.service.BreakLogService;
import com.zhilian.common.core.domain.Result;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@ -60,4 +62,13 @@ public class BreakLogController {
return success;
}
@PostMapping("logDel/{breakLogId}")
public Result logDel(@PathVariable Integer breakLogId){
int del = breakLogService.logDel(breakLogId);
Result<Integer> success = Result.success(del);
return success;
}
}

View File

@ -25,6 +25,8 @@ public class BreakLog {
private String breakTime;
/** 开始报警时间 */
private String breakDate;
/** 是否报警 */
/** 故障状态 */
private String breakState;
/** 逻辑删除 */
private Integer breakDel;
}

View File

@ -18,4 +18,6 @@ public interface BreakLogMapper {
int logAdd(BreakLog breakLog);
int updLog(BreakLog breakLog);
int logDel(Integer breakLogId);
}

View File

@ -16,4 +16,6 @@ public interface BreakLogService {
int logAdd(BreakLog breakLog);
int updLog(BreakLog breakLog);
int logDel(Integer breakLogId);
}

View File

@ -74,4 +74,9 @@ public class BreakLogServiceImpl implements BreakLogService {
public int updLog(BreakLog breakLog) {
return breakLogMapper.updLog(breakLog);
}
@Override
public int logDel(Integer breakLogId) {
return breakLogMapper.logDel(breakLogId);
}
}

View File

@ -6,18 +6,23 @@
<insert id="logAdd">
INSERT INTO `zhilian-business`.`business_break_log`
( `break_code`, `break_vin`, `break_time`, `break_type`, `break_date`, `break_state`)
( `break_code`, `break_vin`, `break_time`, `break_type`, `break_date`, `break_state`,`break_del`)
VALUES
(#{breakCode}, #{breakVin}, NOW(), #{breakType}, NOW(), #{breakState});
(#{breakCode}, #{breakVin},#{breakTime}, #{breakType},DATE_ADD(NOW(),INTERVAL 8 HOUR), #{breakState},0);
</insert>
<update id="updLog">
UPDATE `zhilian-business`.`business_break_log`
SET `break_code` = #{breakCode}, `break_vin` = #{breakVin}, `break_time` = NOW(), `break_type` = #{breakType}, `break_date` = NOW(), `break_state` = #{breakState}
SET `break_code` = #{breakCode}, `break_vin` = #{breakVin}, `break_time` = NOW(), `break_type` = #{breakType}, `break_date` = NOW(), `break_state` = #{breakState}, `break_del` = #{breakDel}
WHERE `break_log_id` = #{breakLogId};
</update>
<update id="logDel">
UPDATE `zhilian-business`.`business_break_log`
SET break_del = 1
WHERE break_log_id = #{breakLogId}
</update>
<select id="breakLog" resultType="com.zhilian.business.domain.BreakLog">
select * from business_break_log
select * from business_break_log where break_del = 0
</select>
</mapper>