mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-01-25 15:55:18 +08:00
添加参数配置
This commit is contained in:
@@ -33,6 +33,11 @@ public class CoalWashingDailyAnalysisDto extends OrgCommonDto {
|
||||
@CollectionTable(foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||
private List<CoalWashingDailyAnalysisItemVo> rollingAvgItems;
|
||||
|
||||
@ElementCollection
|
||||
@Comment("参数配置")
|
||||
@CollectionTable(foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||
private List<CoalWashingDailyAnalysisItemVo> params;
|
||||
|
||||
@Comment("目标大堆 灰")
|
||||
private Double ddp1;
|
||||
|
||||
|
||||
@@ -33,6 +33,11 @@ public class CreateCoalWashingDailyAnalysisDto extends OrgCommonDto {
|
||||
@CollectionTable(foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||
private List<CoalWashingDailyAnalysisItemVo> rollingAvgItems;
|
||||
|
||||
@ElementCollection
|
||||
@Comment("参数配置")
|
||||
@CollectionTable(foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||
private List<CoalWashingDailyAnalysisItemVo> params;
|
||||
|
||||
@Comment("目标大堆 灰")
|
||||
private Double ddp1;
|
||||
|
||||
|
||||
@@ -33,6 +33,11 @@ public class UpdateCoalWashingDailyAnalysisDto extends OrgCommonDto {
|
||||
@CollectionTable(foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||
private List<CoalWashingDailyAnalysisItemVo> rollingAvgItems;
|
||||
|
||||
@ElementCollection
|
||||
@Comment("参数配置")
|
||||
@CollectionTable(foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||
private List<CoalWashingDailyAnalysisItemVo> params;
|
||||
|
||||
@Comment("目标大堆 灰")
|
||||
private Double ddp1;
|
||||
|
||||
|
||||
@@ -35,6 +35,11 @@ public class CoalWashingDailyAnalysisEntity extends OrgCommonEntity {
|
||||
@CollectionTable(foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||
private List<CoalWashingDailyAnalysisItemVo> rollingAvgItems;
|
||||
|
||||
@ElementCollection
|
||||
@Comment("参数配置")
|
||||
@CollectionTable(foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||
private List<CoalWashingDailyAnalysisItemVo> params;
|
||||
|
||||
@Comment("目标大堆 灰")
|
||||
private Double ddp1;
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package cn.lihongjie.coal.coalWashingDailyAnalysis.entity;
|
||||
|
||||
import jakarta.persistence.Embeddable;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
@Data
|
||||
@Embeddable
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class CoalWashingDailyAnalysisParamVo {
|
||||
|
||||
@Comment("名称")
|
||||
private String name;
|
||||
|
||||
@Comment("编码")
|
||||
private String code;
|
||||
|
||||
@Comment("备注")
|
||||
private String remarks;
|
||||
|
||||
@Comment("排序键")
|
||||
private Integer sortKey;
|
||||
|
||||
@Comment("常用状态 0 禁用 1 启用")
|
||||
private String status;
|
||||
}
|
||||
@@ -9,8 +9,10 @@ import cn.lihongjie.coal.coalWashingDailyAnalysisParam.dto.UpdateCoalWashingDail
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysisParam.entity.CoalWashingDailyAnalysisParamEntity;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysisParam.mapper.CoalWashingDailyAnalysisParamMapper;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysisParam.repository.CoalWashingDailyAnalysisParamRepository;
|
||||
import java.lang.String;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -18,55 +20,74 @@ import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class CoalWashingDailyAnalysisParamService extends BaseService<CoalWashingDailyAnalysisParamEntity, CoalWashingDailyAnalysisParamRepository> {
|
||||
@Autowired
|
||||
private CoalWashingDailyAnalysisParamRepository repository;
|
||||
public class CoalWashingDailyAnalysisParamService
|
||||
extends BaseService<
|
||||
CoalWashingDailyAnalysisParamEntity, CoalWashingDailyAnalysisParamRepository> {
|
||||
@Autowired private CoalWashingDailyAnalysisParamRepository repository;
|
||||
|
||||
@Autowired
|
||||
private CoalWashingDailyAnalysisParamMapper mapper;
|
||||
@Autowired private CoalWashingDailyAnalysisParamMapper mapper;
|
||||
|
||||
@Autowired
|
||||
private ConversionService conversionService;
|
||||
|
||||
public CoalWashingDailyAnalysisParamDto create(CreateCoalWashingDailyAnalysisParamDto request) {
|
||||
CoalWashingDailyAnalysisParamEntity entity = mapper.toEntity(request);
|
||||
@Autowired private ConversionService conversionService;
|
||||
|
||||
public CoalWashingDailyAnalysisParamDto create(CreateCoalWashingDailyAnalysisParamDto request) {
|
||||
CoalWashingDailyAnalysisParamEntity entity = mapper.toEntity(request);
|
||||
|
||||
this.repository.save(entity);
|
||||
return getById(entity.getId())
|
||||
;
|
||||
}
|
||||
return getById(entity.getId());
|
||||
}
|
||||
|
||||
public CoalWashingDailyAnalysisParamDto update(UpdateCoalWashingDailyAnalysisParamDto request) {
|
||||
CoalWashingDailyAnalysisParamEntity entity = this.repository.get(request.getId());
|
||||
public CoalWashingDailyAnalysisParamDto update(UpdateCoalWashingDailyAnalysisParamDto request) {
|
||||
CoalWashingDailyAnalysisParamEntity entity = this.repository.get(request.getId());
|
||||
this.mapper.updateEntity(entity, request);
|
||||
|
||||
this.repository.save(entity);
|
||||
|
||||
return getById(entity.getId())
|
||||
;
|
||||
}
|
||||
return getById(entity.getId());
|
||||
}
|
||||
|
||||
public void delete(IdRequest request) {
|
||||
this.repository.deleteAllById(request.getIds())
|
||||
;
|
||||
}
|
||||
public void delete(IdRequest request) {
|
||||
this.repository.deleteAllById(request.getIds());
|
||||
}
|
||||
|
||||
public CoalWashingDailyAnalysisParamDto getById(String id) {
|
||||
CoalWashingDailyAnalysisParamEntity entity = repository.get(id);
|
||||
public CoalWashingDailyAnalysisParamDto getById(String id) {
|
||||
CoalWashingDailyAnalysisParamEntity entity = repository.get(id);
|
||||
|
||||
return mapper.toDto(entity);
|
||||
}
|
||||
|
||||
return mapper.toDto(entity)
|
||||
;
|
||||
}
|
||||
public Page<CoalWashingDailyAnalysisParamDto> list(CommonQuery query) {
|
||||
Page<CoalWashingDailyAnalysisParamEntity> page =
|
||||
repository.findAll(
|
||||
query.specification(conversionService),
|
||||
PageRequest.of(
|
||||
query.getPageNo(),
|
||||
query.getPageSize(),
|
||||
Sort.by(query.getOrders())));
|
||||
|
||||
public Page<CoalWashingDailyAnalysisParamDto> list(CommonQuery query) {
|
||||
Page<CoalWashingDailyAnalysisParamEntity> page = repository.findAll(query.specification(conversionService), PageRequest.of(query.getPageNo(), query.getPageSize(), Sort.by(query.getOrders())));
|
||||
LinkedList<String> names = new LinkedList<>(Arrays.asList("重介精煤", "螺旋", "跳汰", "筛精", "浮精"));
|
||||
|
||||
if (page.isEmpty()) {
|
||||
|
||||
return page.map(this.mapper::toDto)
|
||||
;
|
||||
}
|
||||
for (int i = 0; i < 10; i++) {
|
||||
|
||||
CoalWashingDailyAnalysisParamEntity param =
|
||||
new CoalWashingDailyAnalysisParamEntity();
|
||||
|
||||
param.setName(names.isEmpty() ? "" : names.removeFirst());
|
||||
param.setCode("c" + i);
|
||||
param.setSortKey(i);
|
||||
param.setStatus(StringUtils.isNotEmpty(param.getName()) ? 1 : 0);
|
||||
this.save(param);
|
||||
}
|
||||
|
||||
return list(query);
|
||||
}
|
||||
|
||||
return page.map(this.mapper::toDto);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user