feat(oa): 新增 BOM 管理、产品管理和分类功能
- 添加 BOM 头和 BOM 明细相关实体、控制器、服务和 Mapper - 实现 BOM 头和 BOM 明细的增删查改功能 - 添加产品和产品分类相关实体、控制器、服务和 Mapper - 实现产品和产品分类的增删查改功能- 为所有新增功能添加相应的 Excel 导出功能
This commit is contained in:
@@ -0,0 +1,102 @@
|
||||
package com.gear.oa.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.gear.common.annotation.RepeatSubmit;
|
||||
import com.gear.common.annotation.Log;
|
||||
import com.gear.common.core.controller.BaseController;
|
||||
import com.gear.common.core.domain.PageQuery;
|
||||
import com.gear.common.core.domain.R;
|
||||
import com.gear.common.core.validate.AddGroup;
|
||||
import com.gear.common.core.validate.EditGroup;
|
||||
import com.gear.common.core.validate.QueryGroup;
|
||||
import com.gear.common.enums.BusinessType;
|
||||
import com.gear.common.utils.poi.ExcelUtil;
|
||||
import com.gear.oa.domain.vo.GearBomVo;
|
||||
import com.gear.oa.domain.bo.GearBomBo;
|
||||
import com.gear.oa.service.IGearBomService;
|
||||
import com.gear.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* BOM 头,关联产品或原材料
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-08-19
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/oa/bom")
|
||||
public class GearBomController extends BaseController {
|
||||
|
||||
private final IGearBomService iGearBomService;
|
||||
|
||||
/**
|
||||
* 查询BOM 头,关联产品或原材料列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<GearBomVo> list(GearBomBo bo, PageQuery pageQuery) {
|
||||
return iGearBomService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出BOM 头,关联产品或原材料列表
|
||||
*/
|
||||
@Log(title = "BOM 头,关联产品或原材料", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(GearBomBo bo, HttpServletResponse response) {
|
||||
List<GearBomVo> list = iGearBomService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "BOM 头,关联产品或原材料", GearBomVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取BOM 头,关联产品或原材料详细信息
|
||||
*
|
||||
* @param bomId 主键
|
||||
*/
|
||||
@GetMapping("/{bomId}")
|
||||
public R<GearBomVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long bomId) {
|
||||
return R.ok(iGearBomService.queryById(bomId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增BOM 头,关联产品或原材料
|
||||
*/
|
||||
@Log(title = "BOM 头,关联产品或原材料", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody GearBomBo bo) {
|
||||
return toAjax(iGearBomService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改BOM 头,关联产品或原材料
|
||||
*/
|
||||
@Log(title = "BOM 头,关联产品或原材料", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody GearBomBo bo) {
|
||||
return toAjax(iGearBomService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除BOM 头,关联产品或原材料
|
||||
*
|
||||
* @param bomIds 主键串
|
||||
*/
|
||||
@Log(title = "BOM 头,关联产品或原材料", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{bomIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] bomIds) {
|
||||
return toAjax(iGearBomService.deleteWithValidByIds(Arrays.asList(bomIds), true));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user