diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/controller/EnergyQuotaController.java b/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/controller/EnergyQuotaController.java new file mode 100644 index 00000000..978fcb72 --- /dev/null +++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/controller/EnergyQuotaController.java @@ -0,0 +1,161 @@ +/** + * BladeX Commercial License Agreement + * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. + *

+ * Use of this software is governed by the Commercial License Agreement + * obtained after purchasing a license from BladeX. + *

+ * 1. This software is for development use only under a valid license + * from BladeX. + *

+ * 2. Redistribution of this software's source code to any third party + * without a commercial license is strictly prohibited. + *

+ * 3. Licensees may copyright their own code but cannot use segments + * from this software for such purposes. Copyright of this software + * remains with BladeX. + *

+ * Using this software signifies agreement to this License, and the software + * must not be used for illegal purposes. + *

+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is + * not liable for any claims arising from secondary or illegal development. + *

+ * Author: Chill Zhuang (bladejava@qq.com) + */ +package org.springblade.desk.energy.controller; + +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import lombok.AllArgsConstructor; +import jakarta.validation.Valid; + +import org.springblade.core.secure.BladeUser; +import org.springblade.core.secure.annotation.IsAdmin; +import org.springblade.core.mp.support.Condition; +import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.Func; +import org.springframework.web.bind.annotation.*; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import org.springblade.desk.energy.pojo.entity.BsEnergyQuotaEntity; +import org.springblade.desk.energy.pojo.vo.BsEnergyQuotaVO; +import org.springblade.desk.energy.excel.BsEnergyQuotaExcel; +import org.springblade.desk.energy.wrapper.BsEnergyQuotaWrapper; +import org.springblade.desk.energy.service.IBsEnergyQuotaService; +import org.springblade.core.boot.ctrl.BladeController; +import org.springblade.core.tool.utils.DateUtil; +import org.springblade.core.excel.util.ExcelUtil; +import org.springblade.core.tool.constant.BladeConstant; +import java.util.Map; +import java.util.List; +import jakarta.servlet.http.HttpServletResponse; + +/** + * 能源定额 控制器 + * + * @author BladeX + * @since 2026-03-02 + */ +@RestController +@AllArgsConstructor +@RequestMapping("/bsEnergyQuota") +@Tag(name = "能源定额", description = "能源定额接口") +public class BsEnergyQuotaController extends BladeController { + + private final IBsEnergyQuotaService bsEnergyQuotaService; + + /** + * 能源定额 详情 + */ + @GetMapping("/detail") + @ApiOperationSupport(order = 1) + @Operation(summary = "详情", description = "传入bsEnergyQuota") + public R detail(BsEnergyQuotaEntity bsEnergyQuota) { + BsEnergyQuotaEntity detail = bsEnergyQuotaService.getOne(Condition.getQueryWrapper(bsEnergyQuota)); + return R.data(BsEnergyQuotaWrapper.build().entityVO(detail)); + } + /** + * 能源定额 分页 + */ + @GetMapping("/list") + @ApiOperationSupport(order = 2) + @Operation(summary = "分页", description = "传入bsEnergyQuota") + public R> list(@Parameter(hidden = true) @RequestParam Map bsEnergyQuota, Query query) { + IPage pages = bsEnergyQuotaService.page(Condition.getPage(query), Condition.getQueryWrapper(bsEnergyQuota, BsEnergyQuotaEntity.class)); + return R.data(BsEnergyQuotaWrapper.build().pageVO(pages)); + } + + /** + * 能源定额 自定义分页 + */ + @GetMapping("/page") + @ApiOperationSupport(order = 3) + @Operation(summary = "分页", description = "传入bsEnergyQuota") + public R> page(BsEnergyQuotaVO bsEnergyQuota, Query query) { + IPage pages = bsEnergyQuotaService.selectBsEnergyQuotaPage(Condition.getPage(query), bsEnergyQuota); + return R.data(pages); + } + + /** + * 能源定额 新增 + */ + @PostMapping("/save") + @ApiOperationSupport(order = 4) + @Operation(summary = "新增", description = "传入bsEnergyQuota") + public R save(@Valid @RequestBody BsEnergyQuotaEntity bsEnergyQuota) { + return R.status(bsEnergyQuotaService.save(bsEnergyQuota)); + } + + /** + * 能源定额 修改 + */ + @PostMapping("/update") + @ApiOperationSupport(order = 5) + @Operation(summary = "修改", description = "传入bsEnergyQuota") + public R update(@Valid @RequestBody BsEnergyQuotaEntity bsEnergyQuota) { + return R.status(bsEnergyQuotaService.updateById(bsEnergyQuota)); + } + + /** + * 能源定额 新增或修改 + */ + @PostMapping("/submit") + @ApiOperationSupport(order = 6) + @Operation(summary = "新增或修改", description = "传入bsEnergyQuota") + public R submit(@Valid @RequestBody BsEnergyQuotaEntity bsEnergyQuota) { + return R.status(bsEnergyQuotaService.saveOrUpdate(bsEnergyQuota)); + } + + /** + * 能源定额 删除 + */ + @PostMapping("/remove") + @ApiOperationSupport(order = 7) + @Operation(summary = "逻辑删除", description = "传入ids") + public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) { + return R.status(bsEnergyQuotaService.deleteLogic(Func.toLongList(ids))); + } + + + /** + * 导出数据 + */ + @IsAdmin + @GetMapping("/export-bsEnergyQuota") + @ApiOperationSupport(order = 9) + @Operation(summary = "导出数据", description = "传入bsEnergyQuota") + public void exportBsEnergyQuota(@Parameter(hidden = true) @RequestParam Map bsEnergyQuota, BladeUser bladeUser, HttpServletResponse response) { + QueryWrapper queryWrapper = Condition.getQueryWrapper(bsEnergyQuota, BsEnergyQuotaEntity.class); + //if (!AuthUtil.isAdministrator()) { + // queryWrapper.lambda().eq(BsEnergyQuota::getTenantId, bladeUser.getTenantId()); + //} + //queryWrapper.lambda().eq(BsEnergyQuotaEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED); + List list = bsEnergyQuotaService.exportBsEnergyQuota(queryWrapper); + ExcelUtil.export(response, "能源定额数据" + DateUtil.time(), "能源定额数据表", list, BsEnergyQuotaExcel.class); + } + +} diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/controller/EnergyTargetController.java b/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/controller/EnergyTargetController.java new file mode 100644 index 00000000..99d8fe4a --- /dev/null +++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/controller/EnergyTargetController.java @@ -0,0 +1,161 @@ +/** + * BladeX Commercial License Agreement + * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. + *

+ * Use of this software is governed by the Commercial License Agreement + * obtained after purchasing a license from BladeX. + *

+ * 1. This software is for development use only under a valid license + * from BladeX. + *

+ * 2. Redistribution of this software's source code to any third party + * without a commercial license is strictly prohibited. + *

+ * 3. Licensees may copyright their own code but cannot use segments + * from this software for such purposes. Copyright of this software + * remains with BladeX. + *

+ * Using this software signifies agreement to this License, and the software + * must not be used for illegal purposes. + *

+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is + * not liable for any claims arising from secondary or illegal development. + *

+ * Author: Chill Zhuang (bladejava@qq.com) + */ +package org.springblade.desk.energy.controller; + +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import lombok.AllArgsConstructor; +import jakarta.validation.Valid; + +import org.springblade.core.secure.BladeUser; +import org.springblade.core.secure.annotation.IsAdmin; +import org.springblade.core.mp.support.Condition; +import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.Func; +import org.springframework.web.bind.annotation.*; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import org.springblade.desk.energy.pojo.entity.BsEnergyTargetEntity; +import org.springblade.desk.energy.pojo.vo.BsEnergyTargetVO; +import org.springblade.desk.energy.excel.BsEnergyTargetExcel; +import org.springblade.desk.energy.wrapper.BsEnergyTargetWrapper; +import org.springblade.desk.energy.service.IBsEnergyTargetService; +import org.springblade.core.boot.ctrl.BladeController; +import org.springblade.core.tool.utils.DateUtil; +import org.springblade.core.excel.util.ExcelUtil; +import org.springblade.core.tool.constant.BladeConstant; +import java.util.Map; +import java.util.List; +import jakarta.servlet.http.HttpServletResponse; + +/** + * 能耗目标表 控制器 + * + * @author BladeX + * @since 2026-03-02 + */ +@RestController +@AllArgsConstructor +@RequestMapping("/bsEnergyTarget") +@Tag(name = "能耗目标表", description = "能耗目标表接口") +public class BsEnergyTargetController extends BladeController { + + private final IBsEnergyTargetService bsEnergyTargetService; + + /** + * 能耗目标表 详情 + */ + @GetMapping("/detail") + @ApiOperationSupport(order = 1) + @Operation(summary = "详情", description = "传入bsEnergyTarget") + public R detail(BsEnergyTargetEntity bsEnergyTarget) { + BsEnergyTargetEntity detail = bsEnergyTargetService.getOne(Condition.getQueryWrapper(bsEnergyTarget)); + return R.data(BsEnergyTargetWrapper.build().entityVO(detail)); + } + /** + * 能耗目标表 分页 + */ + @GetMapping("/list") + @ApiOperationSupport(order = 2) + @Operation(summary = "分页", description = "传入bsEnergyTarget") + public R> list(@Parameter(hidden = true) @RequestParam Map bsEnergyTarget, Query query) { + IPage pages = bsEnergyTargetService.page(Condition.getPage(query), Condition.getQueryWrapper(bsEnergyTarget, BsEnergyTargetEntity.class)); + return R.data(BsEnergyTargetWrapper.build().pageVO(pages)); + } + + /** + * 能耗目标表 自定义分页 + */ + @GetMapping("/page") + @ApiOperationSupport(order = 3) + @Operation(summary = "分页", description = "传入bsEnergyTarget") + public R> page(BsEnergyTargetVO bsEnergyTarget, Query query) { + IPage pages = bsEnergyTargetService.selectBsEnergyTargetPage(Condition.getPage(query), bsEnergyTarget); + return R.data(pages); + } + + /** + * 能耗目标表 新增 + */ + @PostMapping("/save") + @ApiOperationSupport(order = 4) + @Operation(summary = "新增", description = "传入bsEnergyTarget") + public R save(@Valid @RequestBody BsEnergyTargetEntity bsEnergyTarget) { + return R.status(bsEnergyTargetService.save(bsEnergyTarget)); + } + + /** + * 能耗目标表 修改 + */ + @PostMapping("/update") + @ApiOperationSupport(order = 5) + @Operation(summary = "修改", description = "传入bsEnergyTarget") + public R update(@Valid @RequestBody BsEnergyTargetEntity bsEnergyTarget) { + return R.status(bsEnergyTargetService.updateById(bsEnergyTarget)); + } + + /** + * 能耗目标表 新增或修改 + */ + @PostMapping("/submit") + @ApiOperationSupport(order = 6) + @Operation(summary = "新增或修改", description = "传入bsEnergyTarget") + public R submit(@Valid @RequestBody BsEnergyTargetEntity bsEnergyTarget) { + return R.status(bsEnergyTargetService.saveOrUpdate(bsEnergyTarget)); + } + + /** + * 能耗目标表 删除 + */ + @PostMapping("/remove") + @ApiOperationSupport(order = 7) + @Operation(summary = "逻辑删除", description = "传入ids") + public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) { + return R.status(bsEnergyTargetService.deleteLogic(Func.toLongList(ids))); + } + + + /** + * 导出数据 + */ + @IsAdmin + @GetMapping("/export-bsEnergyTarget") + @ApiOperationSupport(order = 9) + @Operation(summary = "导出数据", description = "传入bsEnergyTarget") + public void exportBsEnergyTarget(@Parameter(hidden = true) @RequestParam Map bsEnergyTarget, BladeUser bladeUser, HttpServletResponse response) { + QueryWrapper queryWrapper = Condition.getQueryWrapper(bsEnergyTarget, BsEnergyTargetEntity.class); + //if (!AuthUtil.isAdministrator()) { + // queryWrapper.lambda().eq(BsEnergyTarget::getTenantId, bladeUser.getTenantId()); + //} + //queryWrapper.lambda().eq(BsEnergyTargetEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED); + List list = bsEnergyTargetService.exportBsEnergyTarget(queryWrapper); + ExcelUtil.export(response, "能耗目标表数据" + DateUtil.time(), "能耗目标表数据表", list, BsEnergyTargetExcel.class); + } + +} diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/excel/BsEnergyQuotaExcel.java b/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/excel/BsEnergyQuotaExcel.java new file mode 100644 index 00000000..d5e5c546 --- /dev/null +++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/excel/BsEnergyQuotaExcel.java @@ -0,0 +1,116 @@ +/** + * BladeX Commercial License Agreement + * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. + *

+ * Use of this software is governed by the Commercial License Agreement + * obtained after purchasing a license from BladeX. + *

+ * 1. This software is for development use only under a valid license + * from BladeX. + *

+ * 2. Redistribution of this software's source code to any third party + * without a commercial license is strictly prohibited. + *

+ * 3. Licensees may copyright their own code but cannot use segments + * from this software for such purposes. Copyright of this software + * remains with BladeX. + *

+ * Using this software signifies agreement to this License, and the software + * must not be used for illegal purposes. + *

+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is + * not liable for any claims arising from secondary or illegal development. + *

+ * Author: Chill Zhuang (bladejava@qq.com) + */ +package org.springblade.desk.energy.excel; + + +import lombok.Data; + +import java.util.Date; +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import com.alibaba.excel.annotation.write.style.ContentRowHeight; +import com.alibaba.excel.annotation.write.style.HeadRowHeight; +import java.io.Serializable; +import java.io.Serial; + + +/** + * 能源定额 Excel实体类 + * + * @author BladeX + * @since 2026-03-02 + */ +@Data +@ColumnWidth(25) +@HeadRowHeight(20) +@ContentRowHeight(18) +public class BsEnergyQuotaExcel implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ColumnWidth(20) + @ExcelProperty("ID") + private Long id; + /** + * 类型 1-用水 2-用电 + */ + @ColumnWidth(20) + @ExcelProperty("类型 1-用水 2-用电") + private String type; + /** + * 作业中心ID + */ + @ColumnWidth(20) + @ExcelProperty("作业中心ID") + private Long workCenterId; + /** + * 设备ID + */ + @ColumnWidth(20) + @ExcelProperty("设备ID") + private Long equipmentId; + /** + * 月份 + */ + @ColumnWidth(20) + @ExcelProperty("月份") + private String month; + /** + * 日期 + */ + @ColumnWidth(20) + @ExcelProperty("日期") + private String date; + /** + * 自来水用水量 + */ + @ColumnWidth(20) + @ExcelProperty("自来水用水量") + private Long tapWaterNum; + /** + * 纯水用水量 + */ + @ColumnWidth(20) + @ExcelProperty("纯水用水量") + private Long pureWaterNum; + /** + * 用电量 + */ + @ColumnWidth(20) + @ExcelProperty("用电量") + private Long electricNum; + /** + * 是否已删除 + */ + @ColumnWidth(20) + @ExcelProperty("是否已删除") + private Long isDeleted; + +} diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/excel/BsEnergyTargetExcel.java b/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/excel/BsEnergyTargetExcel.java new file mode 100644 index 00000000..fe13b63d --- /dev/null +++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/excel/BsEnergyTargetExcel.java @@ -0,0 +1,93 @@ +/** + * BladeX Commercial License Agreement + * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. + *

+ * Use of this software is governed by the Commercial License Agreement + * obtained after purchasing a license from BladeX. + *

+ * 1. This software is for development use only under a valid license + * from BladeX. + *

+ * 2. Redistribution of this software's source code to any third party + * without a commercial license is strictly prohibited. + *

+ * 3. Licensees may copyright their own code but cannot use segments + * from this software for such purposes. Copyright of this software + * remains with BladeX. + *

+ * Using this software signifies agreement to this License, and the software + * must not be used for illegal purposes. + *

+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is + * not liable for any claims arising from secondary or illegal development. + *

+ * Author: Chill Zhuang (bladejava@qq.com) + */ +package org.springblade.desk.energy.excel; + + +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import com.alibaba.excel.annotation.write.style.ContentRowHeight; +import com.alibaba.excel.annotation.write.style.HeadRowHeight; +import java.io.Serializable; +import java.io.Serial; + + +/** + * 能耗目标表 Excel实体类 + * + * @author BladeX + * @since 2026-03-02 + */ +@Data +@ColumnWidth(25) +@HeadRowHeight(20) +@ContentRowHeight(18) +public class BsEnergyTargetExcel implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ColumnWidth(20) + @ExcelProperty("ID") + private Long id; + /** + * 类型 1-用水 2-用电 + */ + @ColumnWidth(20) + @ExcelProperty("类型 1-用水 2-用电") + private String type; + /** + * 月份 + */ + @ColumnWidth(20) + @ExcelProperty("月份") + private String month; + /** + * 日期 + */ + @ColumnWidth(20) + @ExcelProperty("日期") + private String date; + /** + * 目标 + */ + @ColumnWidth(20) + @ExcelProperty("目标") + private Long target; + /** + * 是否已删除 + */ + @ColumnWidth(20) + @ExcelProperty("是否已删除") + private Long isDeleted; + +} diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/mapper/EnergyQuotaMapper.java b/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/mapper/EnergyQuotaMapper.java new file mode 100644 index 00000000..7811efde --- /dev/null +++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/mapper/EnergyQuotaMapper.java @@ -0,0 +1,63 @@ +/** + * BladeX Commercial License Agreement + * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. + *

+ * Use of this software is governed by the Commercial License Agreement + * obtained after purchasing a license from BladeX. + *

+ * 1. This software is for development use only under a valid license + * from BladeX. + *

+ * 2. Redistribution of this software's source code to any third party + * without a commercial license is strictly prohibited. + *

+ * 3. Licensees may copyright their own code but cannot use segments + * from this software for such purposes. Copyright of this software + * remains with BladeX. + *

+ * Using this software signifies agreement to this License, and the software + * must not be used for illegal purposes. + *

+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is + * not liable for any claims arising from secondary or illegal development. + *

+ * Author: Chill Zhuang (bladejava@qq.com) + */ +package org.springblade.desk.energy.mapper; + +import org.springblade.desk.energy.pojo.entity.BsEnergyQuotaEntity; +import org.springblade.desk.energy.pojo.vo.BsEnergyQuotaVO; +import org.springblade.desk.energy.excel.BsEnergyQuotaExcel; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import org.apache.ibatis.annotations.Param; +import java.util.List; + +/** + * 能源定额 Mapper 接口 + * + * @author BladeX + * @since 2026-03-02 + */ +public interface BsEnergyQuotaMapper extends BaseMapper { + + /** + * 自定义分页 + * + * @param page 分页参数 + * @param bsEnergyQuota 查询参数 + * @return List + */ + List selectBsEnergyQuotaPage(IPage page, BsEnergyQuotaVO bsEnergyQuota); + + + /** + * 获取导出数据 + * + * @param queryWrapper 查询条件 + * @return List + */ + List exportBsEnergyQuota(@Param("ew") Wrapper queryWrapper); + +} diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/mapper/EnergyQuotaMapper.xml b/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/mapper/EnergyQuotaMapper.xml new file mode 100644 index 00000000..f7a0db40 --- /dev/null +++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/mapper/EnergyQuotaMapper.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/mapper/EnergyTargetMapper.java b/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/mapper/EnergyTargetMapper.java new file mode 100644 index 00000000..16979f0f --- /dev/null +++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/mapper/EnergyTargetMapper.java @@ -0,0 +1,63 @@ +/** + * BladeX Commercial License Agreement + * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. + *

+ * Use of this software is governed by the Commercial License Agreement + * obtained after purchasing a license from BladeX. + *

+ * 1. This software is for development use only under a valid license + * from BladeX. + *

+ * 2. Redistribution of this software's source code to any third party + * without a commercial license is strictly prohibited. + *

+ * 3. Licensees may copyright their own code but cannot use segments + * from this software for such purposes. Copyright of this software + * remains with BladeX. + *

+ * Using this software signifies agreement to this License, and the software + * must not be used for illegal purposes. + *

+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is + * not liable for any claims arising from secondary or illegal development. + *

+ * Author: Chill Zhuang (bladejava@qq.com) + */ +package org.springblade.desk.energy.mapper; + +import org.springblade.desk.energy.pojo.entity.BsEnergyTargetEntity; +import org.springblade.desk.energy.pojo.vo.BsEnergyTargetVO; +import org.springblade.desk.energy.excel.BsEnergyTargetExcel; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import org.apache.ibatis.annotations.Param; +import java.util.List; + +/** + * 能耗目标表 Mapper 接口 + * + * @author BladeX + * @since 2026-03-02 + */ +public interface BsEnergyTargetMapper extends BaseMapper { + + /** + * 自定义分页 + * + * @param page 分页参数 + * @param bsEnergyTarget 查询参数 + * @return List + */ + List selectBsEnergyTargetPage(IPage page, BsEnergyTargetVO bsEnergyTarget); + + + /** + * 获取导出数据 + * + * @param queryWrapper 查询条件 + * @return List + */ + List exportBsEnergyTarget(@Param("ew") Wrapper queryWrapper); + +} diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/mapper/EnergyTargetMapper.xml b/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/mapper/EnergyTargetMapper.xml new file mode 100644 index 00000000..8362d7a0 --- /dev/null +++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/mapper/EnergyTargetMapper.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/pojo/dto/BsEnergyQuotaDTO.java b/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/pojo/dto/BsEnergyQuotaDTO.java new file mode 100644 index 00000000..bf206c9c --- /dev/null +++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/pojo/dto/BsEnergyQuotaDTO.java @@ -0,0 +1,45 @@ +/** + * BladeX Commercial License Agreement + * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. + *

+ * Use of this software is governed by the Commercial License Agreement + * obtained after purchasing a license from BladeX. + *

+ * 1. This software is for development use only under a valid license + * from BladeX. + *

+ * 2. Redistribution of this software's source code to any third party + * without a commercial license is strictly prohibited. + *

+ * 3. Licensees may copyright their own code but cannot use segments + * from this software for such purposes. Copyright of this software + * remains with BladeX. + *

+ * Using this software signifies agreement to this License, and the software + * must not be used for illegal purposes. + *

+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is + * not liable for any claims arising from secondary or illegal development. + *

+ * Author: Chill Zhuang (bladejava@qq.com) + */ +package org.springblade.desk.energy.pojo.dto; + +import org.springblade.desk.energy.pojo.entity.BsEnergyQuotaEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; +import java.io.Serial; + +/** + * 能源定额 数据传输对象实体类 + * + * @author BladeX + * @since 2026-03-02 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class BsEnergyQuotaDTO extends BsEnergyQuotaEntity { + @Serial + private static final long serialVersionUID = 1L; + +} diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/pojo/dto/BsEnergyTargetDTO.java b/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/pojo/dto/BsEnergyTargetDTO.java new file mode 100644 index 00000000..f47031de --- /dev/null +++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/pojo/dto/BsEnergyTargetDTO.java @@ -0,0 +1,45 @@ +/** + * BladeX Commercial License Agreement + * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. + *

+ * Use of this software is governed by the Commercial License Agreement + * obtained after purchasing a license from BladeX. + *

+ * 1. This software is for development use only under a valid license + * from BladeX. + *

+ * 2. Redistribution of this software's source code to any third party + * without a commercial license is strictly prohibited. + *

+ * 3. Licensees may copyright their own code but cannot use segments + * from this software for such purposes. Copyright of this software + * remains with BladeX. + *

+ * Using this software signifies agreement to this License, and the software + * must not be used for illegal purposes. + *

+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is + * not liable for any claims arising from secondary or illegal development. + *

+ * Author: Chill Zhuang (bladejava@qq.com) + */ +package org.springblade.desk.energy.pojo.dto; + +import org.springblade.desk.energy.pojo.entity.BsEnergyTargetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; +import java.io.Serial; + +/** + * 能耗目标表 数据传输对象实体类 + * + * @author BladeX + * @since 2026-03-02 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class BsEnergyTargetDTO extends BsEnergyTargetEntity { + @Serial + private static final long serialVersionUID = 1L; + +} diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/pojo/entity/BsEnergyQuotaEntity.java b/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/pojo/entity/BsEnergyQuotaEntity.java new file mode 100644 index 00000000..557f8ec0 --- /dev/null +++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/pojo/entity/BsEnergyQuotaEntity.java @@ -0,0 +1,93 @@ +/** + * BladeX Commercial License Agreement + * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. + *

+ * Use of this software is governed by the Commercial License Agreement + * obtained after purchasing a license from BladeX. + *

+ * 1. This software is for development use only under a valid license + * from BladeX. + *

+ * 2. Redistribution of this software's source code to any third party + * without a commercial license is strictly prohibited. + *

+ * 3. Licensees may copyright their own code but cannot use segments + * from this software for such purposes. Copyright of this software + * remains with BladeX. + *

+ * Using this software signifies agreement to this License, and the software + * must not be used for illegal purposes. + *

+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is + * not liable for any claims arising from secondary or illegal development. + *

+ * Author: Chill Zhuang (bladejava@qq.com) + */ +package org.springblade.desk.energy.pojo.entity; + +import lombok.Data; +import io.swagger.v3.oas.annotations.media.Schema; +import com.baomidou.mybatisplus.annotation.TableName; +import java.util.Date; +import lombok.EqualsAndHashCode; +import org.springblade.core.mp.base.BaseEntity; +import org.springblade.core.tenant.mp.TenantEntity; +import java.io.Serial; + +/** + * 能源定额 实体类 + * + * @author BladeX + * @since 2026-03-02 + */ +@Data +@TableName("BS_ENERGY_QUOTA") +@Schema(description = "BsEnergyQuota对象") +@EqualsAndHashCode(callSuper = true) +public class BsEnergyQuotaEntity extends BaseEntity { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 类型 1-用水 2-用电 + */ + @Schema(description = "类型 1-用水 2-用电") + private String type; + /** + * 作业中心ID + */ + @Schema(description = "作业中心ID") + private Long workCenterId; + /** + * 设备ID + */ + @Schema(description = "设备ID") + private Long equipmentId; + /** + * 月份 + */ + @Schema(description = "月份") + private String month; + /** + * 日期 + */ + @Schema(description = "日期") + private String date; + /** + * 自来水用水量 + */ + @Schema(description = "自来水用水量") + private Long tapWaterNum; + /** + * 纯水用水量 + */ + @Schema(description = "纯水用水量") + private Long pureWaterNum; + /** + * 用电量 + */ + @Schema(description = "用电量") + private Long electricNum; + +} diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/pojo/entity/BsEnergyTargetEntity.java b/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/pojo/entity/BsEnergyTargetEntity.java new file mode 100644 index 00000000..89db10d2 --- /dev/null +++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/pojo/entity/BsEnergyTargetEntity.java @@ -0,0 +1,74 @@ +/** + * BladeX Commercial License Agreement + * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. + *

+ * Use of this software is governed by the Commercial License Agreement + * obtained after purchasing a license from BladeX. + *

+ * 1. This software is for development use only under a valid license + * from BladeX. + *

+ * 2. Redistribution of this software's source code to any third party + * without a commercial license is strictly prohibited. + *

+ * 3. Licensees may copyright their own code but cannot use segments + * from this software for such purposes. Copyright of this software + * remains with BladeX. + *

+ * Using this software signifies agreement to this License, and the software + * must not be used for illegal purposes. + *

+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is + * not liable for any claims arising from secondary or illegal development. + *

+ * Author: Chill Zhuang (bladejava@qq.com) + */ +package org.springblade.desk.energy.pojo.entity; + +import lombok.Data; +import io.swagger.v3.oas.annotations.media.Schema; +import com.baomidou.mybatisplus.annotation.TableName; +import java.math.BigDecimal; +import java.util.Date; +import lombok.EqualsAndHashCode; +import org.springblade.core.mp.base.BaseEntity; +import org.springblade.core.tenant.mp.TenantEntity; +import java.io.Serial; + +/** + * 能耗目标表 实体类 + * + * @author BladeX + * @since 2026-03-02 + */ +@Data +@TableName("BS_ENERGY_TARGET") +@Schema(description = "BsEnergyTarget对象") +@EqualsAndHashCode(callSuper = true) +public class BsEnergyTargetEntity extends BaseEntity { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 类型 1-用水 2-用电 + */ + @Schema(description = "类型 1-用水 2-用电") + private String type; + /** + * 月份 + */ + @Schema(description = "月份") + private String month; + /** + * 日期 + */ + @Schema(description = "日期") + private String date; + /** + * 目标 + */ + @Schema(description = "目标") + private Long target; + +} diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/pojo/vo/BsEnergyQuotaVO.java b/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/pojo/vo/BsEnergyQuotaVO.java new file mode 100644 index 00000000..33179aeb --- /dev/null +++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/pojo/vo/BsEnergyQuotaVO.java @@ -0,0 +1,54 @@ +/** + * BladeX Commercial License Agreement + * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. + *

+ * Use of this software is governed by the Commercial License Agreement + * obtained after purchasing a license from BladeX. + *

+ * 1. This software is for development use only under a valid license + * from BladeX. + *

+ * 2. Redistribution of this software's source code to any third party + * without a commercial license is strictly prohibited. + *

+ * 3. Licensees may copyright their own code but cannot use segments + * from this software for such purposes. Copyright of this software + * remains with BladeX. + *

+ * Using this software signifies agreement to this License, and the software + * must not be used for illegal purposes. + *

+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is + * not liable for any claims arising from secondary or illegal development. + *

+ * Author: Chill Zhuang (bladejava@qq.com) + */ +package org.springblade.desk.energy.pojo.vo; + +import org.springblade.desk.energy.pojo.entity.BsEnergyQuotaEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; +import java.io.Serial; + +/** + * 能源定额 视图实体类 + * + * @author BladeX + * @since 2026-03-02 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class BsEnergyQuotaVO extends BsEnergyQuotaEntity { + @Serial + private static final long serialVersionUID = 1L; + + /** + * 作业中心名称 + */ + private String workCenterName; + + /** + * 设备名称 + */ + private String equipmentName; +} diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/pojo/vo/BsEnergyTargetVO.java b/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/pojo/vo/BsEnergyTargetVO.java new file mode 100644 index 00000000..7487e039 --- /dev/null +++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/pojo/vo/BsEnergyTargetVO.java @@ -0,0 +1,45 @@ +/** + * BladeX Commercial License Agreement + * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. + *

+ * Use of this software is governed by the Commercial License Agreement + * obtained after purchasing a license from BladeX. + *

+ * 1. This software is for development use only under a valid license + * from BladeX. + *

+ * 2. Redistribution of this software's source code to any third party + * without a commercial license is strictly prohibited. + *

+ * 3. Licensees may copyright their own code but cannot use segments + * from this software for such purposes. Copyright of this software + * remains with BladeX. + *

+ * Using this software signifies agreement to this License, and the software + * must not be used for illegal purposes. + *

+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is + * not liable for any claims arising from secondary or illegal development. + *

+ * Author: Chill Zhuang (bladejava@qq.com) + */ +package org.springblade.desk.energy.pojo.vo; + +import org.springblade.desk.energy.pojo.entity.BsEnergyTargetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; +import java.io.Serial; + +/** + * 能耗目标表 视图实体类 + * + * @author BladeX + * @since 2026-03-02 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class BsEnergyTargetVO extends BsEnergyTargetEntity { + @Serial + private static final long serialVersionUID = 1L; + +} diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/service/IBsEnergyQuotaService.java b/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/service/IBsEnergyQuotaService.java new file mode 100644 index 00000000..58a33667 --- /dev/null +++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/service/IBsEnergyQuotaService.java @@ -0,0 +1,61 @@ +/** + * BladeX Commercial License Agreement + * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. + *

+ * Use of this software is governed by the Commercial License Agreement + * obtained after purchasing a license from BladeX. + *

+ * 1. This software is for development use only under a valid license + * from BladeX. + *

+ * 2. Redistribution of this software's source code to any third party + * without a commercial license is strictly prohibited. + *

+ * 3. Licensees may copyright their own code but cannot use segments + * from this software for such purposes. Copyright of this software + * remains with BladeX. + *

+ * Using this software signifies agreement to this License, and the software + * must not be used for illegal purposes. + *

+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is + * not liable for any claims arising from secondary or illegal development. + *

+ * Author: Chill Zhuang (bladejava@qq.com) + */ +package org.springblade.desk.energy.service; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import org.springblade.desk.energy.pojo.entity.BsEnergyQuotaEntity; +import org.springblade.desk.energy.pojo.vo.BsEnergyQuotaVO; +import org.springblade.desk.energy.excel.BsEnergyQuotaExcel; +import com.baomidou.mybatisplus.core.metadata.IPage; +import org.springblade.core.mp.base.BaseService; +import java.util.List; + +/** + * 能源定额 服务类 + * + * @author BladeX + * @since 2026-03-02 + */ +public interface IBsEnergyQuotaService extends BaseService { + /** + * 自定义分页 + * + * @param page 分页参数 + * @param bsEnergyQuota 查询参数 + * @return IPage + */ + IPage selectBsEnergyQuotaPage(IPage page, BsEnergyQuotaVO bsEnergyQuota); + + + /** + * 导出数据 + * + * @param queryWrapper 查询条件 + * @return List + */ + List exportBsEnergyQuota(Wrapper queryWrapper); + +} diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/service/IBsEnergyTargetService.java b/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/service/IBsEnergyTargetService.java new file mode 100644 index 00000000..2eabef3b --- /dev/null +++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/service/IBsEnergyTargetService.java @@ -0,0 +1,61 @@ +/** + * BladeX Commercial License Agreement + * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. + *

+ * Use of this software is governed by the Commercial License Agreement + * obtained after purchasing a license from BladeX. + *

+ * 1. This software is for development use only under a valid license + * from BladeX. + *

+ * 2. Redistribution of this software's source code to any third party + * without a commercial license is strictly prohibited. + *

+ * 3. Licensees may copyright their own code but cannot use segments + * from this software for such purposes. Copyright of this software + * remains with BladeX. + *

+ * Using this software signifies agreement to this License, and the software + * must not be used for illegal purposes. + *

+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is + * not liable for any claims arising from secondary or illegal development. + *

+ * Author: Chill Zhuang (bladejava@qq.com) + */ +package org.springblade.desk.energy.service; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import org.springblade.desk.energy.pojo.entity.BsEnergyTargetEntity; +import org.springblade.desk.energy.pojo.vo.BsEnergyTargetVO; +import org.springblade.desk.energy.excel.BsEnergyTargetExcel; +import com.baomidou.mybatisplus.core.metadata.IPage; +import org.springblade.core.mp.base.BaseService; +import java.util.List; + +/** + * 能耗目标表 服务类 + * + * @author BladeX + * @since 2026-03-02 + */ +public interface IBsEnergyTargetService extends BaseService { + /** + * 自定义分页 + * + * @param page 分页参数 + * @param bsEnergyTarget 查询参数 + * @return IPage + */ + IPage selectBsEnergyTargetPage(IPage page, BsEnergyTargetVO bsEnergyTarget); + + + /** + * 导出数据 + * + * @param queryWrapper 查询条件 + * @return List + */ + List exportBsEnergyTarget(Wrapper queryWrapper); + +} diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/service/impl/EnergyQuotaServiceImpl.java b/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/service/impl/EnergyQuotaServiceImpl.java new file mode 100644 index 00000000..91d63c1c --- /dev/null +++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/service/impl/EnergyQuotaServiceImpl.java @@ -0,0 +1,63 @@ +/** + * BladeX Commercial License Agreement + * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. + *

+ * Use of this software is governed by the Commercial License Agreement + * obtained after purchasing a license from BladeX. + *

+ * 1. This software is for development use only under a valid license + * from BladeX. + *

+ * 2. Redistribution of this software's source code to any third party + * without a commercial license is strictly prohibited. + *

+ * 3. Licensees may copyright their own code but cannot use segments + * from this software for such purposes. Copyright of this software + * remains with BladeX. + *

+ * Using this software signifies agreement to this License, and the software + * must not be used for illegal purposes. + *

+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is + * not liable for any claims arising from secondary or illegal development. + *

+ * Author: Chill Zhuang (bladejava@qq.com) + */ +package org.springblade.desk.energy.service.impl; + +import org.springblade.desk.energy.pojo.entity.BsEnergyQuotaEntity; +import org.springblade.desk.energy.pojo.vo.BsEnergyQuotaVO; +import org.springblade.desk.energy.excel.BsEnergyQuotaExcel; +import org.springblade.desk.energy.mapper.BsEnergyQuotaMapper; +import org.springblade.desk.energy.service.IBsEnergyQuotaService; +import org.springframework.stereotype.Service; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import org.springblade.core.mp.base.BaseServiceImpl; +import java.util.List; + +/** + * 能源定额 服务实现类 + * + * @author BladeX + * @since 2026-03-02 + */ +@Service +public class BsEnergyQuotaServiceImpl extends BaseServiceImpl implements IBsEnergyQuotaService { + + @Override + public IPage selectBsEnergyQuotaPage(IPage page, BsEnergyQuotaVO bsEnergyQuota) { + return page.setRecords(baseMapper.selectBsEnergyQuotaPage(page, bsEnergyQuota)); + } + + + @Override + public List exportBsEnergyQuota(Wrapper queryWrapper) { + List bsEnergyQuotaList = baseMapper.exportBsEnergyQuota(queryWrapper); + //bsEnergyQuotaList.forEach(bsEnergyQuota -> { + // bsEnergyQuota.setTypeName(DictCache.getValue(DictEnum.YES_NO, BsEnergyQuota.getType())); + //}); + return bsEnergyQuotaList; + } + +} diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/service/impl/EnergyTargetServiceImpl.java b/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/service/impl/EnergyTargetServiceImpl.java new file mode 100644 index 00000000..e4d21b6f --- /dev/null +++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/service/impl/EnergyTargetServiceImpl.java @@ -0,0 +1,63 @@ +/** + * BladeX Commercial License Agreement + * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. + *

+ * Use of this software is governed by the Commercial License Agreement + * obtained after purchasing a license from BladeX. + *

+ * 1. This software is for development use only under a valid license + * from BladeX. + *

+ * 2. Redistribution of this software's source code to any third party + * without a commercial license is strictly prohibited. + *

+ * 3. Licensees may copyright their own code but cannot use segments + * from this software for such purposes. Copyright of this software + * remains with BladeX. + *

+ * Using this software signifies agreement to this License, and the software + * must not be used for illegal purposes. + *

+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is + * not liable for any claims arising from secondary or illegal development. + *

+ * Author: Chill Zhuang (bladejava@qq.com) + */ +package org.springblade.desk.energy.service.impl; + +import org.springblade.desk.energy.pojo.entity.BsEnergyTargetEntity; +import org.springblade.desk.energy.pojo.vo.BsEnergyTargetVO; +import org.springblade.desk.energy.excel.BsEnergyTargetExcel; +import org.springblade.desk.energy.mapper.BsEnergyTargetMapper; +import org.springblade.desk.energy.service.IBsEnergyTargetService; +import org.springframework.stereotype.Service; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import org.springblade.core.mp.base.BaseServiceImpl; +import java.util.List; + +/** + * 能耗目标表 服务实现类 + * + * @author BladeX + * @since 2026-03-02 + */ +@Service +public class BsEnergyTargetServiceImpl extends BaseServiceImpl implements IBsEnergyTargetService { + + @Override + public IPage selectBsEnergyTargetPage(IPage page, BsEnergyTargetVO bsEnergyTarget) { + return page.setRecords(baseMapper.selectBsEnergyTargetPage(page, bsEnergyTarget)); + } + + + @Override + public List exportBsEnergyTarget(Wrapper queryWrapper) { + List bsEnergyTargetList = baseMapper.exportBsEnergyTarget(queryWrapper); + //bsEnergyTargetList.forEach(bsEnergyTarget -> { + // bsEnergyTarget.setTypeName(DictCache.getValue(DictEnum.YES_NO, BsEnergyTarget.getType())); + //}); + return bsEnergyTargetList; + } + +} diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/wrapper/BsEnergyQuotaWrapper.java b/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/wrapper/BsEnergyQuotaWrapper.java new file mode 100644 index 00000000..903d647d --- /dev/null +++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/wrapper/BsEnergyQuotaWrapper.java @@ -0,0 +1,73 @@ +/** + * BladeX Commercial License Agreement + * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. + *

+ * Use of this software is governed by the Commercial License Agreement + * obtained after purchasing a license from BladeX. + *

+ * 1. This software is for development use only under a valid license + * from BladeX. + *

+ * 2. Redistribution of this software's source code to any third party + * without a commercial license is strictly prohibited. + *

+ * 3. Licensees may copyright their own code but cannot use segments + * from this software for such purposes. Copyright of this software + * remains with BladeX. + *

+ * Using this software signifies agreement to this License, and the software + * must not be used for illegal purposes. + *

+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is + * not liable for any claims arising from secondary or illegal development. + *

+ * Author: Chill Zhuang (bladejava@qq.com) + */ +package org.springblade.desk.energy.wrapper; + +import jakarta.annotation.Resource; +import org.springblade.core.mp.support.BaseEntityWrapper; +import org.springblade.core.tool.utils.BeanUtil; +import org.springblade.desk.basic.pojo.entity.WorkCenter; +import org.springblade.desk.basic.service.IWorkCenterService; +import org.springblade.desk.device.pojo.entity.EquipmentEntity; +import org.springblade.desk.device.service.IEquipmentService; +import org.springblade.desk.energy.pojo.entity.BsEnergyQuotaEntity; +import org.springblade.desk.energy.pojo.vo.BsEnergyQuotaVO; +import java.util.Objects; +import java.util.Optional; + +/** + * 能源定额 包装类,返回视图层所需的字段 + * + * @author BladeX + * @since 2026-03-02 + */ +public class BsEnergyQuotaWrapper extends BaseEntityWrapper { + + @Resource + private IWorkCenterService iWorkCenterService; + + @Resource + private IEquipmentService iEquipmentService; + + public static BsEnergyQuotaWrapper build() { + return new BsEnergyQuotaWrapper(); + } + + @Override + public BsEnergyQuotaVO entityVO(BsEnergyQuotaEntity bsEnergyQuota) { + BsEnergyQuotaVO bsEnergyQuotaVO = Objects.requireNonNull(BeanUtil.copyProperties(bsEnergyQuota, BsEnergyQuotaVO.class)); + WorkCenter workCenter = iWorkCenterService.getById(bsEnergyQuota.getWorkCenterId()); + if (workCenter != null) { + bsEnergyQuotaVO.setWorkCenterName(workCenter.getWcName()); + } + EquipmentEntity equipmentEntity = iEquipmentService.getById(bsEnergyQuota.getEquipmentId()); + if (equipmentEntity != null) { + bsEnergyQuotaVO.setEquipmentName(equipmentEntity.getDeviceName()); + } + return bsEnergyQuotaVO; + } + + +} diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/wrapper/BsEnergyTargetWrapper.java b/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/wrapper/BsEnergyTargetWrapper.java new file mode 100644 index 00000000..fa47776c --- /dev/null +++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/energy/wrapper/BsEnergyTargetWrapper.java @@ -0,0 +1,59 @@ +/** + * BladeX Commercial License Agreement + * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. + *

+ * Use of this software is governed by the Commercial License Agreement + * obtained after purchasing a license from BladeX. + *

+ * 1. This software is for development use only under a valid license + * from BladeX. + *

+ * 2. Redistribution of this software's source code to any third party + * without a commercial license is strictly prohibited. + *

+ * 3. Licensees may copyright their own code but cannot use segments + * from this software for such purposes. Copyright of this software + * remains with BladeX. + *

+ * Using this software signifies agreement to this License, and the software + * must not be used for illegal purposes. + *

+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is + * not liable for any claims arising from secondary or illegal development. + *

+ * Author: Chill Zhuang (bladejava@qq.com) + */ +package org.springblade.desk.energy.wrapper; + +import org.springblade.core.mp.support.BaseEntityWrapper; +import org.springblade.core.tool.utils.BeanUtil; +import org.springblade.desk.energy.pojo.entity.BsEnergyTargetEntity; +import org.springblade.desk.energy.pojo.vo.BsEnergyTargetVO; +import java.util.Objects; + +/** + * 能耗目标表 包装类,返回视图层所需的字段 + * + * @author BladeX + * @since 2026-03-02 + */ +public class BsEnergyTargetWrapper extends BaseEntityWrapper { + + public static BsEnergyTargetWrapper build() { + return new BsEnergyTargetWrapper(); + } + + @Override + public BsEnergyTargetVO entityVO(BsEnergyTargetEntity bsEnergyTarget) { + BsEnergyTargetVO bsEnergyTargetVO = Objects.requireNonNull(BeanUtil.copyProperties(bsEnergyTarget, BsEnergyTargetVO.class)); + + //User createUser = UserCache.getUser(bsEnergyTarget.getCreateUser()); + //User updateUser = UserCache.getUser(bsEnergyTarget.getUpdateUser()); + //bsEnergyTargetVO.setCreateUserName(createUser.getName()); + //bsEnergyTargetVO.setUpdateUserName(updateUser.getName()); + + return bsEnergyTargetVO; + } + + +}