| 对比新文件 |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.account.mapper.sales.AccountSalesCollectionMapper"> |
| | | |
| | | <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.account.pojo.sales.AccountSalesCollection"> |
| | | <id column="id" property="id" /> |
| | | <result column="stock_out_record_ids" property="stockOutRecordIds" /> |
| | | <result column="create_user" property="createUser" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="update_user" property="updateUser" /> |
| | | <result column="update_time" property="updateTime" /> |
| | | <result column="dept_id" property="deptId" /> |
| | | <result column="customer_id" property="customerId" /> |
| | | <result column="collection_date" property="collectionDate" /> |
| | | <result column="collection_amount" property="collectionAmount" /> |
| | | <result column="collection_method" property="collectionMethod" /> |
| | | <result column="collection_number" property="collectionNumber" /> |
| | | <result column="remark" property="remark" /> |
| | | </resultMap> |
| | | <select id="listPageAccountSalesCollection" |
| | | resultType="com.ruoyi.account.bean.vo.sales.AccountSalesCollectionVo"> |
| | | select |
| | | A.* , |
| | | if(asd.receipt_number is not null, true, false) as isAccountStatemen |
| | | from (select ascc.*, |
| | | c.customer_name, |
| | | GROUP_CONCAT(sour.outbound_batches SEPARATOR ',') AS outboundBatches |
| | | from account_sales_collection ascc |
| | | left join customer c on ascc.customer_id = c.id |
| | | left join stock_out_record sour on FIND_IN_SET(sour.id, ascc.stock_out_record_ids) > 0 |
| | | GROUP BY ascc.id)A |
| | | left join account_statement_details asd on A.collection_number = asd.receipt_number |
| | | <where> |
| | | <if test="req.customerId != null"> |
| | | AND A.customer_id = #{req.customerId} |
| | | </if> |
| | | <if test="req.collectionNumber != null and req.collectionNumber != ''"> |
| | | AND A.collection_number LIKE CONCAT('%',#{req.collectionNumber},'%') |
| | | </if> |
| | | <if test="req.collectionMethod != null and req.collectionMethod != ''"> |
| | | AND A.collection_method LIKE CONCAT('%',#{req.collectionMethod},'%') |
| | | </if> |
| | | <if test="req.startDate != null and req.endDate != null"> |
| | | AND A.collection_date BETWEEN #{req.startDate} AND #{req.endDate} |
| | | </if> |
| | | </where> |
| | | |
| | | </select> |
| | | <select id="existsByStockOutRecordId" resultType="java.lang.Boolean"> |
| | | SELECT COUNT(*) > 0 |
| | | FROM account_sales_collection |
| | | WHERE |
| | | <foreach collection="stockOutRecordIds" item="id" open="(" separator=" OR " close=")"> |
| | | FIND_IN_SET(#{id}, stock_out_record_ids) |
| | | </foreach> |
| | | </select> |
| | | <select id="getOutboundBatchesByCustomer" |
| | | resultType="com.ruoyi.account.bean.vo.sales.SalesOutboundVo"> |
| | | SELECT |
| | | sor.id, |
| | | sor.outbound_batches, |
| | | sl.customer_name, |
| | | sor.create_time as shippingDate, |
| | | p.product_name, |
| | | pm.model as specification_model, |
| | | slp.tax_rate, |
| | | sor.stock_out_num * slp.tax_inclusive_unit_price as outboundAmount, |
| | | s.shipping_no, |
| | | sl.sales_contract_no |
| | | FROM stock_out_record sor |
| | | left join shipping_info s on sor.record_id = s.id |
| | | 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 |
| | | WHERE sor.record_type='13' and sor.approval_status=1 |
| | | and sl.customer_id=#{customerId} |
| | | |
| | | and sor.id NOT IN ( |
| | | SELECT DISTINCT SUBSTRING_INDEX(SUBSTRING_INDEX(a.stock_out_record_ids, ',', n.n), ',', -1) |
| | | FROM account_sales_collection a |
| | | CROSS JOIN ( |
| | | SELECT 1 n UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL |
| | | SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 |
| | | ) n |
| | | WHERE n.n <= CHAR_LENGTH(a.stock_out_record_ids) - CHAR_LENGTH(REPLACE(a.stock_out_record_ids, ',', '')) + 1 |
| | | ) |
| | | |
| | | order by sor.id DESC |
| | | </select> |
| | | <select id="selectIncomeStats" resultType="com.ruoyi.home.dto.IncomeExpenseAnalysisDto"> |
| | | SELECT DATE_FORMAT(collection_date, #{dateFormat}) AS dateStr, |
| | | IFNULL(SUM(collection_amount), 0) AS amount |
| | | FROM account_sales_collection |
| | | WHERE collection_date BETWEEN #{startStr} AND #{endStr} |
| | | GROUP BY dateStr |
| | | ORDER BY dateStr |
| | | </select> |
| | | |
| | | </mapper> |