103 lines
3.4 KiB
Java
103 lines
3.4 KiB
Java
|
|
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));
|
|||
|
|
}
|
|||
|
|
}
|