| | |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.HashMap; |
| | |
| | | @PostMapping("/add") |
| | | @Log(title = "添加采购台账模板", businessType = BusinessType.INSERT) |
| | | @ApiOperation(value = "添加采购台账模板") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult add(@RequestBody PurchaseLedgerDto purchaseLedgerDto) { |
| | | // 采购模板 |
| | | if(StringUtils.isNotEmpty(purchaseLedgerDto.getTemplateName())){ |
| | |
| | | @DeleteMapping("/delete") |
| | | @Log(title = "采购台账模板", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "删除采购台账模板") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult delete(@RequestBody List<Long> id) { |
| | | if(CollectionUtils.isEmpty(id)) return AjaxResult.error("请选择要删除的采购台账模板"); |
| | | int result = purchaseLedgerTemplateMapper.deleteBatchIds(id); |
| | |
| | | @PostMapping("/update") |
| | | @Log(title = "修改采购台账模板", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "修改采购台账模板") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult update(@RequestBody PurchaseLedgerDto purchaseLedgerDto) { |
| | | // 模板名称不能重复,有重复就不需要新增了 |
| | | PurchaseLedgerTemplate purchaseLedgerTemplate = purchaseLedgerTemplateMapper |
| | |
| | | SalesLedgerProductTemplate salesLedgerProductTemplate = new SalesLedgerProductTemplate(); |
| | | BeanUtils.copyProperties(product, salesLedgerProductTemplate); |
| | | salesLedgerProductTemplate.setSalesLedgerId(purchaseLedgerTemplate.getId()); |
| | | salesLedgerProductTemplate.setType(2); |
| | | salesLedgerProductTemplateMapper.insert(salesLedgerProductTemplate); |
| | | }); |
| | | } |