Browse Source

update: 车检模板

zhongwei
liwen 6 months ago
parent
commit
af6f156048
  1. 4
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarCheckTemplateDetailEntity.java
  2. 18
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckTemplateMapper.xml
  3. 16
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckRecordServiceImpl.java
  4. 8
      hzims-service/safeproduct/src/main/resources/db/2.0.1.sql

4
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarCheckTemplateDetailEntity.java

@ -32,8 +32,4 @@ public class CarCheckTemplateDetailEntity extends BaseEntity {
@NotNull
@ApiModelProperty("检查内容")
private String checkContent;
@NotNull
@ApiModelProperty("检查结果")
private String checkResult;
}

18
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckTemplateMapper.xml

@ -0,0 +1,18 @@
<?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.hnac.hzims.safeproduct.mapper.CarCheckTemplateMapper">
<select id="getCarCheckTemplatePage" resultType="com.hnac.hzims.safeproduct.entity.CarCheckTemplateEntity">
SELECT
*
FROM
hzims_car_check_template
WHERE
is_deleted = 0
<if test="param.templateName != null and param.templateName != ''">
AND template_name like concat('%', #{param.templateName}, '%')
</if>
ORDER BY
create_time DESC
</select>
</mapper>

16
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckRecordServiceImpl.java

@ -29,7 +29,6 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -106,19 +105,7 @@ public class CarCheckRecordServiceImpl extends ServiceImpl<CarCheckRecordMapper,
}
// 拼装检查列表
List<CarCheckItemEntity> itemList = carCheckItemService.getListByCarCheckRecordId(id);
List<CarCheckItemEntity> checkItemList = new ArrayList<>();
itemList.forEach(item -> {
String[] contents = item.getCheckContent().split(",|,");
String[] results = item.getCheckResult().split(",|,");
for (int i = 0; i < contents.length; i++) {
CarCheckItemEntity carCheckItemEntity = new CarCheckItemEntity();
carCheckItemEntity.setCheckItem(item.getCheckItem());
carCheckItemEntity.setCheckContent(contents[i]);
carCheckItemEntity.setCheckResult(results[i]);
checkItemList.add(carCheckItemEntity);
}
});
carCheckRecordDetailVO.setCheckItemList(checkItemList);
carCheckRecordDetailVO.setCheckItemList(itemList);
return carCheckRecordDetailVO;
}
return null;
@ -187,7 +174,6 @@ public class CarCheckRecordServiceImpl extends ServiceImpl<CarCheckRecordMapper,
List<CarCheckItemEntity> itemList = carCheckRecordDTO.getItemList();
itemList.forEach(x -> {
x.setCarCheckRecordId(carCheckRecordDTO.getId());
// x.setId(null);
});
return carCheckItemService.saveBatch(itemList);
}

8
hzims-service/safeproduct/src/main/resources/db/2.0.1.sql

@ -49,7 +49,7 @@ ALTER TABLE hzims_test
ADD COLUMN passing_score int(10) NOT NULL DEFAULT 60 COMMENT '考试及格分';
-- 新增车检模板表
CREATE TABLE IF NOT EXISTS `hzims_hygiene_template` (
CREATE TABLE IF NOT EXISTS `hzims_car_check_template` (
`id` bigint(20) NOT NULL COMMENT '主键ID',
`template_name` varchar(50) NOT NULL COMMENT '模板名称',
`create_user` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建人',
@ -60,10 +60,10 @@ CREATE TABLE IF NOT EXISTS `hzims_hygiene_template` (
`status` int(2) NOT NULL DEFAULT '1' COMMENT '状态',
`is_deleted` int(2) NOT NULL DEFAULT '0' COMMENT '逻辑删除状态:0-未删除,1-删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='车检模板表';
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='车检模板表';
-- 新增车检模板详情表
CREATE TABLE IF NOT EXISTS `hzims_hygiene_template_detail` (
CREATE TABLE IF NOT EXISTS `hzims_car_check_template_detail` (
`id` bigint(20) NOT NULL COMMENT '主键ID',
`template_id` bigint(20) NOT NULL COMMENT '模板id',
`check_item` varchar(500) NOT NULL COMMENT '检查项目',
@ -76,4 +76,4 @@ CREATE TABLE IF NOT EXISTS `hzims_hygiene_template_detail` (
`status` int(2) NOT NULL DEFAULT '1' COMMENT '状态',
`is_deleted` int(2) NOT NULL DEFAULT '0' COMMENT '逻辑删除状态:0-未删除,1-删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='车检模板详情表';
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='车检模板详情表';
Loading…
Cancel
Save