109 lines
3.5 KiB
Java
109 lines
3.5 KiB
Java
|
|
package com.klp.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.domain.vo.CostStandardConfigVo;
|
||
|
|
import com.klp.domain.bo.CostStandardConfigBo;
|
||
|
|
import com.klp.service.ICostStandardConfigService;
|
||
|
|
import com.klp.common.core.page.TableDataInfo;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 成本标准配置表
|
||
|
|
*
|
||
|
|
* @author klp
|
||
|
|
* @date 2025-11-25
|
||
|
|
*/
|
||
|
|
@Validated
|
||
|
|
@RequiredArgsConstructor
|
||
|
|
@RestController
|
||
|
|
@RequestMapping("/wms/cost/standard")
|
||
|
|
public class CostStandardConfigController extends BaseController {
|
||
|
|
|
||
|
|
private final ICostStandardConfigService iCostStandardConfigService;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 查询成本标准配置表列表
|
||
|
|
*/
|
||
|
|
@GetMapping("/list")
|
||
|
|
public TableDataInfo<CostStandardConfigVo> list(CostStandardConfigBo bo, PageQuery pageQuery) {
|
||
|
|
return iCostStandardConfigService.queryPageList(bo, pageQuery);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 导出成本标准配置表列表
|
||
|
|
*/
|
||
|
|
@Log(title = "成本标准配置表", businessType = BusinessType.EXPORT)
|
||
|
|
@PostMapping("/export")
|
||
|
|
public void export(CostStandardConfigBo bo, HttpServletResponse response) {
|
||
|
|
List<CostStandardConfigVo> list = iCostStandardConfigService.queryList(bo);
|
||
|
|
ExcelUtil.exportExcel(list, "成本标准配置表", CostStandardConfigVo.class, response);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 获取成本标准配置表详细信息
|
||
|
|
*
|
||
|
|
* @param configId 主键
|
||
|
|
*/
|
||
|
|
@GetMapping("/{configId}")
|
||
|
|
public R<CostStandardConfigVo> getInfo(@NotNull(message = "主键不能为空")
|
||
|
|
@PathVariable Long configId) {
|
||
|
|
return R.ok(iCostStandardConfigService.queryById(configId));
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 查询当前有效的成本标准
|
||
|
|
*/
|
||
|
|
@GetMapping("/current")
|
||
|
|
public R<CostStandardConfigVo> getCurrent() {
|
||
|
|
return R.ok(iCostStandardConfigService.queryCurrentEffective());
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 新增成本标准配置表
|
||
|
|
*/
|
||
|
|
@Log(title = "成本标准配置表", businessType = BusinessType.INSERT)
|
||
|
|
@RepeatSubmit()
|
||
|
|
@PostMapping()
|
||
|
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody CostStandardConfigBo bo) {
|
||
|
|
return toAjax(iCostStandardConfigService.insertByBo(bo));
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 修改成本标准配置表
|
||
|
|
*/
|
||
|
|
@Log(title = "成本标准配置表", businessType = BusinessType.UPDATE)
|
||
|
|
@RepeatSubmit()
|
||
|
|
@PutMapping()
|
||
|
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody CostStandardConfigBo bo) {
|
||
|
|
return toAjax(iCostStandardConfigService.updateByBo(bo));
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 删除成本标准配置表
|
||
|
|
*
|
||
|
|
* @param configIds 主键串
|
||
|
|
*/
|
||
|
|
@Log(title = "成本标准配置表", businessType = BusinessType.DELETE)
|
||
|
|
@DeleteMapping("/{configIds}")
|
||
|
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||
|
|
@PathVariable Long[] configIds) {
|
||
|
|
return toAjax(iCostStandardConfigService.deleteWithValidByIds(Arrays.asList(configIds), true));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|