mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-01-25 15:55:18 +08:00
添加化验历史记录表
This commit is contained in:
@@ -9,6 +9,7 @@ import cn.lihongjie.coal.coalAnalysis.dto.UpdateCoalAnalysisDto;
|
||||
import cn.lihongjie.coal.coalAnalysis.entity.CoalAnalysisEntity;
|
||||
import cn.lihongjie.coal.coalAnalysis.mapper.CoalAnalysisMapper;
|
||||
import cn.lihongjie.coal.coalAnalysis.repository.CoalAnalysisRepository;
|
||||
import cn.lihongjie.coal.coalAnalysisHis.service.CoalAnalysisHisService;
|
||||
import cn.lihongjie.coal.coalParameterDef.entity.CoalParameterDefEntity;
|
||||
import cn.lihongjie.coal.coalParameterDef.repository.CoalParameterDefRepository;
|
||||
import cn.lihongjie.coal.common.Ctx;
|
||||
@@ -88,8 +89,13 @@ public class CoalAnalysisService extends BaseService<CoalAnalysisEntity, CoalAna
|
||||
return dto;
|
||||
}
|
||||
|
||||
@Autowired CoalAnalysisHisService hisService;
|
||||
|
||||
public CoalAnalysisDto update(UpdateCoalAnalysisDto request) {
|
||||
CoalAnalysisEntity entity = this.repository.get(request.getId());
|
||||
|
||||
hisService.saveHis(entity);
|
||||
|
||||
this.mapper.updateEntity(entity, request);
|
||||
|
||||
this.repository.save(entity);
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
package cn.lihongjie.coal.coalAnalysisHis.controller;
|
||||
|
||||
import cn.lihongjie.coal.annotation.OrgScope;
|
||||
import cn.lihongjie.coal.annotation.SysLog;
|
||||
import cn.lihongjie.coal.base.dto.CommonQuery;
|
||||
import cn.lihongjie.coal.base.dto.IdRequest;
|
||||
import cn.lihongjie.coal.coalAnalysisHis.dto.CoalAnalysisHisDto;
|
||||
import cn.lihongjie.coal.coalAnalysisHis.dto.CreateCoalAnalysisHisDto;
|
||||
import cn.lihongjie.coal.coalAnalysisHis.dto.UpdateCoalAnalysisHisDto;
|
||||
import cn.lihongjie.coal.coalAnalysisHis.service.CoalAnalysisHisService;
|
||||
import java.lang.Object;
|
||||
import java.lang.String;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/coalAnalysisHis")
|
||||
@SysLog(
|
||||
module = "化验记录历史"
|
||||
)
|
||||
@Slf4j
|
||||
@OrgScope
|
||||
public class CoalAnalysisHisController {
|
||||
@Autowired
|
||||
private CoalAnalysisHisService service;
|
||||
|
||||
@PostMapping("/create")
|
||||
public CoalAnalysisHisDto create(@RequestBody CreateCoalAnalysisHisDto request) {
|
||||
return this.service.create(request)
|
||||
;
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public CoalAnalysisHisDto update(@RequestBody UpdateCoalAnalysisHisDto request) {
|
||||
return this.service.update(request)
|
||||
;
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
public Object delete(@RequestBody IdRequest request) {
|
||||
this.service.delete(request);
|
||||
return true
|
||||
;
|
||||
}
|
||||
|
||||
@PostMapping("/getById")
|
||||
public CoalAnalysisHisDto getById(@RequestBody String request) {
|
||||
return this.service.getById(request)
|
||||
;
|
||||
}
|
||||
|
||||
@PostMapping("/list")
|
||||
public Page<CoalAnalysisHisDto> list(@RequestBody CommonQuery request) {
|
||||
return this.service.list(request)
|
||||
;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package cn.lihongjie.coal.coalAnalysisHis.dto;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.OrgCommonDto;
|
||||
import cn.lihongjie.coal.coalInfo.entity.CoalInfoEntity;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.validation.constraints.DecimalMin;
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
@Data
|
||||
public class CoalAnalysisHisDto extends OrgCommonDto {
|
||||
@ManyToOne
|
||||
@Comment("关联的煤源信息")
|
||||
private CoalInfoEntity coalInfo;
|
||||
|
||||
@Comment("参数 1 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param1;
|
||||
|
||||
@Comment("参数 2 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param2;
|
||||
|
||||
@Comment("参数 3 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param3;
|
||||
|
||||
@Comment("参数 4 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param4;
|
||||
|
||||
@Comment("参数 5 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param5;
|
||||
|
||||
@Comment("参数 6 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param6;
|
||||
|
||||
@Comment("参数 7 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param7;
|
||||
|
||||
@Comment("参数 8 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param8;
|
||||
|
||||
@Comment("参数 9 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param9;
|
||||
|
||||
@Comment("参数 10 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param10;
|
||||
|
||||
@Comment("参数 11 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param11;
|
||||
|
||||
@Comment("参数 12 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param12;
|
||||
|
||||
@Comment("参数 13 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param13;
|
||||
|
||||
@Comment("参数 14 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param14;
|
||||
|
||||
@Comment("参数 15 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param15;
|
||||
|
||||
@Comment("参数 16 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param16;
|
||||
|
||||
@Comment("参数 17 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param17;
|
||||
|
||||
@Comment("参数 18 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param18;
|
||||
|
||||
@Comment("参数 19 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param19;
|
||||
|
||||
@Comment("参数 20 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param20;
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package cn.lihongjie.coal.coalAnalysisHis.dto;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.OrgCommonDto;
|
||||
import cn.lihongjie.coal.coalInfo.entity.CoalInfoEntity;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.validation.constraints.DecimalMin;
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
@Data
|
||||
public class CreateCoalAnalysisHisDto extends OrgCommonDto {
|
||||
@ManyToOne
|
||||
@Comment("关联的煤源信息")
|
||||
private CoalInfoEntity coalInfo;
|
||||
|
||||
@Comment("参数 1 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param1;
|
||||
|
||||
@Comment("参数 2 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param2;
|
||||
|
||||
@Comment("参数 3 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param3;
|
||||
|
||||
@Comment("参数 4 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param4;
|
||||
|
||||
@Comment("参数 5 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param5;
|
||||
|
||||
@Comment("参数 6 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param6;
|
||||
|
||||
@Comment("参数 7 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param7;
|
||||
|
||||
@Comment("参数 8 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param8;
|
||||
|
||||
@Comment("参数 9 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param9;
|
||||
|
||||
@Comment("参数 10 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param10;
|
||||
|
||||
@Comment("参数 11 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param11;
|
||||
|
||||
@Comment("参数 12 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param12;
|
||||
|
||||
@Comment("参数 13 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param13;
|
||||
|
||||
@Comment("参数 14 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param14;
|
||||
|
||||
@Comment("参数 15 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param15;
|
||||
|
||||
@Comment("参数 16 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param16;
|
||||
|
||||
@Comment("参数 17 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param17;
|
||||
|
||||
@Comment("参数 18 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param18;
|
||||
|
||||
@Comment("参数 19 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param19;
|
||||
|
||||
@Comment("参数 20 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param20;
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package cn.lihongjie.coal.coalAnalysisHis.dto;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.OrgCommonDto;
|
||||
import cn.lihongjie.coal.coalInfo.entity.CoalInfoEntity;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.validation.constraints.DecimalMin;
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
@Data
|
||||
public class UpdateCoalAnalysisHisDto extends OrgCommonDto {
|
||||
@ManyToOne
|
||||
@Comment("关联的煤源信息")
|
||||
private CoalInfoEntity coalInfo;
|
||||
|
||||
@Comment("参数 1 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param1;
|
||||
|
||||
@Comment("参数 2 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param2;
|
||||
|
||||
@Comment("参数 3 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param3;
|
||||
|
||||
@Comment("参数 4 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param4;
|
||||
|
||||
@Comment("参数 5 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param5;
|
||||
|
||||
@Comment("参数 6 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param6;
|
||||
|
||||
@Comment("参数 7 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param7;
|
||||
|
||||
@Comment("参数 8 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param8;
|
||||
|
||||
@Comment("参数 9 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param9;
|
||||
|
||||
@Comment("参数 10 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param10;
|
||||
|
||||
@Comment("参数 11 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param11;
|
||||
|
||||
@Comment("参数 12 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param12;
|
||||
|
||||
@Comment("参数 13 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param13;
|
||||
|
||||
@Comment("参数 14 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param14;
|
||||
|
||||
@Comment("参数 15 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param15;
|
||||
|
||||
@Comment("参数 16 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param16;
|
||||
|
||||
@Comment("参数 17 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param17;
|
||||
|
||||
@Comment("参数 18 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param18;
|
||||
|
||||
@Comment("参数 19 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param19;
|
||||
|
||||
@Comment("参数 20 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param20;
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package cn.lihongjie.coal.coalAnalysisHis.entity;
|
||||
|
||||
import cn.lihongjie.coal.base.entity.OrgCommonEntity;
|
||||
import cn.lihongjie.coal.coalAnalysis.entity.CoalAnalysisEntity;
|
||||
import cn.lihongjie.coal.coalInfo.entity.CoalInfoEntity;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.validation.constraints.DecimalMin;
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
public class CoalAnalysisHisEntity extends OrgCommonEntity {
|
||||
@ManyToOne
|
||||
@Comment("关联的煤源信息")
|
||||
private CoalInfoEntity coalInfo;
|
||||
|
||||
@ManyToOne
|
||||
@Comment("关联化验数据")
|
||||
private CoalAnalysisEntity src;
|
||||
|
||||
@Comment("参数 1 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param1;
|
||||
|
||||
@Comment("参数 2 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param2;
|
||||
|
||||
@Comment("参数 3 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param3;
|
||||
|
||||
@Comment("参数 4 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param4;
|
||||
|
||||
@Comment("参数 5 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param5;
|
||||
|
||||
@Comment("参数 6 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param6;
|
||||
|
||||
@Comment("参数 7 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param7;
|
||||
|
||||
@Comment("参数 8 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param8;
|
||||
|
||||
@Comment("参数 9 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param9;
|
||||
|
||||
@Comment("参数 10 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param10;
|
||||
|
||||
@Comment("参数 11 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param11;
|
||||
|
||||
@Comment("参数 12 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param12;
|
||||
|
||||
@Comment("参数 13 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param13;
|
||||
|
||||
@Comment("参数 14 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param14;
|
||||
|
||||
@Comment("参数 15 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param15;
|
||||
|
||||
@Comment("参数 16 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param16;
|
||||
|
||||
@Comment("参数 17 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param17;
|
||||
|
||||
@Comment("参数 18 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param18;
|
||||
|
||||
@Comment("参数 19 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param19;
|
||||
|
||||
@Comment("参数 20 ")
|
||||
@DecimalMin(value = "0.1", inclusive = true, message = "参数不能小于0.1")
|
||||
private Double param20;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package cn.lihongjie.coal.coalAnalysisHis.mapper;
|
||||
|
||||
import cn.lihongjie.coal.base.mapper.BaseMapper;
|
||||
import cn.lihongjie.coal.base.mapper.CommonMapper;
|
||||
import cn.lihongjie.coal.coalAnalysis.entity.CoalAnalysisEntity;
|
||||
import cn.lihongjie.coal.coalAnalysisHis.dto.CoalAnalysisHisDto;
|
||||
import cn.lihongjie.coal.coalAnalysisHis.dto.CreateCoalAnalysisHisDto;
|
||||
import cn.lihongjie.coal.coalAnalysisHis.dto.UpdateCoalAnalysisHisDto;
|
||||
import cn.lihongjie.coal.coalAnalysisHis.entity.CoalAnalysisHisEntity;
|
||||
import org.mapstruct.AfterMapping;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.MappingTarget;
|
||||
import org.mapstruct.control.DeepClone;
|
||||
|
||||
@Mapper(
|
||||
componentModel = org.mapstruct.MappingConstants.ComponentModel.SPRING,
|
||||
uses = {CommonMapper.class},
|
||||
mappingControl = DeepClone.class
|
||||
)
|
||||
public interface CoalAnalysisHisMapper extends BaseMapper<CoalAnalysisHisEntity, CoalAnalysisHisDto, CreateCoalAnalysisHisDto, UpdateCoalAnalysisHisDto> {
|
||||
CoalAnalysisHisEntity toHis(CoalAnalysisEntity coalAnalysis);
|
||||
|
||||
|
||||
@AfterMapping
|
||||
default void afterMapping(CoalAnalysisEntity entity, @MappingTarget CoalAnalysisHisEntity his) {
|
||||
|
||||
his.setId(null);
|
||||
his.setSrc(entity);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package cn.lihongjie.coal.coalAnalysisHis.repository;
|
||||
|
||||
import cn.lihongjie.coal.base.dao.BaseRepository;
|
||||
import cn.lihongjie.coal.coalAnalysisHis.entity.CoalAnalysisHisEntity;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface CoalAnalysisHisRepository extends BaseRepository<CoalAnalysisHisEntity> {
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package cn.lihongjie.coal.coalAnalysisHis.service;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.CommonQuery;
|
||||
import cn.lihongjie.coal.base.dto.IdRequest;
|
||||
import cn.lihongjie.coal.base.service.BaseService;
|
||||
import cn.lihongjie.coal.coalAnalysis.entity.CoalAnalysisEntity;
|
||||
import cn.lihongjie.coal.coalAnalysisHis.dto.CoalAnalysisHisDto;
|
||||
import cn.lihongjie.coal.coalAnalysisHis.dto.CreateCoalAnalysisHisDto;
|
||||
import cn.lihongjie.coal.coalAnalysisHis.dto.UpdateCoalAnalysisHisDto;
|
||||
import cn.lihongjie.coal.coalAnalysisHis.entity.CoalAnalysisHisEntity;
|
||||
import cn.lihongjie.coal.coalAnalysisHis.mapper.CoalAnalysisHisMapper;
|
||||
import cn.lihongjie.coal.coalAnalysisHis.repository.CoalAnalysisHisRepository;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class CoalAnalysisHisService extends BaseService<CoalAnalysisHisEntity, CoalAnalysisHisRepository> {
|
||||
@Autowired
|
||||
private CoalAnalysisHisRepository repository;
|
||||
|
||||
@Autowired
|
||||
private CoalAnalysisHisMapper mapper;
|
||||
|
||||
@Autowired
|
||||
private ConversionService conversionService;
|
||||
|
||||
public void saveHis(CoalAnalysisEntity coalAnalysis){
|
||||
|
||||
CoalAnalysisHisEntity his = mapper.toHis(coalAnalysis);
|
||||
save(his);
|
||||
|
||||
}
|
||||
|
||||
public CoalAnalysisHisDto create(CreateCoalAnalysisHisDto request) {
|
||||
CoalAnalysisHisEntity entity = mapper.toEntity(request);
|
||||
|
||||
|
||||
this.repository.save(entity);
|
||||
return getById(entity.getId())
|
||||
;
|
||||
}
|
||||
|
||||
public CoalAnalysisHisDto update(UpdateCoalAnalysisHisDto request) {
|
||||
CoalAnalysisHisEntity entity = this.repository.get(request.getId());
|
||||
this.mapper.updateEntity(entity, request);
|
||||
|
||||
this.repository.save(entity);
|
||||
|
||||
return getById(entity.getId())
|
||||
;
|
||||
}
|
||||
|
||||
public void delete(IdRequest request) {
|
||||
this.repository.deleteAllById(request.getIds())
|
||||
;
|
||||
}
|
||||
|
||||
public CoalAnalysisHisDto getById(String id) {
|
||||
CoalAnalysisHisEntity entity = repository.get(id);
|
||||
|
||||
|
||||
return mapper.toDto(entity)
|
||||
;
|
||||
}
|
||||
|
||||
public Page<CoalAnalysisHisDto> list(CommonQuery query) {
|
||||
Page<CoalAnalysisHisEntity> page = repository.findAll(query.specification(conversionService), PageRequest.of(query.getPageNo(), query.getPageSize(), Sort.by(query.getOrders())));
|
||||
|
||||
|
||||
return page.map(this.mapper::toDto)
|
||||
;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user