refactor(dto): 为日期字段添加Spring日期格式化注解规范了日期范围查询SQL语句
| | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | |
| | | |
| | | @Schema(description = "开始日期") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date startDate; |
| | | |
| | | @Schema(description = "结束日期") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date endDate; |
| | | } |
| | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | |
| | | |
| | | @Schema(description = "开始日期") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date startDate; |
| | | |
| | | @Schema(description = "结束日期") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date endDate; |
| | | } |
| | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | |
| | | |
| | | @Schema(description = "开始日期") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date startDate; |
| | | |
| | | @Schema(description = "结束日期") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date endDate; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.utils.OrderUtils; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.procurementrecord.dto.ReturnManagementDto; |
| | | import com.ruoyi.procurementrecord.mapper.ReturnManagementMapper; |
| | | import com.ruoyi.procurementrecord.pojo.ReturnManagement; |
| | | import com.ruoyi.procurementrecord.pojo.ReturnSaleProduct; |
| | | import com.ruoyi.procurementrecord.service.ReturnManagementService; |
| | | import com.ruoyi.procurementrecord.service.ReturnSaleProductService; |
| | | import com.ruoyi.procurementrecord.service.impl.ReturnSaleProductServiceImpl; |
| | | import com.ruoyi.sales.dto.SalesLedgerDto; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | } |
| | | |
| | | @GetMapping("/getByShippingId") |
| | | @Operation(summary = "销售退货-根据出库单查询销售订单以及产品信息") |
| | | @Operation(summary = "销售退货-根据出库单查询销售订单以及发货产品信息") |
| | | public AjaxResult getByShippingId(Long shippingId) { |
| | | SalesLedgerDto salesLedgerDto = returnManagementService.getReturnManagementDtoByShippingIdId(shippingId); |
| | | return success(salesLedgerDto); |
| | |
| | | |
| | | |
| | | @GetMapping("/getByCustomerName") |
| | | @Operation(summary = "通过客户名称查询") |
| | | @Operation(summary = "通过客户名称查询关联的发货单号") |
| | | public AjaxResult getByCustomerName(String customerName) { |
| | | return AjaxResult.success(shippingInfoService.getShippingInfoByCustomerName(customerName)); |
| | | } |
| | |
| | | private List<Long> batchNo; |
| | | private List<ShippingProductDetail> batchNoDetailList; |
| | | |
| | | //关联的出库单号 |
| | | private String outboundBatches; |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | left join sales_ledger sl on si.sales_ledger_id = sl.id |
| | | where rm.id = #{id} |
| | | </select> |
| | | <select id="listPageBySalesReturn" resultType="com.ruoyi.account.bean.vo.SalesReturnVo"> |
| | | <select id="listPageAccountSalesReturn" resultType="com.ruoyi.account.bean.vo.SalesReturnVo"> |
| | | select rm.id, |
| | | rm.return_no, |
| | | c.customer_name, |
| | |
| | | and c.customer_name like concat('%',#{req.customerName},'%') |
| | | </if> |
| | | <if test="req.startDate != null and req.endDate != null"> |
| | | AND DATE_FORMAT(rm.make_time, '%Y-%m-%d') BETWEEN #{startDate} AND #{endDate} |
| | | AND DATE_FORMAT(rm.make_time, '%Y-%m-%d') BETWEEN #{req.startDate} AND #{req.endDate} |
| | | </if> |
| | | order by rm.id DESC |
| | | </select> |
| | |
| | | select pro.id, |
| | | pro.no returnNo, |
| | | sm.supplier_name, |
| | | |
| | | pro.prepared_at, |
| | | pro.total_amount, |
| | | CASE pro.return_type WHEN 0 THEN '退货退款' WHEN 1 THEN '拒收' END AS returnType, |
| | |
| | | from purchase_return_orders pro |
| | | left join supplier_manage sm on pro.supplier_id = sm.id |
| | | left join purchase_ledger pl on pro.purchase_ledger_id = pl.id |
| | | where rm.status=1 |
| | | where 1=1 |
| | | <if test="req.returnNo != null and req.returnNo != ''"> |
| | | and pro.no like concat('%',#{req.returnNo},'%') |
| | | </if> |
| | |
| | | and sm.supplier_name like concat('%',#{req.supplierName},'%') |
| | | </if> |
| | | <if test="req.startDate != null and req.endDate != null"> |
| | | AND DATE_FORMAT(pro.prepared_at, '%Y-%m-%d') BETWEEN #{startDate} AND #{endDate} |
| | | AND DATE_FORMAT(pro.prepared_at, '%Y-%m-%d') BETWEEN #{req.startDate} AND #{req.endDate} |
| | | </if> |
| | | order by pro.id DESC |
| | | </select> |
| | |
| | | pm.model as specification_model, |
| | | pm.unit, |
| | | p.product_name, |
| | | sl.customer_name |
| | | sl.customer_name, |
| | | sor.outbound_batches |
| | | FROM shipping_info s |
| | | LEFT JOIN sales_ledger sl ON s.sales_ledger_id = sl.id |
| | | LEFT JOIN sales_ledger_product slp ON s.sales_ledger_product_id = slp.id and slp.type = 1 |
| | | left join product_model pm on slp.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | left join stock_out_record sor on sor.record_id= s.id and sor.record_type='13' and sor.approval_status=1 |
| | | WHERE 1=1 |
| | | <if test="req.salesContractNo != null and req.salesContractNo != ''"> |
| | | AND sl.sales_contract_no LIKE CONCAT('%',#{req.salesContractNo},'%') |
| | |
| | | <select id="getShippingInfoByCustomerName" resultType="com.ruoyi.sales.pojo.ShippingInfo"> |
| | | select * from shipping_info si |
| | | left join sales_ledger sl on si.sales_ledger_id = sl.id |
| | | where si.status = '已发货' and sl.customer_name = #{customerName} |
| | | where sl.customer_name = #{customerName} |
| | | </select> |
| | | </mapper> |
| | |
| | | DATE(sir.create_time) AS inboundDate, |
| | | p.product_name, |
| | | pm.model as specification_model, |
| | | sor.stock_in_num * slp.tax_inclusive_unit_price AS InboundAmount, |
| | | sir.stock_in_num * slp.tax_inclusive_unit_price AS InboundAmount, |
| | | pl.purchase_contract_number |
| | | FROM stock_in_record sir |
| | | -- 10 类型才关联质检表 |
| | |
| | | LEFT JOIN purchase_ledger pl |
| | | ON pl.id = IF(sir.record_type = 7, sir.record_id, qi.purchase_ledger_id) |
| | | -- 产品关联不动 |
| | | LEFT JOIN sales_ledger_product slp ON slp.type = 2 AND pl.id = slp.product_id |
| | | LEFT JOIN product_model pm ON slp.product_model_id = pm.id |
| | | LEFT JOIN sales_ledger_product slp ON pl.id = slp.product_id |
| | | LEFT JOIN product_model pm ON sir.product_model_id = pm.id |
| | | LEFT JOIN product p ON pm.product_id = p.id |
| | | -- 条件 |
| | | WHERE sir.approval_status = 1 |
| | | WHERE sir.approval_status = 1 AND slp.type = 2 |
| | | AND sir.record_type IN ('7','10') |
| | | <if test="req.inboundBatches != null and req.inboundBatches != ''"> |
| | | AND sir.inbound_batches LIKE CONCAT('%',#{req.inboundBatches},'%') |
| | |
| | | AND pl.supplier_name LIKE CONCAT('%',#{req.supplierName},'%') |
| | | </if> |
| | | <if test="req.startDate != null and req.endDate != null"> |
| | | AND DATE(sir.create_time) BETWEEN #{startDate} AND #{endDate} |
| | | AND DATE(sir.create_time) BETWEEN #{req.startDate} AND #{req.endDate} |
| | | </if> |
| | | order by sir.id DESC |
| | | </select> |
| | |
| | | sor.id, |
| | | sor.outbound_batches, |
| | | sl.customer_name, |
| | | s.shipping_date, |
| | | sor.create_time as shippingDate, |
| | | p.product_name, |
| | | pm.model as specification_model, |
| | | sor.stock_out_num * slp.tax_inclusive_unit_price as outboundAmount, |
| | |
| | | LEFT JOIN sales_ledger_product slp ON s.sales_ledger_product_id = slp.id and slp.type = 1 |
| | | left join product_model pm on slp.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | WHERE s.status='已发货' and sor.record_type='13' |
| | | WHERE sor.record_type='13' and sor.approval_status=1 |
| | | <if test="req.outboundBatches != null and req.outboundBatches != ''"> |
| | | AND sor.outbound_batches LIKE CONCAT('%',#{req.outboundBatches},'%') |
| | | </if> |
| | |
| | | AND sl.customer_name LIKE CONCAT('%',#{req.customerName},'%') |
| | | </if> |
| | | <if test="req.startDate != null and req.endDate != null"> |
| | | AND s.shipping_date BETWEEN #{startDate} AND #{endDate} |
| | | AND s.shipping_date BETWEEN #{req.startDate} AND #{req.endDate} |
| | | </if> |
| | | order by sor.id DESC |
| | | </select> |