src/main/java/com/ruoyi/account/controller/sales/AccountInvoiceApplicationController.java
@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.*; import java.util.Arrays; import java.util.List; /** * <p> @@ -41,6 +42,13 @@ return R.ok(listPage); } @GetMapping("/getAccountInvoiceApplicationList") @Log(title = "根据客户id查询开票申请台账", businessType = BusinessType.OTHER) @Operation(summary = "财务管理--开票申请台账") public R<List<AccountInvoiceApplicationVo>> getAccountInvoiceApplicationList(@RequestParam Integer customerId){ return R.ok(accountInvoiceApplicationService.getAccountInvoiceApplicationList(customerId)); } @GetMapping("/getOutboundBatchesByCustomer") @Log(title = "根据客户查询出库单号(开票申请)", businessType = BusinessType.OTHER) @Operation(summary = "财务管理--根据客户查询出库单号(开票申请)") src/main/java/com/ruoyi/account/mapper/sales/AccountInvoiceApplicationMapper.java
@@ -29,4 +29,6 @@ //判断该出库记录是否有开票申请 boolean existsByStockOutRecordId(@Param("stockOutRecordIds") List<Long> stockOutRecordIds); List<AccountInvoiceApplicationVo> selectAccountInvoiceApplicationList(@Param("customerId") Integer customerId); } src/main/java/com/ruoyi/account/service/impl/sales/AccountInvoiceApplicationServiceImpl.java
@@ -91,6 +91,11 @@ return removeBatchByIds(ids); } @Override public List<AccountInvoiceApplicationVo> getAccountInvoiceApplicationList(Integer customerId) { return accountInvoiceApplicationMapper.selectAccountInvoiceApplicationList(customerId); } private String genInvoiceApplicationNo() { return "KP" + LocalDateTime.now().format(CODE_TIME_FORMATTER) + new Random().nextInt(10); } src/main/java/com/ruoyi/account/service/sales/AccountInvoiceApplicationService.java
@@ -30,4 +30,6 @@ void exportAccountInvoiceApplication(HttpServletResponse response, AccountInvoiceApplicationDto accountInvoiceApplicationDto); boolean deleteAccountInvoiceApplication(List<Long> ids); List<AccountInvoiceApplicationVo> getAccountInvoiceApplicationList(Integer customerId); } src/main/resources/mapper/account/sales/AccountInvoiceApplicationMapper.xml
@@ -72,5 +72,26 @@ </foreach> ) </select> <select id="selectAccountInvoiceApplicationList" resultType="com.ruoyi.account.bean.vo.sales.AccountInvoiceApplicationVo"> select * from ( select aia.*, asi.id AS sales_invoice_id, asi.status AS sales_invoice_status, c.customer_name, GROUP_CONCAT(sour.outbound_batches SEPARATOR ',') AS outboundBatches from account_invoice_application aia left join customer c on aia.customer_id = c.id left join stock_out_record sour on FIND_IN_SET(sour.id, aia.stock_out_record_ids) > 0 left join account_sales_invoice asi on aia.id = asi.account_invoice_application_id GROUP BY aia.id )A WHERE A.customer_id = #{customerId} AND (COALESCE(A.sales_invoice_id,'') = '' OR A.sales_invoice_status = 1) AND A.status = 1 order by A.id desc </select> </mapper>