Files
klp-oa/klp-flow/src/main/java/com/klp/flow/controller/SchProdScheduleController.java

100 lines
3.2 KiB
Java
Raw Normal View History

package com.klp.flow.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.flow.domain.vo.SchProdScheduleVo;
import com.klp.flow.domain.bo.SchProdScheduleBo;
import com.klp.flow.service.ISchProdScheduleService;
import com.klp.common.core.page.TableDataInfo;
/**
* 排产单主
*
* @author klp
* @date 2026-06-23
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/flow/prodSchedule")
public class SchProdScheduleController extends BaseController {
private final ISchProdScheduleService iSchProdScheduleService;
/**
* 查询排产单主列表
*/
@GetMapping("/list")
public TableDataInfo<SchProdScheduleVo> list(SchProdScheduleBo bo, PageQuery pageQuery) {
return iSchProdScheduleService.queryPageList(bo, pageQuery);
}
/**
* 导出排产单主列表
*/
@Log(title = "排产单主", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(SchProdScheduleBo bo, HttpServletResponse response) {
List<SchProdScheduleVo> list = iSchProdScheduleService.queryList(bo);
ExcelUtil.exportExcel(list, "排产单主", SchProdScheduleVo.class, response);
}
/**
* 获取排产单主详细信息
*
* @param scheduleId 主键
*/
@GetMapping("/{scheduleId}")
public R<SchProdScheduleVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long scheduleId) {
return R.ok(iSchProdScheduleService.queryById(scheduleId));
}
/**
* 新增排产单主
*/
@Log(title = "排产单主", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody SchProdScheduleBo bo) {
return toAjax(iSchProdScheduleService.insertByBo(bo));
}
/**
* 修改排产单主
*/
@Log(title = "排产单主", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody SchProdScheduleBo bo) {
return toAjax(iSchProdScheduleService.updateByBo(bo));
}
/**
* 删除排产单主
*
* @param scheduleIds 主键串
*/
@Log(title = "排产单主", businessType = BusinessType.DELETE)
@DeleteMapping("/{scheduleIds}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] scheduleIds) {
return toAjax(iSchProdScheduleService.deleteWithValidByIds(Arrays.asList(scheduleIds), true));
}
}