|
|
@@ -308,21 +308,40 @@
|
|
308
|
308
|
LEFT JOIN role_info b ON b.role_id = a.post_type
|
|
309
|
309
|
LEFT JOIN basic_keeper_house h ON h.keeper_Id = a.id
|
|
310
|
310
|
LEFT JOIN basic_storehouse store ON store.storehouse_id = h.house_Id AND store.del_flag = 1
|
|
311
|
|
- LEFT JOIN basic_warehouse ware ON ware.storehouse_id = store.storehouse_id AND ware.del_flag = 1
|
|
312
|
|
- AND store.del_flag = 1
|
|
|
311
|
+ LEFT JOIN (
|
|
|
312
|
+ SELECT
|
|
|
313
|
+ *
|
|
|
314
|
+ FROM
|
|
|
315
|
+ (
|
|
|
316
|
+ SELECT
|
|
|
317
|
+ ROW_NUMBER () OVER (PARTITION BY storehouse_id ORDER BY crk_status desc) rn,
|
|
|
318
|
+ warehouse_id,
|
|
|
319
|
+ storehouse_id,
|
|
|
320
|
+ crk_status,
|
|
|
321
|
+ del_flag
|
|
|
322
|
+ FROM
|
|
|
323
|
+ basic_warehouse
|
|
|
324
|
+ WHERE
|
|
|
325
|
+ <if test="orgId != null" >
|
|
|
326
|
+ org_id = #{orgId,jdbcType=VARCHAR}
|
|
|
327
|
+ </if>
|
|
|
328
|
+ ) a
|
|
|
329
|
+ WHERE
|
|
|
330
|
+ rn = 1
|
|
|
331
|
+ ) ware ON ware.storehouse_id = store.storehouse_id AND ware.del_flag = 1
|
|
313
|
332
|
WHERE
|
|
314
|
333
|
(
|
|
315
|
|
- SELECT
|
|
316
|
|
- count(1)
|
|
317
|
|
- FROM
|
|
318
|
|
- business_agent_storehouse astore
|
|
319
|
|
- LEFT JOIN business_agent_depot depot ON astore.agent_depot_id = depot.id
|
|
320
|
|
- WHERE
|
|
321
|
|
- astore.storehouse_id = h.house_Id
|
|
322
|
|
- AND astore.del_flag = 1 AND depot.del_flag = 1
|
|
323
|
|
- <if test="orgId != null" >
|
|
324
|
|
- AND depot.depot_id = #{orgId,jdbcType=VARCHAR}
|
|
325
|
|
- </if>
|
|
|
334
|
+ SELECT
|
|
|
335
|
+ count(1)
|
|
|
336
|
+ FROM
|
|
|
337
|
+ business_agent_storehouse astore
|
|
|
338
|
+ LEFT JOIN business_agent_depot depot ON astore.agent_depot_id = depot.id
|
|
|
339
|
+ WHERE
|
|
|
340
|
+ astore.storehouse_id = h.house_Id
|
|
|
341
|
+ AND astore.del_flag = 1 AND depot.del_flag = 1
|
|
|
342
|
+ <if test="orgId != null" >
|
|
|
343
|
+ AND depot.depot_id = #{orgId,jdbcType=VARCHAR}
|
|
|
344
|
+ </if>
|
|
326
|
345
|
) = 0
|
|
327
|
346
|
AND a.user_Id = #{userId,jdbcType=VARCHAR}
|
|
328
|
347
|
AND ware.crk_status = 1
|
|
|
@@ -335,47 +354,11 @@
|
|
335
|
354
|
</select>
|
|
336
|
355
|
|
|
337
|
356
|
<select id="getCCBJLhouse" resultType="java.util.Map" parameterType="java.util.Map">
|
|
338
|
|
-<!-- SELECT-->
|
|
339
|
|
-<!-- k. NAME,-->
|
|
340
|
|
-<!-- store.storehouse_name houseName,-->
|
|
341
|
|
-<!-- store.storehouse_id houseId,-->
|
|
342
|
|
-<!-- store.storehouse_code houseCode,-->
|
|
343
|
|
-<!-- b.role_name roleName-->
|
|
344
|
|
-<!-- FROM-->
|
|
345
|
|
-<!-- basic_storehouse store-->
|
|
346
|
|
-<!-- LEFT JOIN basic_keeper k ON k.house_id = store.storehouse_id-->
|
|
347
|
|
-<!-- LEFT JOIN role_info b ON b.role_id = k.post_type-->
|
|
348
|
|
-<!-- LEFT JOIN basic_warehouse ware ON ware.storehouse_id = store.storehouse_id-->
|
|
349
|
|
-<!-- WHERE (-->
|
|
350
|
|
-<!-- SELECT-->
|
|
351
|
|
-<!-- count(1)-->
|
|
352
|
|
-<!-- FROM-->
|
|
353
|
|
-<!-- business_agent_storehouse astore-->
|
|
354
|
|
-<!-- LEFT JOIN business_agent_depot depot ON astore.agent_depot_id = depot.id-->
|
|
355
|
|
-<!-- WHERE-->
|
|
356
|
|
-<!-- astore.storehouse_id = store.storehouse_id-->
|
|
357
|
|
-<!-- AND astore.del_flag = 1-->
|
|
358
|
|
-<!-- AND depot.del_flag = 1-->
|
|
359
|
|
-<!-- AND depot.depot_id = #{orgId,jdbcType=VARCHAR}-->
|
|
360
|
|
-<!-- ) = 0-->
|
|
361
|
|
-<!-- AND store.del_flag = 1-->
|
|
362
|
|
-<!-- AND ware.crk_status = 1-->
|
|
363
|
|
-<!-- AND ware.del_flag = 1-->
|
|
364
|
|
-<!-- <if test="orgId != null" >-->
|
|
365
|
|
-<!-- AND store.org_id = #{orgId,jdbcType=VARCHAR}-->
|
|
366
|
|
-<!-- </if>-->
|
|
367
|
|
-<!-- UNION ALL-->
|
|
368
|
357
|
SELECT
|
|
369
|
358
|
k. NAME,
|
|
370
|
|
- concat(
|
|
371
|
|
- cast(bstore.depot_name AS CHAR),
|
|
372
|
|
- '_',
|
|
373
|
|
- cast(
|
|
374
|
|
- bstore.storehouse_name AS CHAR
|
|
375
|
|
- )
|
|
376
|
|
- ) houseName,
|
|
|
359
|
+ bstore.depot_name||'_'||bstore.storehouse_name AS houseName,
|
|
377
|
360
|
store.storehouse_id houseId,
|
|
378
|
|
- store.storehouse_code houseCode,
|
|
|
361
|
+ bstore.storehouse_code houseCode,
|
|
379
|
362
|
b.role_name roleName
|
|
380
|
363
|
FROM
|
|
381
|
364
|
business_agent_storehouse store
|