xiaoSu 2024-04-10 10:29:21 +08:00
commit 2c2854506e
5 changed files with 62 additions and 1 deletions

View File

@ -5,13 +5,14 @@ import com.zhilian.business.service.BreakLogService;
import com.zhilian.common.core.domain.Result; import com.zhilian.common.core.domain.Result;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
/** /**
* @ClassName BreakLogController * @ClassName BreakLogController
* @Description TODO * @Description
* @Author YuanYongH * @Author YuanYongH
* @Date 2024/4/8 20:48 * @Date 2024/4/8 20:48
*/ */
@ -21,6 +22,11 @@ public class BreakLogController {
@Autowired @Autowired
private BreakLogService breakLogService; private BreakLogService breakLogService;
/**
* @Description //故障日志列表
* @Date 2024/4/10
* @return com.zhilian.common.core.domain.Result<java.util.List<com.zhilian.business.domain.BreakLog>>
**/
@PostMapping("log") @PostMapping("log")
public Result<List<BreakLog>> breakLog() { public Result<List<BreakLog>> breakLog() {
List<BreakLog> list = breakLogService.breakLog(); List<BreakLog> list = breakLogService.breakLog();
@ -28,4 +34,30 @@ public class BreakLogController {
return success; return success;
} }
/**
* @Description //故障日志添加
* @Date 2024/4/10
* @param breakLog
* @return com.zhilian.common.core.domain.Result
**/
@PostMapping("logAdd")
public Result logAdd(@RequestBody BreakLog breakLog){
int i = breakLogService.logAdd(breakLog);
Result<Integer> success = Result.success(i);
return success;
}
/**
* @Description // 故障日志修改
* @Date 2024/4/10
* @param breakLog
* @return com.zhilian.common.core.domain.Result
**/
@PostMapping("updLog")
public Result updLog(@RequestBody BreakLog breakLog){
int i = breakLogService.updLog(breakLog);
Result<Integer> success = Result.success(i);
return success;
}
} }

View File

@ -15,4 +15,7 @@ import java.util.List;
public interface BreakLogMapper { public interface BreakLogMapper {
List<BreakLog> breakLog(); List<BreakLog> breakLog();
int logAdd(BreakLog breakLog);
int updLog(BreakLog breakLog);
} }

View File

@ -13,4 +13,7 @@ import java.util.List;
public interface BreakLogService { public interface BreakLogService {
List<BreakLog> breakLog(); List<BreakLog> breakLog();
int logAdd(BreakLog breakLog);
int updLog(BreakLog breakLog);
} }

View File

@ -64,4 +64,14 @@ public class BreakLogServiceImpl implements BreakLogService {
// 返回故障日志 // 返回故障日志
return breakLogMapper.breakLog(); return breakLogMapper.breakLog();
} }
@Override
public int logAdd(BreakLog breakLog) {
return breakLogMapper.logAdd(breakLog);
}
@Override
public int updLog(BreakLog breakLog) {
return breakLogMapper.updLog(breakLog);
}
} }

View File

@ -3,6 +3,19 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhilian.business.mapper.BreakLogMapper"> <mapper namespace="com.zhilian.business.mapper.BreakLogMapper">
<insert id="logAdd">
INSERT INTO `zhilian-business`.`business_break_log`
( `break_code`, `break_vin`, `break_time`, `break_type`, `break_date`, `break_state`)
VALUES
(#{breakCode}, #{breakVin}, NOW(), #{breakType}, NOW(), #{breakState});
</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}
WHERE `break_log_id` = #{breakLogId};
</update>
<select id="breakLog" resultType="com.zhilian.business.domain.BreakLog"> <select id="breakLog" resultType="com.zhilian.business.domain.BreakLog">
select * from business_break_log select * from business_break_log