86 lines
3.3 KiB
Java
86 lines
3.3 KiB
Java
|
|
package com.klp.controller;
|
|||
|
|
|
|||
|
|
import com.klp.common.annotation.Log;
|
|||
|
|
import com.klp.common.annotation.RepeatSubmit;
|
|||
|
|
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.page.TableDataInfo;
|
|||
|
|
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.domain.bo.WmsProcessSpecVersionBo;
|
|||
|
|
import com.klp.domain.vo.WmsProcessSpecVersionVo;
|
|||
|
|
import com.klp.service.IWmsProcessSpecVersionService;
|
|||
|
|
import lombok.RequiredArgsConstructor;
|
|||
|
|
import org.springframework.validation.annotation.Validated;
|
|||
|
|
import org.springframework.web.bind.annotation.*;
|
|||
|
|
|
|||
|
|
import javax.servlet.http.HttpServletResponse;
|
|||
|
|
import javax.validation.constraints.NotEmpty;
|
|||
|
|
import javax.validation.constraints.NotNull;
|
|||
|
|
import java.util.Arrays;
|
|||
|
|
import java.util.List;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 规程版本
|
|||
|
|
*
|
|||
|
|
* @author klp
|
|||
|
|
*/
|
|||
|
|
@Validated
|
|||
|
|
@RequiredArgsConstructor
|
|||
|
|
@RestController
|
|||
|
|
@RequestMapping("/wms/processSpecVersion")
|
|||
|
|
public class WmsProcessSpecVersionController extends BaseController {
|
|||
|
|
|
|||
|
|
private final IWmsProcessSpecVersionService wmsProcessSpecVersionService;
|
|||
|
|
|
|||
|
|
@GetMapping("/list")
|
|||
|
|
public TableDataInfo<WmsProcessSpecVersionVo> list(WmsProcessSpecVersionBo bo, PageQuery pageQuery) {
|
|||
|
|
return wmsProcessSpecVersionService.queryPageList(bo, pageQuery);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
@Log(title = "规程版本", businessType = BusinessType.EXPORT)
|
|||
|
|
@PostMapping("/export")
|
|||
|
|
public void export(WmsProcessSpecVersionBo bo, HttpServletResponse response) {
|
|||
|
|
List<WmsProcessSpecVersionVo> list = wmsProcessSpecVersionService.queryList(bo);
|
|||
|
|
ExcelUtil.exportExcel(list, "规程版本", WmsProcessSpecVersionVo.class, response);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
@GetMapping("/{versionId}")
|
|||
|
|
public R<WmsProcessSpecVersionVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long versionId) {
|
|||
|
|
return R.ok(wmsProcessSpecVersionService.queryById(versionId));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
@Log(title = "规程版本", businessType = BusinessType.INSERT)
|
|||
|
|
@RepeatSubmit()
|
|||
|
|
@PostMapping()
|
|||
|
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody WmsProcessSpecVersionBo bo) {
|
|||
|
|
return toAjax(wmsProcessSpecVersionService.insertByBo(bo));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
@Log(title = "规程版本", businessType = BusinessType.UPDATE)
|
|||
|
|
@RepeatSubmit()
|
|||
|
|
@PutMapping()
|
|||
|
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsProcessSpecVersionBo bo) {
|
|||
|
|
return toAjax(wmsProcessSpecVersionService.updateByBo(bo));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 设为当前生效版本(同规程下仅一条生效)
|
|||
|
|
*/
|
|||
|
|
@Log(title = "规程版本生效", businessType = BusinessType.UPDATE)
|
|||
|
|
@RepeatSubmit()
|
|||
|
|
@PutMapping("/activate/{versionId}")
|
|||
|
|
public R<Void> activate(@NotNull(message = "主键不能为空") @PathVariable Long versionId) {
|
|||
|
|
return toAjax(wmsProcessSpecVersionService.activateVersion(versionId));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
@Log(title = "规程版本", businessType = BusinessType.DELETE)
|
|||
|
|
@DeleteMapping("/{versionIds}")
|
|||
|
|
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] versionIds) {
|
|||
|
|
return toAjax(wmsProcessSpecVersionService.deleteWithValidByIds(Arrays.asList(versionIds), true));
|
|||
|
|
}
|
|||
|
|
}
|