feat(cost): 添加生产指标计算结果模块
- 创建 CostProdMetricResult 实体类,包含主键、报表ID、指标ID、计算日期、班组、计算值等字段 - 创建 CostProdMetricResultBo 业务对象,用于接收前端参数并进行验证 - 创建 CostProdMetricResultVo 视图对象,用于返回给前端的数据结构 - 实现 CostProdMetricResultController 控制器,提供增删改查和导出功能 - 创建 CostProdMetricResultMapper 数据访问接口,继承 BaseMapperPlus - 实现 CostProdMetricResultServiceImpl 服务类,处理业务逻辑和数据操作 - 配置 CostProdMetricResultMapper.xml 映射文件,定义结果映射关系 - 添加完整的 CRUD 操作支持,包括分页查询、单条查询、新增、修改、删除和批量导出功能 - 集成 MyBatis-Plus 分页插件和 LambdaQueryWrapper 查询构建器 - 实现数据校验机制和 Excel 导出功能
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
package com.klp.cost.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.*;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.klp.common.annotation.RepeatSubmit;
|
||||
import com.klp.common.annotation.Log;
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.common.core.validate.AddGroup;
|
||||
import com.klp.common.core.validate.EditGroup;
|
||||
import com.klp.common.enums.BusinessType;
|
||||
import com.klp.common.utils.poi.ExcelUtil;
|
||||
import com.klp.cost.domain.vo.CostProdMetricResultVo;
|
||||
import com.klp.cost.domain.bo.CostProdMetricResultBo;
|
||||
import com.klp.cost.service.ICostProdMetricResultService;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 生产指标计算结果
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-06-17
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/cost/prodMetricResult")
|
||||
public class CostProdMetricResultController extends BaseController {
|
||||
|
||||
private final ICostProdMetricResultService iCostProdMetricResultService;
|
||||
|
||||
/**
|
||||
* 查询生产指标计算结果列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<CostProdMetricResultVo> list(CostProdMetricResultBo bo, PageQuery pageQuery) {
|
||||
return iCostProdMetricResultService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出生产指标计算结果列表
|
||||
*/
|
||||
@Log(title = "生产指标计算结果", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(CostProdMetricResultBo bo, HttpServletResponse response) {
|
||||
List<CostProdMetricResultVo> list = iCostProdMetricResultService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "生产指标计算结果", CostProdMetricResultVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取生产指标计算结果详细信息
|
||||
*
|
||||
* @param resultId 主键
|
||||
*/
|
||||
@GetMapping("/{resultId}")
|
||||
public R<CostProdMetricResultVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long resultId) {
|
||||
return R.ok(iCostProdMetricResultService.queryById(resultId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增生产指标计算结果
|
||||
*/
|
||||
@Log(title = "生产指标计算结果", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody CostProdMetricResultBo bo) {
|
||||
return toAjax(iCostProdMetricResultService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改生产指标计算结果
|
||||
*/
|
||||
@Log(title = "生产指标计算结果", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody CostProdMetricResultBo bo) {
|
||||
return toAjax(iCostProdMetricResultService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除生产指标计算结果
|
||||
*
|
||||
* @param resultIds 主键串
|
||||
*/
|
||||
@Log(title = "生产指标计算结果", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{resultIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] resultIds) {
|
||||
return toAjax(iCostProdMetricResultService.deleteWithValidByIds(Arrays.asList(resultIds), true));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user