| | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.purchase.dto.PurchaseLedgerDto; |
| | | import com.ruoyi.purchase.mapper.PurchaseLedgerTemplateMapper; |
| | | import com.ruoyi.purchase.mapper.SalesLedgerProductTemplateMapper; |
| | |
| | | @RequestMapping("/purchaseLedgerTemplate") |
| | | @Tag(name = "采购台账模板") |
| | | @AllArgsConstructor |
| | | public class PurchaseLedgerTemplateController { |
| | | public class PurchaseLedgerTemplateController extends BaseController { |
| | | |
| | | private PurchaseLedgerTemplateMapper purchaseLedgerTemplateMapper; |
| | | private SalesLedgerProductTemplateMapper salesLedgerProductTemplateMapper; |
| | |
| | | @PostMapping("/add") |
| | | @Log(title = "添加采购台账模板", businessType = BusinessType.INSERT) |
| | | @Operation(summary = "添加采购台账模板") |
| | | public AjaxResult add(@RequestBody PurchaseLedgerDto purchaseLedgerDto) { |
| | | public R<?> add(@RequestBody PurchaseLedgerDto purchaseLedgerDto) { |
| | | // 采购模板 |
| | | if(StringUtils.isNotEmpty(purchaseLedgerDto.getTemplateName())){ |
| | | // 模板名称不能重复,有重复就不需要新增了 |
| | |
| | | }); |
| | | } |
| | | } |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Log(title = "采购台账模板", businessType = BusinessType.DELETE) |
| | | @Operation(summary = "删除采购台账模板") |
| | | public AjaxResult delete(@RequestBody List<Long> id) { |
| | | if(CollectionUtils.isEmpty(id)) return AjaxResult.error("请选择要删除的采购台账模板"); |
| | | public R<?> delete(@RequestBody List<Long> id) { |
| | | if(CollectionUtils.isEmpty(id)) return R.fail("请选择要删除的采购台账模板"); |
| | | int result = purchaseLedgerTemplateMapper.deleteBatchIds(id); |
| | | salesLedgerProductTemplateMapper.delete(new LambdaQueryWrapper<SalesLedgerProductTemplate>() |
| | | .in(SalesLedgerProductTemplate::getSalesLedgerId, id)); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Log(title = "修改采购台账模板", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "修改采购台账模板") |
| | | public AjaxResult update(@RequestBody PurchaseLedgerDto purchaseLedgerDto) { |
| | | public R<?> update(@RequestBody PurchaseLedgerDto purchaseLedgerDto) { |
| | | // 模板名称不能重复,有重复就不需要新增了 |
| | | PurchaseLedgerTemplate purchaseLedgerTemplate = purchaseLedgerTemplateMapper |
| | | .selectOne(new LambdaQueryWrapper<PurchaseLedgerTemplate>() |
| | |
| | | salesLedgerProductTemplateMapper.insert(salesLedgerProductTemplate); |
| | | }); |
| | | } |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |