109 lines
3.5 KiB
Java
109 lines
3.5 KiB
Java
package com.ruoyi.mts.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.ruoyi.common.annotation.RepeatSubmit;
|
|
import com.ruoyi.common.annotation.Log;
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
import com.ruoyi.common.core.domain.PageQuery;
|
|
import com.ruoyi.common.core.domain.R;
|
|
import com.ruoyi.common.core.validate.AddGroup;
|
|
import com.ruoyi.common.core.validate.EditGroup;
|
|
import com.ruoyi.common.core.validate.QueryGroup;
|
|
import com.ruoyi.common.enums.BusinessType;
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
import com.ruoyi.mts.domain.vo.MesPlanDetailVo;
|
|
import com.ruoyi.mts.domain.bo.MesPlanDetailBo;
|
|
import com.ruoyi.mts.service.IMesPlanDetailService;
|
|
|
|
/**
|
|
* 生产计划明细
|
|
*
|
|
* @author jiangzhe
|
|
* @date 2024-02-19
|
|
*/
|
|
@Validated
|
|
@RequiredArgsConstructor
|
|
@RestController
|
|
@RequestMapping("/mts/planDetail")
|
|
public class MesPlanDetailController extends BaseController {
|
|
|
|
private final IMesPlanDetailService iMesPlanDetailService;
|
|
|
|
/**
|
|
* 查询生产计划明细列表
|
|
*/
|
|
@SaCheckPermission("mts:planDetail:list")
|
|
@GetMapping("/list")
|
|
public R<List<MesPlanDetailVo>> list(MesPlanDetailBo bo) {
|
|
List<MesPlanDetailVo> list = iMesPlanDetailService.queryList(bo);
|
|
return R.ok(list);
|
|
}
|
|
|
|
/**
|
|
* 导出生产计划明细列表
|
|
*/
|
|
@SaCheckPermission("mts:planDetail:export")
|
|
@Log(title = "生产计划明细", businessType = BusinessType.EXPORT)
|
|
@PostMapping("/export")
|
|
public void export(MesPlanDetailBo bo, HttpServletResponse response) {
|
|
List<MesPlanDetailVo> list = iMesPlanDetailService.queryList(bo);
|
|
ExcelUtil.exportExcel(list, "生产计划明细", MesPlanDetailVo.class, response);
|
|
}
|
|
|
|
/**
|
|
* 获取生产计划明细详细信息
|
|
*
|
|
* @param id 主键
|
|
*/
|
|
@SaCheckPermission("mts:planDetail:query")
|
|
@GetMapping("/{id}")
|
|
public R<MesPlanDetailVo> getInfo(@NotNull(message = "主键不能为空")
|
|
@PathVariable Long id) {
|
|
return R.ok(iMesPlanDetailService.queryById(id));
|
|
}
|
|
|
|
/**
|
|
* 新增生产计划明细
|
|
*/
|
|
@SaCheckPermission("mts:planDetail:add")
|
|
@Log(title = "生产计划明细", businessType = BusinessType.INSERT)
|
|
@RepeatSubmit()
|
|
@PostMapping()
|
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody MesPlanDetailBo bo) {
|
|
return toAjax(iMesPlanDetailService.insertByBo(bo));
|
|
}
|
|
|
|
/**
|
|
* 修改生产计划明细
|
|
*/
|
|
@SaCheckPermission("mts:planDetail:edit")
|
|
@Log(title = "生产计划明细", businessType = BusinessType.UPDATE)
|
|
@RepeatSubmit()
|
|
@PutMapping()
|
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody MesPlanDetailBo bo) {
|
|
return toAjax(iMesPlanDetailService.updateByBo(bo));
|
|
}
|
|
|
|
/**
|
|
* 删除生产计划明细
|
|
*
|
|
* @param ids 主键串
|
|
*/
|
|
@SaCheckPermission("mts:planDetail:remove")
|
|
@Log(title = "生产计划明细", businessType = BusinessType.DELETE)
|
|
@DeleteMapping("/{ids}")
|
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
|
@PathVariable Long[] ids) {
|
|
return toAjax(iMesPlanDetailService.deleteWithValidByIds(Arrays.asList(ids), true));
|
|
}
|
|
}
|