mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-01-25 15:55:18 +08:00
生产报表项目配置CURD
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
package cn.lihongjie.coal.coalWashingDailyAnalysisParam.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.coalWashingDailyAnalysisParam.dto.CoalWashingDailyAnalysisParamDto;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysisParam.dto.CreateCoalWashingDailyAnalysisParamDto;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysisParam.dto.UpdateCoalWashingDailyAnalysisParamDto;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysisParam.service.CoalWashingDailyAnalysisParamService;
|
||||
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("/coalWashingDailyAnalysisParam")
|
||||
@SysLog(
|
||||
module = "生产报表项目配置"
|
||||
)
|
||||
@Slf4j
|
||||
@OrgScope
|
||||
public class CoalWashingDailyAnalysisParamController {
|
||||
@Autowired
|
||||
private CoalWashingDailyAnalysisParamService service;
|
||||
|
||||
@PostMapping("/create")
|
||||
public CoalWashingDailyAnalysisParamDto create(
|
||||
@RequestBody CreateCoalWashingDailyAnalysisParamDto request) {
|
||||
return this.service.create(request)
|
||||
;
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public CoalWashingDailyAnalysisParamDto update(
|
||||
@RequestBody UpdateCoalWashingDailyAnalysisParamDto request) {
|
||||
return this.service.update(request)
|
||||
;
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
public Object delete(@RequestBody IdRequest request) {
|
||||
this.service.delete(request);
|
||||
return true
|
||||
;
|
||||
}
|
||||
|
||||
@PostMapping("/getById")
|
||||
public CoalWashingDailyAnalysisParamDto getById(@RequestBody String request) {
|
||||
return this.service.getById(request)
|
||||
;
|
||||
}
|
||||
|
||||
@PostMapping("/list")
|
||||
public Page<CoalWashingDailyAnalysisParamDto> list(@RequestBody CommonQuery request) {
|
||||
return this.service.list(request)
|
||||
;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package cn.lihongjie.coal.coalWashingDailyAnalysisParam.dto;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.OrgCommonDto;
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
@Data
|
||||
public class CoalWashingDailyAnalysisParamDto extends OrgCommonDto {
|
||||
@Comment("上级名称")
|
||||
private String parentName;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package cn.lihongjie.coal.coalWashingDailyAnalysisParam.dto;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.OrgCommonDto;
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
@Data
|
||||
public class CreateCoalWashingDailyAnalysisParamDto extends OrgCommonDto {
|
||||
@Comment("上级名称")
|
||||
private String parentName;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package cn.lihongjie.coal.coalWashingDailyAnalysisParam.dto;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.OrgCommonDto;
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
@Data
|
||||
public class UpdateCoalWashingDailyAnalysisParamDto extends OrgCommonDto {
|
||||
@Comment("上级名称")
|
||||
private String parentName;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package cn.lihongjie.coal.coalWashingDailyAnalysisParam.entity;
|
||||
|
||||
import cn.lihongjie.coal.base.entity.OrgCommonEntity;
|
||||
import jakarta.persistence.Entity;
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
public class CoalWashingDailyAnalysisParamEntity extends OrgCommonEntity {
|
||||
|
||||
|
||||
@Comment("上级名称")
|
||||
private String parentName;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package cn.lihongjie.coal.coalWashingDailyAnalysisParam.mapper;
|
||||
|
||||
import cn.lihongjie.coal.base.mapper.BaseMapper;
|
||||
import cn.lihongjie.coal.base.mapper.CommonMapper;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysisParam.dto.CoalWashingDailyAnalysisParamDto;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysisParam.dto.CreateCoalWashingDailyAnalysisParamDto;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysisParam.dto.UpdateCoalWashingDailyAnalysisParamDto;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysisParam.entity.CoalWashingDailyAnalysisParamEntity;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.control.DeepClone;
|
||||
|
||||
@Mapper(
|
||||
componentModel = org.mapstruct.MappingConstants.ComponentModel.SPRING,
|
||||
uses = {CommonMapper.class},
|
||||
mappingControl = DeepClone.class
|
||||
)
|
||||
public interface CoalWashingDailyAnalysisParamMapper extends BaseMapper<CoalWashingDailyAnalysisParamEntity, CoalWashingDailyAnalysisParamDto, CreateCoalWashingDailyAnalysisParamDto, UpdateCoalWashingDailyAnalysisParamDto> {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package cn.lihongjie.coal.coalWashingDailyAnalysisParam.repository;
|
||||
|
||||
import cn.lihongjie.coal.base.dao.BaseRepository;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysisParam.entity.CoalWashingDailyAnalysisParamEntity;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface CoalWashingDailyAnalysisParamRepository extends BaseRepository<CoalWashingDailyAnalysisParamEntity> {
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package cn.lihongjie.coal.coalWashingDailyAnalysisParam.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.coalWashingDailyAnalysisParam.dto.CoalWashingDailyAnalysisParamDto;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysisParam.dto.CreateCoalWashingDailyAnalysisParamDto;
|
||||
import cn.lihongjie.coal.coalWashingDailyAnalysisParam.dto.UpdateCoalWashingDailyAnalysisParamDto;
|
||||
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.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 CoalWashingDailyAnalysisParamService extends BaseService<CoalWashingDailyAnalysisParamEntity, CoalWashingDailyAnalysisParamRepository> {
|
||||
@Autowired
|
||||
private CoalWashingDailyAnalysisParamRepository repository;
|
||||
|
||||
@Autowired
|
||||
private CoalWashingDailyAnalysisParamMapper mapper;
|
||||
|
||||
@Autowired
|
||||
private ConversionService conversionService;
|
||||
|
||||
public CoalWashingDailyAnalysisParamDto create(CreateCoalWashingDailyAnalysisParamDto request) {
|
||||
CoalWashingDailyAnalysisParamEntity entity = mapper.toEntity(request);
|
||||
|
||||
|
||||
this.repository.save(entity);
|
||||
return getById(entity.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())
|
||||
;
|
||||
}
|
||||
|
||||
public void delete(IdRequest request) {
|
||||
this.repository.deleteAllById(request.getIds())
|
||||
;
|
||||
}
|
||||
|
||||
public CoalWashingDailyAnalysisParamDto getById(String id) {
|
||||
CoalWashingDailyAnalysisParamEntity entity = repository.get(id);
|
||||
|
||||
|
||||
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())));
|
||||
|
||||
|
||||
return page.map(this.mapper::toDto)
|
||||
;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user