feat(pltcm): 添加钢种分类管理功能
- 创建了钢种分类实体类 TdbSteelgrade 包含钢种名、冲压级别、屈服强度等字段 - 定义了业务对象 TdbSteelgradeBo 和视图对象 TdbSteelgradeVo - 实现了钢种分类的增删改查服务接口 ITdbSteelgradeService - 开发了钢种分类控制器 TdbSteelgradeController 提供 REST API 接口 - 配置了 MyBatis Plus 映射器和 XML 映射文件 - 实现了分页查询、导出 Excel、批量删除等功能 - 添加了数据验证和业务逻辑处理
This commit is contained in:
@@ -0,0 +1,98 @@
|
||||
package com.klp.pltcm.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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.pltcm.domain.vo.TdbSteelgradeVo;
|
||||
import com.klp.pltcm.domain.bo.TdbSteelgradeBo;
|
||||
import com.klp.pltcm.service.ITdbSteelgradeService;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 钢种分类
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-07-06
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/pltcm/steelgrade")
|
||||
public class TdbSteelgradeController extends BaseController {
|
||||
|
||||
private final ITdbSteelgradeService iTdbSteelgradeService;
|
||||
|
||||
/**
|
||||
* 查询钢种分类列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<TdbSteelgradeVo> list(TdbSteelgradeBo bo, PageQuery pageQuery) {
|
||||
return iTdbSteelgradeService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出钢种分类列表
|
||||
*/
|
||||
@Log(title = "钢种分类", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(TdbSteelgradeBo bo, HttpServletResponse response) {
|
||||
List<TdbSteelgradeVo> list = iTdbSteelgradeService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "钢种分类", TdbSteelgradeVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取钢种分类详细信息
|
||||
*
|
||||
* @param steelGrade 钢种名(主键)
|
||||
*/
|
||||
@GetMapping("/{steelGrade}")
|
||||
public R<TdbSteelgradeVo> getInfo(@NotBlank(message = "钢种名不能为空")
|
||||
@PathVariable String steelGrade) {
|
||||
return R.ok(iTdbSteelgradeService.queryById(steelGrade));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增钢种分类
|
||||
*/
|
||||
@Log(title = "钢种分类", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody TdbSteelgradeBo bo) {
|
||||
return toAjax(iTdbSteelgradeService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改钢种分类
|
||||
*/
|
||||
@Log(title = "钢种分类", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody TdbSteelgradeBo bo) {
|
||||
return toAjax(iTdbSteelgradeService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除钢种分类
|
||||
*
|
||||
* @param steelGrades 钢种名串
|
||||
*/
|
||||
@Log(title = "钢种分类", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{steelGrades}")
|
||||
public R<Void> remove(@NotEmpty(message = "钢种名不能为空")
|
||||
@PathVariable String[] steelGrades) {
|
||||
return toAjax(iTdbSteelgradeService.deleteWithValidByIds(java.util.Arrays.asList(steelGrades), true));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user