iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/ind/item/controller/IndItemController.java
@@ -1,18 +1,76 @@ package com.iailab.module.data.ind.item.controller; import com.iailab.framework.common.pojo.CommonResult; import com.iailab.framework.common.pojo.PageResult; import com.iailab.framework.common.util.object.BeanUtils; import com.iailab.module.data.ind.item.entity.IndItemEntity; import com.iailab.module.data.ind.item.service.IndItemService; import com.iailab.module.data.ind.item.vo.IndItemPageReqVO; import com.iailab.module.data.ind.item.vo.IndItemRespVO; import com.iailab.module.data.ind.item.vo.IndItemSaveReqVO; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; import static com.iailab.framework.common.pojo.CommonResult.success; /** * @author PanZhibao * @Description * @createTime 2024年09月11日 */ @Tag(name = "数据平台 - 指标定义") @Tag(name = "数据平台 - 指标项") @RestController @RequestMapping("/data/ind-item") @Validated public class IndItemController { @Autowired private IndItemService indItemService; @GetMapping("/page") @Operation(summary = "获取指标项列表", description = "用于【指标项】界面") @PreAuthorize("@ss.hasPermission('data:ind-item:query')") public CommonResult<PageResult<IndItemRespVO>> page(IndItemPageReqVO reqVO) { PageResult<IndItemEntity> page = indItemService.page(reqVO); return success(BeanUtils.toBean(page, IndItemRespVO.class)); } @PostMapping("/create") @Operation(summary = "创建指标项") @PreAuthorize("@ss.hasPermission('data:ind-item:create')") public CommonResult<Boolean> create(@Valid @RequestBody IndItemSaveReqVO createReqVO) { indItemService.create(createReqVO); return success(true); } @PutMapping("/update") @Operation(summary = "修改指标项") @PreAuthorize("@ss.hasPermission('data:ind-item:update')") public CommonResult<Boolean> update(@Valid @RequestBody IndItemSaveReqVO updateReqVO) { indItemService.update(updateReqVO); return success(true); } @DeleteMapping("/delete") @Operation(summary = "删除指标项") @Parameter(name = "id", description = "指标项编号", required= true, example = "1024") @PreAuthorize("@ss.hasPermission('data:ind-item:delete')") public CommonResult<Boolean> delete(@RequestParam("id") String id) { indItemService.delete(id); return success(true); } @GetMapping("/get") @Operation(summary = "获取指标项信息") @PreAuthorize("@ss.hasPermission('system:ind-item:query')") public CommonResult<IndItemRespVO> get(String id) { IndItemEntity entity = indItemService.get(id); return success(BeanUtils.toBean(entity, IndItemRespVO.class)); } } iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/ind/item/dao/IndItemDao.java
@@ -21,8 +21,8 @@ return selectPage(reqVO, new LambdaQueryWrapperX<IndItemEntity>() .likeIfPresent(IndItemEntity::getItemNo, reqVO.getItemNo()) .likeIfPresent(IndItemEntity::getItemName, reqVO.getItemName()) .eq(IndItemEntity::getItemType, reqVO.getItemType()) .eq(IndItemEntity::getItemCategory, reqVO.getItemCategory()) .eqIfPresent(IndItemEntity::getItemType, reqVO.getItemType()) .eqIfPresent(IndItemEntity::getItemCategory, reqVO.getItemCategory()) .orderByDesc(IndItemEntity::getCreateTime)); } } iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/ind/item/service/impl/IndItemServiceImpl.java
@@ -50,6 +50,4 @@ public void delete(String id) { baseDao.deleteById(id); } } iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/ind/value/controller/IndItemValueController.java
对比新文件 @@ -0,0 +1,77 @@ package com.iailab.module.data.ind.value.controller; import com.iailab.framework.common.pojo.CommonResult; import com.iailab.framework.common.pojo.PageResult; import com.iailab.framework.common.util.object.BeanUtils; import com.iailab.module.data.ind.item.vo.IndItemRespVO; import com.iailab.module.data.ind.value.entity.IndItemValueEntity; import com.iailab.module.data.ind.value.service.IndItemValueService; import com.iailab.module.data.ind.value.vo.IndItemValuePageReqVO; import com.iailab.module.data.ind.value.vo.IndItemValueSaveReqVO; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; import static com.iailab.framework.common.pojo.CommonResult.success; /** * @author PanZhibao * @Description * @createTime 2024年09月11日 */ @Tag(name = "数据平台 - 指标项") @RestController @RequestMapping("/data/ind-item-value") @Validated public class IndItemValueController { @Autowired private IndItemValueService indItemValueService; @GetMapping("/page") @Operation(summary = "获取指标项列表", description = "用于【指标项】界面") @PreAuthorize("@ss.hasPermission('data:ind-item-value:query')") public CommonResult<PageResult<IndItemRespVO>> page(IndItemValuePageReqVO reqVO) { PageResult<IndItemValueEntity> page = indItemValueService.page(reqVO); return success(BeanUtils.toBean(page, IndItemRespVO.class)); } @PostMapping("/create") @Operation(summary = "创建指标项") @PreAuthorize("@ss.hasPermission('data:ind-item-value:create')") public CommonResult<Boolean> create(@Valid @RequestBody IndItemValueSaveReqVO createReqVO) { indItemValueService.create(createReqVO); return success(true); } @PutMapping("/update") @Operation(summary = "修改指标项") @PreAuthorize("@ss.hasPermission('data:ind-item-value:update')") public CommonResult<Boolean> update(@Valid @RequestBody IndItemValueSaveReqVO updateReqVO) { indItemValueService.update(updateReqVO); return success(true); } @DeleteMapping("/delete") @Operation(summary = "删除指标项") @Parameter(name = "id", description = "指标项编号", required= true, example = "1024") @PreAuthorize("@ss.hasPermission('data:ind-item-value:delete')") public CommonResult<Boolean> delete(@RequestParam("id") String id) { indItemValueService.delete(id); return success(true); } @GetMapping("/get") @Operation(summary = "获取指标项信息") @PreAuthorize("@ss.hasPermission('system:ind-item:query')") public CommonResult<IndItemRespVO> get(String id) { IndItemValueEntity entity = indItemValueService.get(id); return success(BeanUtils.toBean(entity, IndItemRespVO.class)); } } iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/ind/value/dao/IndItemValueDao.java
对比新文件 @@ -0,0 +1,27 @@ package com.iailab.module.data.ind.value.dao; import com.iailab.framework.common.pojo.PageResult; import com.iailab.framework.mybatis.core.mapper.BaseMapperX; import com.iailab.framework.mybatis.core.query.LambdaQueryWrapperX; import com.iailab.framework.tenant.core.db.dynamic.TenantDS; import com.iailab.module.data.ind.value.entity.IndItemValueEntity; import com.iailab.module.data.ind.value.vo.IndItemValuePageReqVO; import org.apache.ibatis.annotations.Mapper; /** * @author PanZhibao * @Description * @createTime 2024年09月11日 */ @TenantDS @Mapper public interface IndItemValueDao extends BaseMapperX<IndItemValueEntity> { default PageResult<IndItemValueEntity> selectPage(IndItemValuePageReqVO reqVO) { return selectPage(reqVO, new LambdaQueryWrapperX<IndItemValueEntity>() .eq(IndItemValueEntity::getItemNo, reqVO.getItemNo()) .geIfPresent(IndItemValueEntity::getDataTime, reqVO.getStartTime()) .leIfPresent(IndItemValueEntity::getDataTime, reqVO.getEndTime()) .orderByDesc(IndItemValueEntity::getDataTime)); } } iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/ind/value/entity/IndItemValueEntity.java
对比新文件 @@ -0,0 +1,41 @@ package com.iailab.module.data.ind.value.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import java.io.Serializable; import java.math.BigDecimal; /** * @author PanZhibao * @Description * @createTime 2024年09月11日 */ @Data @TableName("t_ind_item_value") public class IndItemValueEntity implements Serializable { private static final long serialVersionUID = 1L; /** * 主键 */ @TableId(value = "id",type = IdType.INPUT) private String id; /** * 指标编码 */ private String itemNo; /** * 数据时间 */ private String dataTime; /** * 数据值 */ private BigDecimal dataValue; } iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/ind/value/package-info.java
对比新文件 @@ -0,0 +1 @@ package com.iailab.module.data.ind.value; iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/ind/value/service/IndItemValueService.java
对比新文件 @@ -0,0 +1,25 @@ package com.iailab.module.data.ind.value.service; import com.iailab.framework.common.pojo.PageResult; import com.iailab.framework.common.service.BaseService; import com.iailab.module.data.ind.value.entity.IndItemValueEntity; import com.iailab.module.data.ind.value.vo.IndItemValuePageReqVO; import com.iailab.module.data.ind.value.vo.IndItemValueSaveReqVO; /** * @author PanZhibao * @Description * @createTime 2024年09月11日 */ public interface IndItemValueService extends BaseService<IndItemValueEntity> { PageResult<IndItemValueEntity> page(IndItemValuePageReqVO reqVO); void create(IndItemValueSaveReqVO createReqVO); void update(IndItemValueSaveReqVO updateReqVO); IndItemValueEntity get(String id); void delete(String id); } iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/ind/value/service/impl/IndItemValueServiceImpl.java
对比新文件 @@ -0,0 +1,50 @@ package com.iailab.module.data.ind.value.service.impl; import com.iailab.framework.common.pojo.PageResult; import com.iailab.framework.common.service.impl.BaseServiceImpl; import com.iailab.framework.common.util.object.BeanUtils; import com.iailab.module.data.ind.value.dao.IndItemValueDao; import com.iailab.module.data.ind.value.entity.IndItemValueEntity; import com.iailab.module.data.ind.value.service.IndItemValueService; import com.iailab.module.data.ind.value.vo.IndItemValuePageReqVO; import com.iailab.module.data.ind.value.vo.IndItemValueSaveReqVO; import org.springframework.stereotype.Service; import java.util.UUID; /** * @author PanZhibao * @Description * @createTime 2024年09月11日 */ @Service public class IndItemValueServiceImpl extends BaseServiceImpl<IndItemValueDao, IndItemValueEntity> implements IndItemValueService { @Override public PageResult<IndItemValueEntity> page(IndItemValuePageReqVO reqVO) { return baseDao.selectPage(reqVO); } @Override public void create(IndItemValueSaveReqVO createReqVO) { IndItemValueEntity entity = BeanUtils.toBean(createReqVO, IndItemValueEntity.class); entity.setId(UUID.randomUUID().toString()); baseDao.insert(entity); } @Override public void update(IndItemValueSaveReqVO updateReqVO) { IndItemValueEntity entity = BeanUtils.toBean(updateReqVO, IndItemValueEntity.class); baseDao.updateById(entity); } @Override public IndItemValueEntity get(String id) { return baseDao.selectById(id); } @Override public void delete(String id) { baseDao.deleteById(id); } } iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/ind/value/vo/IndItemValuePageReqVO.java
对比新文件 @@ -0,0 +1,28 @@ package com.iailab.module.data.ind.value.vo; import com.iailab.framework.common.pojo.PageParam; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; /** * @author PanZhibao * @Description * @createTime 2024年09月11日 */ @Schema(description = "数据平台 - 指标值分页 Request VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class IndItemValuePageReqVO extends PageParam { @Schema(description = "指标编码", example = "") private String itemNo; @Schema(description = "开始时间", example = "") private String startTime; @Schema(description = "结束时间", example = "") private String endTime; } iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/ind/value/vo/IndItemValueRespVO.java
对比新文件 @@ -0,0 +1,32 @@ package com.iailab.module.data.ind.value.vo; import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; import com.alibaba.excel.annotation.ExcelProperty; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import java.math.BigDecimal; /** * @author PanZhibao * @Description * @createTime 2024年09月11日 */ @Schema(description = "数据平台 - 指标值 Response VO") @Data @ExcelIgnoreUnannotated public class IndItemValueRespVO { @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") @ExcelProperty("ID") private String id; @Schema(description = "指标编码", example = "") private String itemNo; @Schema(description = "数据时间", example = "") private String dataTime; @Schema(description = "数据值", example = "") private BigDecimal dataValue; } iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/ind/value/vo/IndItemValueSaveReqVO.java
对比新文件 @@ -0,0 +1,34 @@ package com.iailab.module.data.ind.value.vo; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import java.math.BigDecimal; /** * @author PanZhibao * @Description * @createTime 2024年09月11日 */ @Schema(description = "数据平台 - 指标值创建/修改 Request VO") @Data public class IndItemValueSaveReqVO { @Schema(description = "ID") private String id; /** * 指标编码 */ private String itemNo; /** * 数据时间 */ private String dataTime; /** * 数据值 */ private BigDecimal dataValue; }