提交基础采购
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
package com.klp.erp.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.erp.domain.bo.ErpSupplierPriceBo;
|
||||
import com.klp.erp.domain.bo.MaterialTypeQueryBo;
|
||||
import com.klp.erp.domain.vo.ErpSupplierPriceVo;
|
||||
import com.klp.erp.domain.vo.MaterialTypeOptionVo;
|
||||
import com.klp.erp.service.IErpSupplierPriceService;
|
||||
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;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/erp/supplierPrice")
|
||||
public class ErpSupplierPriceController extends BaseController {
|
||||
|
||||
private final IErpSupplierPriceService supplierPriceService;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<ErpSupplierPriceVo> list(ErpSupplierPriceBo bo, PageQuery pageQuery) {
|
||||
return supplierPriceService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@Log(title = "供应商价格", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(ErpSupplierPriceBo bo, HttpServletResponse response) {
|
||||
List<ErpSupplierPriceVo> list = supplierPriceService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "供应商价格", ErpSupplierPriceVo.class, response);
|
||||
}
|
||||
|
||||
@GetMapping("/{priceId}")
|
||||
public R<ErpSupplierPriceVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long priceId) {
|
||||
return R.ok(supplierPriceService.queryById(priceId));
|
||||
}
|
||||
|
||||
@Log(title = "供应商价格", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody ErpSupplierPriceBo bo) {
|
||||
return toAjax(supplierPriceService.insertByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "供应商价格", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody ErpSupplierPriceBo bo) {
|
||||
return toAjax(supplierPriceService.updateByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "供应商价格", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{priceIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] priceIds) {
|
||||
return toAjax(supplierPriceService.deleteWithValidByIds(Arrays.asList(priceIds), true));
|
||||
}
|
||||
|
||||
/**
|
||||
* 物料类型下拉
|
||||
*/
|
||||
@GetMapping("/material-types")
|
||||
public R<List<MaterialTypeOptionVo>> materialTypes(MaterialTypeQueryBo bo) {
|
||||
return R.ok(supplierPriceService.queryMaterialTypeOptions(bo));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user