客户库存盘点明细-增加公司的查询条件
This commit is contained in:
		
							parent
							
								
									1424cf2a1e
								
							
						
					
					
						commit
						18c82cbbb3
					
				|  | @ -140,12 +140,12 @@ public class StockReportController extends BaseController { | ||||||
|             HttpServletRequest request) { |             HttpServletRequest request) { | ||||||
|         Map<String, Object> result = new HashMap<>(); |         Map<String, Object> result = new HashMap<>(); | ||||||
|         Map<String, Object> params = new HashMap<>(); |         Map<String, Object> params = new HashMap<>(); | ||||||
|         // String token = request.getHeader("token"); |         String token = request.getHeader("token"); | ||||||
|         // if (!redisService.isKey(token)) { |         if (!redisService.isKey(token)) { | ||||||
|         //     return AjaxResult.error(ErrorUtils.IS_NOT_LOGIN_ERROR, "用户未登录"); |             return AjaxResult.error(ErrorUtils.IS_NOT_LOGIN_ERROR, "用户未登录"); | ||||||
|         // } |         } | ||||||
|         // Map<String, String> tokenMap = redisService.hmget(token); |         Map<String, String> tokenMap = redisService.hmget(token); | ||||||
|         // params.put("companyId", tokenMap.get("companyId")); |         params.put("companyId", tokenMap.get("companyId")); | ||||||
|         params.put("startDate", startDate); |         params.put("startDate", startDate); | ||||||
|         params.put("endDate", endDate); |         params.put("endDate", endDate); | ||||||
|         params.put("clientId", clientId); |         params.put("clientId", clientId); | ||||||
|  |  | ||||||
|  | @ -35,47 +35,6 @@ | ||||||
|         <result column="area_name" property="areaName" jdbcType="VARCHAR" /> |         <result column="area_name" property="areaName" jdbcType="VARCHAR" /> | ||||||
|     </resultMap> |     </resultMap> | ||||||
| 
 | 
 | ||||||
|     <!-- 表查询字段 --> |  | ||||||
|     <sql id="allColumns"> |  | ||||||
|         a.id, a.bill_id, a.bill_no, a.bill_date, a.client_id, a.confirm_status, a.create_time, a.goods_id,  |  | ||||||
|         a.goods_no, a.last_num, a.count_num, a.diff_num, a.company_id, a.remark, a.prod_date,a.join_fhd_num, |  | ||||||
|     </sql> |  | ||||||
| 
 |  | ||||||
|     <!-- 根据条件参数查询盘点子表列表 --> |  | ||||||
|     <select id="findCrmInventoryDetailByCondition" resultMap="stockReportMap" parameterType="map"> |  | ||||||
|         SELECT |  | ||||||
|             <include refid="allColumns" /> |  | ||||||
|             b.goods_name, b.unit_id, b.unit_name, b.specifications, b.goods_type_id, b.goods_type_name |  | ||||||
|         FROM crm_inventory_detail a |  | ||||||
|         LEFT JOIN crm_goods_info b ON a.goods_no = b.goods_no and a.company_id = b.company_id |  | ||||||
|         <where> |  | ||||||
|             <if test="billId != null and billId != ''"> |  | ||||||
|                 AND a.bill_id = #{billId} |  | ||||||
|             </if> |  | ||||||
|             <if test="clientId != null and clientId != ''"> |  | ||||||
|                 AND a.client_id = #{clientId} |  | ||||||
|             </if> |  | ||||||
|             <if test="confirmStatus != null and confirmStatus != ''"> |  | ||||||
|                 AND a.confirm_status = #{confirmStatus} |  | ||||||
|             </if> |  | ||||||
|             <if test="goodsNo != null and goodsNo != ''"> |  | ||||||
|                 AND a.goods_no = #{goodsNo} |  | ||||||
|             </if> |  | ||||||
|             <if test="companyId != null and companyId != ''"> |  | ||||||
|                 AND a.company_id = #{companyId} |  | ||||||
|             </if> |  | ||||||
|             <if test="startDateP != null and startDateP !=''"> |  | ||||||
|                 AND TO_CHAR(TO_DATE(SUBSTR(a.prod_date,1,10),'yyyy-MM-dd'),'yyyy-MM-dd') >= |  | ||||||
|                 TO_CHAR(TO_DATE(SUBSTR(#{startDateP},1,10),'yyyy-MM-dd'),'yyyy-MM-dd') |  | ||||||
|             </if> |  | ||||||
|             <if test="endDateP != null and endDateP !=''"> |  | ||||||
|                 AND TO_CHAR(TO_DATE(SUBSTR(a.prod_date,1,10),'yyyy-MM-dd'),'yyyy-MM-dd') <= |  | ||||||
|                 TO_CHAR(TO_DATE(SUBSTR(#{endDateP},1,10),'yyyy-MM-dd'),'yyyy-MM-dd') |  | ||||||
|             </if> |  | ||||||
|         </where> |  | ||||||
|         ORDER BY a.bill_date DESC,a.create_time DESC |  | ||||||
|     </select> |  | ||||||
| 
 |  | ||||||
|     <!-- 客户库存盘点明细 --> |     <!-- 客户库存盘点明细 --> | ||||||
|     <select id="getClientStockReportSql" resultType="map" parameterType="map"> |     <select id="getClientStockReportSql" resultType="map" parameterType="map"> | ||||||
|         SELECT t0.uecode "uecode", |         SELECT t0.uecode "uecode", | ||||||
|  | @ -99,7 +58,7 @@ | ||||||
|         b.goods_num |         b.goods_num | ||||||
|         FROM crm_inventory_info a |         FROM crm_inventory_info a | ||||||
|         LEFT JOIN pd1 b ON a.id = b.bill_id |         LEFT JOIN pd1 b ON a.id = b.bill_id | ||||||
|         WHERE a.confirm_status = '1' |         WHERE a.confirm_status = '1' AND a.company_id = #{companyId} | ||||||
|         <if test="startDate != null and startDate !=''"> |         <if test="startDate != null and startDate !=''"> | ||||||
|             AND TO_CHAR(TO_DATE(SUBSTR(a.bill_date,1,10),'yyyy-MM-dd'),'yyyy-MM-dd') >= |             AND TO_CHAR(TO_DATE(SUBSTR(a.bill_date,1,10),'yyyy-MM-dd'),'yyyy-MM-dd') >= | ||||||
|             TO_CHAR(TO_DATE(SUBSTR(#{startDate},1,10),'yyyy-MM-dd'),'yyyy-MM-dd') |             TO_CHAR(TO_DATE(SUBSTR(#{startDate},1,10),'yyyy-MM-dd'),'yyyy-MM-dd') | ||||||
|  | @ -114,7 +73,7 @@ | ||||||
|         ) t1 ON t0.id = t1.client_id |         ) t1 ON t0.id = t1.client_id | ||||||
|         LEFT JOIN (SELECT client_id, COUNT(1) bill_num |         LEFT JOIN (SELECT client_id, COUNT(1) bill_num | ||||||
|         FROM crm_inventory_info |         FROM crm_inventory_info | ||||||
|         WHERE confirm_status = '1' |         WHERE confirm_status = '1' AND company_id = #{companyId} | ||||||
|         <if test="startDate != null and startDate !=''"> |         <if test="startDate != null and startDate !=''"> | ||||||
|             AND TO_CHAR(TO_DATE(SUBSTR(bill_date,1,10),'yyyy-MM-dd'),'yyyy-MM-dd') >= |             AND TO_CHAR(TO_DATE(SUBSTR(bill_date,1,10),'yyyy-MM-dd'),'yyyy-MM-dd') >= | ||||||
|             TO_CHAR(TO_DATE(SUBSTR(#{startDate},1,10),'yyyy-MM-dd'),'yyyy-MM-dd') |             TO_CHAR(TO_DATE(SUBSTR(#{startDate},1,10),'yyyy-MM-dd'),'yyyy-MM-dd') | ||||||
|  | @ -124,9 +83,8 @@ | ||||||
|             TO_CHAR(TO_DATE(SUBSTR(#{endDate},1,10),'yyyy-MM-dd'),'yyyy-MM-dd') |             TO_CHAR(TO_DATE(SUBSTR(#{endDate},1,10),'yyyy-MM-dd'),'yyyy-MM-dd') | ||||||
|         </if> |         </if> | ||||||
|         GROUP BY client_id) t2 ON t0.id = t2.client_id |         GROUP BY client_id) t2 ON t0.id = t2.client_id | ||||||
|         WHERE t0.status = '1' |         WHERE t0.status = '1' AND t0.documents_status = '1' | ||||||
|         AND t0.documents_status = '1' |         AND t0.uecode IS NOT NULL AND t0.company_id = #{companyId} | ||||||
|         AND t0.uecode IS NOT NULL |  | ||||||
|     </select> |     </select> | ||||||
| 
 | 
 | ||||||
| </mapper> | </mapper> | ||||||
		Loading…
	
		Reference in New Issue