mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-07-25 07:07:37 +08:00
feat(coalWashingDailyAnalysis): 新增 KF 项目相关功能
- 添加 CoalWashingDailyAnalysisKFItem 相关的实体、DTO、Mapper 和 Service - 在 CoalWashingDailyAnalysis 中集成 KF 项目 - 优化 CoalWashingDailyAnalysis 的创建、更新和列表展示功能
This commit is contained in:
@@ -5,10 +5,7 @@ import cn.lihongjie.coal.annotation.SysLog;
|
||||
import cn.lihongjie.coal.base.controller.BaseController;
|
||||
import cn.lihongjie.coal.base.dto.CommonQuery;
|
||||
import cn.lihongjie.coal.base.dto.IdRequest;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysis.dto.CoalWashingDailyAnalysisCoalReportRequest;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysis.dto.CoalWashingDailyAnalysisDto;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysis.dto.CreateCoalWashingDailyAnalysisDto;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysis.dto.UpdateCoalWashingDailyAnalysisDto;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysis.dto.*;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysis.service.CoalWashingDailyAnalysisService;
|
||||
import cn.lihongjie.coal.sse.service.SseService;
|
||||
|
||||
@@ -92,7 +89,7 @@ public class CoalWashingDailyAnalysisController extends BaseController {
|
||||
}
|
||||
|
||||
@PostMapping("/list")
|
||||
public Page<CoalWashingDailyAnalysisDto> list(@RequestBody CommonQuery dto) {
|
||||
public Page<CoalWashingDailyAnalysisListDto> list(@RequestBody CommonQuery dto) {
|
||||
return this.service.list(dto);
|
||||
}
|
||||
|
||||
|
||||
@@ -57,6 +57,9 @@ public class CoalWashingDailyAnalysisDto extends OrgCommonDto {
|
||||
@CollectionTable(foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||
private List<CoalWashingDailyAnalysisKFItemVo> kfItems;
|
||||
|
||||
|
||||
|
||||
|
||||
// @ElementCollection
|
||||
// @Comment("连续平均值")
|
||||
// @CollectionTable(foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
package cn.lihongjie.coal.coalWashingDailyAnalysis.dto;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.OrgCommonDto;
|
||||
import cn.lihongjie.coal.common.DictCode;
|
||||
import cn.lihongjie.coal.pojoProcessor.DictTranslate;
|
||||
import cn.lihongjie.coal.product.dto.ProductDto;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/** */
|
||||
@Data
|
||||
@Comment("洗煤报告表")
|
||||
public class CoalWashingDailyAnalysisListDto extends OrgCommonDto {
|
||||
|
||||
@Comment("日期")
|
||||
private LocalDate date;
|
||||
|
||||
@ManyToOne
|
||||
@Comment("产品信息")
|
||||
private ProductDto product;
|
||||
|
||||
@Comment("归档状态")
|
||||
private String archiveStatus;
|
||||
@DictTranslate(dictKey = DictCode.ARCHIVESTATUS)
|
||||
private String archiveStatusName;
|
||||
|
||||
@Comment("开机时间")
|
||||
private LocalDateTime startTime;
|
||||
|
||||
@Comment("停机时间")
|
||||
private LocalDateTime endTime;
|
||||
|
||||
@Comment("运行时长(小时)")
|
||||
private Double runHours;
|
||||
@Comment("皮带秤设备组")
|
||||
private String pdcDeviceGroup;
|
||||
|
||||
|
||||
// @ElementCollection
|
||||
// @CollectionTable(foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||
// private List<CoalWashingDailyAnalysisItemVo> inputItems;
|
||||
// private List<CoalWashingDailyAnalysisYmDetailVo> ymDetails;
|
||||
//
|
||||
// @ElementCollection
|
||||
// @CollectionTable(foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||
// private List<CoalWashingDailyAnalysisKFItemVo> kfItems;
|
||||
|
||||
// @ElementCollection
|
||||
// @Comment("连续平均值")
|
||||
// @CollectionTable(foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||
// private List<CoalWashingDailyAnalysisItemVo> rollingAvgItems;
|
||||
|
||||
// @ElementCollection
|
||||
// @CollectionTable(foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||
// private List<CoalWashingDailyAnalysisParamVo> paramsInfo;
|
||||
|
||||
@Comment("目标大堆 灰")
|
||||
private Double ddp1;
|
||||
|
||||
@Comment("目标大堆 灰")
|
||||
private Double ddp1Min;
|
||||
|
||||
@Comment("目标大堆 硫")
|
||||
private Double ddp2Min;
|
||||
|
||||
@Comment("目标大堆 挥发")
|
||||
private Double ddp3Min;
|
||||
|
||||
@Comment("目标大堆 粘结")
|
||||
private Double ddp4Min;
|
||||
|
||||
@Comment("目标大堆 备用")
|
||||
private Double ddp5Min;
|
||||
|
||||
@Comment("目标大堆 灰")
|
||||
private Double ddp1Max;
|
||||
|
||||
@Comment("目标大堆 硫")
|
||||
private Double ddp2Max;
|
||||
|
||||
@Comment("目标大堆 挥发")
|
||||
private Double ddp3Max;
|
||||
|
||||
@Comment("目标大堆 粘结")
|
||||
private Double ddp4Max;
|
||||
|
||||
@Comment("目标大堆 备用")
|
||||
private Double ddp5Max;
|
||||
|
||||
@Comment("产量初始值")
|
||||
private Double initTotalNumber = 0.0;
|
||||
|
||||
private String remark1;
|
||||
private String remark2;
|
||||
private String remark3;
|
||||
private String remark4;
|
||||
private String remark5;
|
||||
private String remark6;
|
||||
private String remark7;
|
||||
private String remark8;
|
||||
private String remark9;
|
||||
private String remark10;
|
||||
private String remark11;
|
||||
private String remark12;
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package cn.lihongjie.coal.coalWashingDailyAnalysis.entity;
|
||||
|
||||
import cn.lihongjie.coal.base.entity.OrgCommonEntity;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysisKFItem.entity.CoalWashingDailyAnalysisKFItemEntity;
|
||||
import cn.lihongjie.coal.exception.BizException;
|
||||
import cn.lihongjie.coal.product.entity.ProductEntity;
|
||||
|
||||
@@ -76,6 +77,11 @@ public class CoalWashingDailyAnalysisEntity extends OrgCommonEntity {
|
||||
@Fetch(FetchMode.SUBSELECT)
|
||||
private List<CoalWashingDailyAnalysisKFItemVo> kfItems;
|
||||
|
||||
|
||||
@OneToMany(mappedBy = "coalWashingDailyAnalysis")
|
||||
private List<CoalWashingDailyAnalysisKFItemEntity> kfItemsNew;
|
||||
|
||||
|
||||
// @ElementCollection
|
||||
// @Comment("连续平均值")
|
||||
// @CollectionTable(foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||
|
||||
@@ -2,6 +2,7 @@ package cn.lihongjie.coal.coalWashingDailyAnalysis.mapper;
|
||||
|
||||
import cn.lihongjie.coal.base.mapper.BaseMapper;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysis.dto.CoalWashingDailyAnalysisDto;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysis.dto.CoalWashingDailyAnalysisListDto;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysis.dto.CreateCoalWashingDailyAnalysisDto;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysis.dto.UpdateCoalWashingDailyAnalysisDto;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysis.entity.CoalWashingDailyAnalysisEntity;
|
||||
@@ -19,4 +20,6 @@ public interface CoalWashingDailyAnalysisMapper
|
||||
CoalWashingDailyAnalysisEntity,
|
||||
CoalWashingDailyAnalysisDto,
|
||||
CreateCoalWashingDailyAnalysisDto,
|
||||
UpdateCoalWashingDailyAnalysisDto> {}
|
||||
UpdateCoalWashingDailyAnalysisDto> {
|
||||
CoalWashingDailyAnalysisListDto toListDto(CoalWashingDailyAnalysisEntity coalWashingDailyAnalysisEntity);
|
||||
}
|
||||
|
||||
@@ -4,15 +4,14 @@ import cn.hutool.core.bean.BeanUtil;
|
||||
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.coalWashingDailyAnalysis.dto.CoalWashingDailyAnalysisCoalReportRequest;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysis.dto.CoalWashingDailyAnalysisDto;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysis.dto.CreateCoalWashingDailyAnalysisDto;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysis.dto.UpdateCoalWashingDailyAnalysisDto;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysis.dto.*;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysis.entity.CoalWashingDailyAnalysisEntity;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysis.entity.CoalWashingDailyAnalysisKFItemVo;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysis.mapper.CoalWashingDailyAnalysisMapper;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysis.mapper.RoundMapper;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysis.repository.CoalWashingDailyAnalysisRepository;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysisKFItem.entity.CoalWashingDailyAnalysisKFItemEntity;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysisKFItem.repository.CoalWashingDailyAnalysisKFItemRepository;
|
||||
import cn.lihongjie.coal.common.Ctx;
|
||||
import cn.lihongjie.coal.common.FreeMakerUtils;
|
||||
import cn.lihongjie.coal.common.JpaUtils;
|
||||
@@ -59,6 +58,8 @@ public class CoalWashingDailyAnalysisService
|
||||
@Autowired RoundMapper roundMapper;
|
||||
@Autowired ConversionService conversionService;
|
||||
|
||||
@Autowired CoalWashingDailyAnalysisKFItemRepository kfItemRepository;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {}
|
||||
|
||||
@@ -128,12 +129,45 @@ public class CoalWashingDailyAnalysisService
|
||||
}
|
||||
this.repository.save(entity);
|
||||
|
||||
sseService.broadcast("coalWashingDailyAnalysis." + entity.getId(), ImmutableMap.of("id", entity.getId(), "event", "update", "sessionId", Ctx.getSessionIdMd5()));
|
||||
if (CollectionUtils.isNotEmpty(request.getKfItems())) {
|
||||
|
||||
|
||||
|
||||
synchronizeKfItems(entity, request.getKfItems());
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
sseService.broadcast(
|
||||
"coalWashingDailyAnalysis." + entity.getId(),
|
||||
ImmutableMap.of(
|
||||
"id",
|
||||
entity.getId(),
|
||||
"event",
|
||||
"update",
|
||||
"sessionId",
|
||||
Ctx.getSessionIdMd5()));
|
||||
|
||||
return getById(entity.getId());
|
||||
}
|
||||
|
||||
private void synchronizeKfItems(CoalWashingDailyAnalysisEntity entity, List<CoalWashingDailyAnalysisKFItemVo> kfItems) {
|
||||
|
||||
kfItemRepository.deleteAllByCoalWashingDailyAnalysis(entity);
|
||||
|
||||
List<CoalWashingDailyAnalysisKFItemEntity> list = BeanUtil.copyToList(kfItems, CoalWashingDailyAnalysisKFItemEntity.class);
|
||||
|
||||
list.forEach(
|
||||
item -> {
|
||||
item.setCoalWashingDailyAnalysis(entity);
|
||||
item.setOrganizationId(Ctx.activeOrganizationId());
|
||||
});
|
||||
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
kfItemRepository.saveAll(list);
|
||||
}
|
||||
}
|
||||
|
||||
public CoalWashingDailyAnalysisDto updateKfItems(UpdateCoalWashingDailyAnalysisDto request) {
|
||||
|
||||
@@ -143,8 +177,6 @@ public class CoalWashingDailyAnalysisService
|
||||
throw new BizException("部分数据已归档,无法编辑或删除");
|
||||
}
|
||||
|
||||
|
||||
|
||||
entity.setKfItems(request.getKfItems());
|
||||
|
||||
entity.setOrganizationId(Ctx.activeOrganizationId());
|
||||
@@ -155,13 +187,19 @@ public class CoalWashingDailyAnalysisService
|
||||
entity.setName(productService.get(entity.getProduct().getId()).getName());
|
||||
}
|
||||
this.repository.save(entity);
|
||||
sseService.broadcast("coalWashingDailyAnalysis." + entity.getId(), ImmutableMap.of("id", entity.getId(), "event", "updateKfItems", "sessionId", Ctx.getSessionIdMd5()));
|
||||
sseService.broadcast(
|
||||
"coalWashingDailyAnalysis." + entity.getId(),
|
||||
ImmutableMap.of(
|
||||
"id",
|
||||
entity.getId(),
|
||||
"event",
|
||||
"updateKfItems",
|
||||
"sessionId",
|
||||
Ctx.getSessionIdMd5()));
|
||||
|
||||
return getById(entity.getId());
|
||||
}
|
||||
|
||||
|
||||
|
||||
public CoalWashingDailyAnalysisDto updateMain(UpdateCoalWashingDailyAnalysisDto request) {
|
||||
|
||||
CoalWashingDailyAnalysisEntity entity = this.repository.get(request.getId());
|
||||
@@ -173,7 +211,6 @@ public class CoalWashingDailyAnalysisService
|
||||
}
|
||||
this.mapper.updateEntity(entity, request);
|
||||
|
||||
|
||||
entity.setKfItems(kfItems);
|
||||
|
||||
entity.setOrganizationId(Ctx.activeOrganizationId());
|
||||
@@ -184,23 +221,19 @@ public class CoalWashingDailyAnalysisService
|
||||
entity.setName(productService.get(entity.getProduct().getId()).getName());
|
||||
}
|
||||
this.repository.save(entity);
|
||||
sseService.broadcast("coalWashingDailyAnalysis." + entity.getId(), ImmutableMap.of("id", entity.getId(), "event", "updateMain", "sessionId", Ctx.getSessionIdMd5()));
|
||||
sseService.broadcast(
|
||||
"coalWashingDailyAnalysis." + entity.getId(),
|
||||
ImmutableMap.of(
|
||||
"id",
|
||||
entity.getId(),
|
||||
"event",
|
||||
"updateMain",
|
||||
"sessionId",
|
||||
Ctx.getSessionIdMd5()));
|
||||
|
||||
return getById(entity.getId());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void delete(IdRequest request) {
|
||||
|
||||
if (this.repository.containArchived(request)) {
|
||||
@@ -209,12 +242,11 @@ public class CoalWashingDailyAnalysisService
|
||||
|
||||
this.repository.deleteAllById(request.getIds());
|
||||
|
||||
|
||||
for (String id : request.getIds()) {
|
||||
|
||||
sseService.broadcast("coalWashingDailyAnalysis." + id, ImmutableMap.of("id", id, "event", "delete"));
|
||||
sseService.broadcast(
|
||||
"coalWashingDailyAnalysis." + id, ImmutableMap.of("id", id, "event", "delete"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public CoalWashingDailyAnalysisDto getById(String id) {
|
||||
@@ -224,7 +256,7 @@ public class CoalWashingDailyAnalysisService
|
||||
return mapper.toDto(entity);
|
||||
}
|
||||
|
||||
public Page<CoalWashingDailyAnalysisDto> list(CommonQuery query) {
|
||||
public Page<CoalWashingDailyAnalysisListDto> list(CommonQuery query) {
|
||||
|
||||
Page<CoalWashingDailyAnalysisEntity> page =
|
||||
repository.findAll(
|
||||
@@ -234,7 +266,7 @@ public class CoalWashingDailyAnalysisService
|
||||
query.getPageSize(),
|
||||
Sort.by(query.getOrders())));
|
||||
|
||||
return page.map(this.mapper::toDto);
|
||||
return page.map(this.mapper::toListDto);
|
||||
}
|
||||
|
||||
public void archive(IdRequest dto) {
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package cn.lihongjie.coal.coalWashingDailyAnalysisKFItem.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.coalWashingDailyAnalysisKFItem.dto.CoalWashingDailyAnalysisKFItemDto;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysisKFItem.dto.CreateCoalWashingDailyAnalysisKFItemDto;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysisKFItem.dto.UpdateCoalWashingDailyAnalysisKFItemDto;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysisKFItem.service.CoalWashingDailyAnalysisKFItemService;
|
||||
|
||||
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("/coalWashingDailyAnalysisKFItem")
|
||||
@SysLog(module = "")
|
||||
@Slf4j
|
||||
@OrgScope
|
||||
public class CoalWashingDailyAnalysisKFItemController {
|
||||
@Autowired private CoalWashingDailyAnalysisKFItemService service;
|
||||
|
||||
@PostMapping("/create")
|
||||
public CoalWashingDailyAnalysisKFItemDto create(
|
||||
@RequestBody CreateCoalWashingDailyAnalysisKFItemDto request) {
|
||||
return this.service.create(request);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public CoalWashingDailyAnalysisKFItemDto update(
|
||||
@RequestBody UpdateCoalWashingDailyAnalysisKFItemDto request) {
|
||||
return this.service.update(request);
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
public Object delete(@RequestBody IdRequest request) {
|
||||
this.service.delete(request);
|
||||
return true;
|
||||
}
|
||||
|
||||
@PostMapping("/getById")
|
||||
public CoalWashingDailyAnalysisKFItemDto getById(@RequestBody IdRequest request) {
|
||||
return this.service.getById(request.getId());
|
||||
}
|
||||
|
||||
@PostMapping("/list")
|
||||
public Page<CoalWashingDailyAnalysisKFItemDto> list(@RequestBody CommonQuery request) {
|
||||
return this.service.list(request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package cn.lihongjie.coal.coalWashingDailyAnalysisKFItem.dto;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.OrgCommonDto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CoalWashingDailyAnalysisKFItemDto extends OrgCommonDto {}
|
||||
@@ -0,0 +1,8 @@
|
||||
package cn.lihongjie.coal.coalWashingDailyAnalysisKFItem.dto;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.OrgCommonDto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CreateCoalWashingDailyAnalysisKFItemDto extends OrgCommonDto {}
|
||||
@@ -0,0 +1,8 @@
|
||||
package cn.lihongjie.coal.coalWashingDailyAnalysisKFItem.dto;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.OrgCommonDto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UpdateCoalWashingDailyAnalysisKFItemDto extends OrgCommonDto {}
|
||||
@@ -0,0 +1,58 @@
|
||||
package cn.lihongjie.coal.coalWashingDailyAnalysisKFItem.entity;
|
||||
|
||||
import cn.lihongjie.coal.base.entity.OrgCommonEntity;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysis.entity.CoalWashingDailyAnalysisEntity;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
@Table(
|
||||
indexes =
|
||||
@jakarta.persistence.Index(
|
||||
name = "idx_coalWashingDailyAnalysisKFItem_org_id",
|
||||
columnList = "organization_id"))
|
||||
public class CoalWashingDailyAnalysisKFItemEntity extends OrgCommonEntity {
|
||||
|
||||
|
||||
@ManyToOne
|
||||
private CoalWashingDailyAnalysisEntity coalWashingDailyAnalysis;
|
||||
|
||||
private LocalDate date;
|
||||
private LocalTime time;
|
||||
|
||||
private String name;
|
||||
private Double param1;
|
||||
private Double param2;
|
||||
private Double param3;
|
||||
private Double param4;
|
||||
private Double param5;
|
||||
private Double param6;
|
||||
private Double param7;
|
||||
private Double param8;
|
||||
private Double param9;
|
||||
private Double param10;
|
||||
private Double param11;
|
||||
private Double param12;
|
||||
private Double param13;
|
||||
private Double param14;
|
||||
private Double param15;
|
||||
private Double param16;
|
||||
private Double param17;
|
||||
private Double param18;
|
||||
private Double param19;
|
||||
private Double param20;
|
||||
|
||||
private String remark1;
|
||||
private String remark2;
|
||||
private String remark3;
|
||||
private String remark4;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package cn.lihongjie.coal.coalWashingDailyAnalysisKFItem.mapper;
|
||||
|
||||
import cn.lihongjie.coal.base.mapper.BaseMapper;
|
||||
import cn.lihongjie.coal.base.mapper.CommonEntityMapper;
|
||||
import cn.lihongjie.coal.base.mapper.CommonMapper;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysisKFItem.dto.CoalWashingDailyAnalysisKFItemDto;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysisKFItem.dto.CreateCoalWashingDailyAnalysisKFItemDto;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysisKFItem.dto.UpdateCoalWashingDailyAnalysisKFItemDto;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysisKFItem.entity.CoalWashingDailyAnalysisKFItemEntity;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.control.DeepClone;
|
||||
|
||||
@Mapper(
|
||||
componentModel = org.mapstruct.MappingConstants.ComponentModel.SPRING,
|
||||
uses = {CommonMapper.class, CommonEntityMapper.class},
|
||||
mappingControl = DeepClone.class)
|
||||
public interface CoalWashingDailyAnalysisKFItemMapper
|
||||
extends BaseMapper<
|
||||
CoalWashingDailyAnalysisKFItemEntity,
|
||||
CoalWashingDailyAnalysisKFItemDto,
|
||||
CreateCoalWashingDailyAnalysisKFItemDto,
|
||||
UpdateCoalWashingDailyAnalysisKFItemDto> {}
|
||||
@@ -0,0 +1,19 @@
|
||||
package cn.lihongjie.coal.coalWashingDailyAnalysisKFItem.repository;
|
||||
|
||||
import cn.lihongjie.coal.base.dao.BaseRepository;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysis.entity.CoalWashingDailyAnalysisEntity;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysisKFItem.entity.CoalWashingDailyAnalysisKFItemEntity;
|
||||
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface CoalWashingDailyAnalysisKFItemRepository
|
||||
extends BaseRepository<CoalWashingDailyAnalysisKFItemEntity> {
|
||||
@Query("select false")
|
||||
boolean isLinked(List<String> ids);
|
||||
|
||||
void deleteAllByCoalWashingDailyAnalysis(CoalWashingDailyAnalysisEntity entity);
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package cn.lihongjie.coal.coalWashingDailyAnalysisKFItem.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.coalWashingDailyAnalysisKFItem.dto.CoalWashingDailyAnalysisKFItemDto;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysisKFItem.dto.CreateCoalWashingDailyAnalysisKFItemDto;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysisKFItem.dto.UpdateCoalWashingDailyAnalysisKFItemDto;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysisKFItem.entity.CoalWashingDailyAnalysisKFItemEntity;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysisKFItem.mapper.CoalWashingDailyAnalysisKFItemMapper;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysisKFItem.repository.CoalWashingDailyAnalysisKFItemRepository;
|
||||
import cn.lihongjie.coal.dbFunctions.DbFunctionService;
|
||||
import cn.lihongjie.coal.exception.BizException;
|
||||
|
||||
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;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@Transactional
|
||||
public class CoalWashingDailyAnalysisKFItemService
|
||||
extends BaseService<
|
||||
CoalWashingDailyAnalysisKFItemEntity, CoalWashingDailyAnalysisKFItemRepository> {
|
||||
@Autowired private CoalWashingDailyAnalysisKFItemRepository repository;
|
||||
|
||||
@Autowired private CoalWashingDailyAnalysisKFItemMapper mapper;
|
||||
|
||||
@Autowired private ConversionService conversionService;
|
||||
|
||||
@Autowired private DbFunctionService dbFunctionService;
|
||||
|
||||
public CoalWashingDailyAnalysisKFItemDto create(
|
||||
CreateCoalWashingDailyAnalysisKFItemDto request) {
|
||||
CoalWashingDailyAnalysisKFItemEntity entity = mapper.toEntity(request);
|
||||
|
||||
this.repository.save(entity);
|
||||
return getById(entity.getId());
|
||||
}
|
||||
|
||||
public CoalWashingDailyAnalysisKFItemDto update(
|
||||
UpdateCoalWashingDailyAnalysisKFItemDto request) {
|
||||
CoalWashingDailyAnalysisKFItemEntity entity = this.repository.get(request.getId());
|
||||
this.mapper.updateEntity(entity, request);
|
||||
|
||||
this.repository.save(entity);
|
||||
|
||||
return getById(entity.getId());
|
||||
}
|
||||
|
||||
public void delete(IdRequest request) {
|
||||
boolean linked = this.repository.isLinked(request.getIds());
|
||||
|
||||
if (linked) {
|
||||
throw new BizException("数据已被关联,无法删除");
|
||||
}
|
||||
|
||||
this.repository.deleteAllById(request.getIds());
|
||||
}
|
||||
|
||||
public CoalWashingDailyAnalysisKFItemDto getById(String id) {
|
||||
CoalWashingDailyAnalysisKFItemEntity entity = repository.get(id);
|
||||
|
||||
return mapper.toDto(entity);
|
||||
}
|
||||
|
||||
public Page<CoalWashingDailyAnalysisKFItemDto> list(CommonQuery query) {
|
||||
Page<CoalWashingDailyAnalysisKFItemEntity> page =
|
||||
repository.findAll(
|
||||
query.specification(conversionService),
|
||||
PageRequest.of(
|
||||
query.getPageNo(),
|
||||
query.getPageSize(),
|
||||
Sort.by(query.getOrders())));
|
||||
|
||||
return page.map(this.mapper::toDto);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
|
||||
package scripts.dict
|
||||
|
||||
import cn.lihongjie.coal.base.dto.CommonQuery
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysisKFItem.controller.CoalWashingDailyAnalysisKFItemController
|
||||
import com.fasterxml.jackson.databind.ObjectMapper
|
||||
import org.springframework.context.ApplicationContext
|
||||
|
||||
ApplicationContext ioc = ioc
|
||||
|
||||
def controller = ioc.getBean(CoalWashingDailyAnalysisKFItemController.class)
|
||||
def objectMapper = ioc.getBean(ObjectMapper.class) as ObjectMapper
|
||||
|
||||
|
||||
|
||||
|
||||
return controller.list(params!=null ? objectMapper.convertValue(params, CommonQuery.class ) : new CommonQuery())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user