TWarehouseMapper.xml 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.basicData.mapper.TWarehouseMapper">
  6. <resultMap type="TWarehouse" id="TWarehouseResult">
  7. <result property="fId" column="f_id"/>
  8. <result property="parentId" column="parent_id"/>
  9. <result property="ancestors" column="ancestors"/>
  10. <result property="orderNum" column="order_num"/>
  11. <result property="fNo" column="f_no"/>
  12. <result property="fIsBonded" column="f_is_bonded"/>
  13. <result property="fName" column="f_name"/>
  14. <result property="fCname" column="f_cname"/>
  15. <result property="fAddr" column="f_addr"/>
  16. <result property="fTotalgross" column="f_totalgross"/>
  17. <result property="fContacts" column="f_contacts"/>
  18. <result property="fTel" column="f_tel"/>
  19. <result property="fCharg" column="f_charg"/>
  20. <result property="fStatus" column="f_status"/>
  21. <result property="delFlag" column="del_flag"/>
  22. <result property="createBy" column="create_by"/>
  23. <result property="createTime" column="create_time"/>
  24. <result property="updateBy" column="update_by"/>
  25. <result property="updateTime" column="update_time"/>
  26. <result property="remark" column="remark"/>
  27. <result property="fLocation" column="f_location"/>
  28. <result property="hasChildren" column="has_children"/>
  29. <result property="fWarehouseInformation" column="f_warehouse_information"/>
  30. <result property="supervise" column="supervise"/>
  31. <result property="fProperties" column="f_properties"/>
  32. <result property="fType" column="f_type"/>
  33. <result property="fGoodsType" column="f_goods_type"/>
  34. <result property="fCoverArea" column="f_cover_area"/>
  35. </resultMap>
  36. <sql id="selectTWarehouseVo">
  37. select f_id,
  38. parent_id,
  39. ancestors,
  40. order_num,
  41. f_no,
  42. f_is_bonded,
  43. f_name,
  44. f_cname,
  45. f_addr,
  46. f_totalgross,
  47. f_contacts,
  48. f_tel,
  49. f_charg,
  50. f_status,
  51. del_flag,
  52. create_by,
  53. create_time,
  54. update_by,
  55. update_time,
  56. remark,
  57. f_location,
  58. f_warehouse_information,
  59. supervise,
  60. f_properties,
  61. f_type,
  62. f_goods_type,
  63. f_cover_area
  64. from t_warehouse
  65. </sql>
  66. <select id="selectTWarehouseList" parameterType="TWarehouse" resultMap="TWarehouseResult">
  67. <include refid="selectTWarehouseVo"/>
  68. <where>
  69. <if test="parentId != null and parentId != ''">and parent_id = #{parentId}</if>
  70. <if test="fIsBonded != null and fIsBonded != ''">and f_is_bonded = #{fIsBonded}</if>
  71. <if test="ancestors != null and ancestors != ''">and ancestors like concat('%', #{ancestors}, '%')</if>
  72. <if test="fNo != null and fNo != ''">and f_no like concat('%', #{fNo}, '%')</if>
  73. <if test="fName != null and fName != ''">and f_name like concat('%', #{fName}, '%')</if>
  74. <if test="fCname != null and fCname != ''">and f_cname like concat('%', #{fCname}, '%')</if>
  75. <if test="fAddr != null and fAddr != ''">and f_addr like concat('%', #{fAddr}, '%')</if>
  76. <if test="fTotalgross != null ">and f_totalgross like concat('%', #{fTotalgross}, '%')</if>
  77. <if test="fContacts != null and fContacts != ''">and f_contacts = #{fContacts}</if>
  78. <if test="fTel != null and fTel != ''">and f_tel = #{fTel}</if>
  79. <if test="fCharg != null ">and f_charg = #{fCharg}</if>
  80. <if test="fStatus != null and fStatus != ''">and f_status = #{fStatus}</if>
  81. <if test="supervise != null and supervise != ''">and supervise = #{supervise}</if>
  82. <if test="fProperties != null and fProperties != ''">and f_properties like concat('%', #{fProperties},
  83. '%')
  84. </if>
  85. <if test="fType != null and fType != ''">and f_type like concat('%', #{fType}, '%')</if>
  86. <if test="fGoodsType != null and fGoodsType != ''">and f_goods_type like concat('%', #{fGoodsType}, '%')
  87. </if>
  88. <if test="fCoverArea != null and fCoverArea != ''">and f_cover_area like concat('%', #{fCoverArea}, '%')
  89. </if>
  90. </where>
  91. <!-- 数据范围过滤 -->
  92. ${params.dataScope}
  93. order by parent_id, order_num, convert(f_name using gbk)
  94. </select>
  95. <select id="lazyList" parameterType="TWarehouse" resultMap="TWarehouseResult">
  96. select
  97. ware.f_id, ware.parent_id, ware.ancestors, ware.order_num, ware.f_no, ware.f_name, ware.f_cname,
  98. ware.f_totalgross, ware.f_location,
  99. ware.f_addr, ware.f_contacts, ware.f_tel, ware.f_charg, ware.f_is_bonded, ware.remark, ware.supervise,
  100. ware.f_status,
  101. ware.f_properties, ware.f_type, ware.f_goods_type, ware.f_cover_area,
  102. (
  103. SELECT
  104. CASE WHEN count( * ) > 0 THEN 1 ELSE 0 END
  105. FROM
  106. t_warehouse tw
  107. WHERE
  108. tw.parent_id = ware.f_id AND tw.del_flag = '0'
  109. ) AS "has_children"
  110. from t_warehouse ware
  111. <where>
  112. <if test="parentId != null">and ware.parent_id = #{parentId}</if>
  113. <if test="fNo != null and fNo != ''">and ware.f_no like concat('%', #{fNo}, '%')</if>
  114. <if test="fName != null and fName != ''">and ware.f_name like concat('%', #{fName}, '%')</if>
  115. <if test="fCname != null and fCname != ''">and ware.f_cname like concat('%', #{fCname}, '%')</if>
  116. <if test="fStatus != null and fStatus != ''">and ware.f_status = #{fStatus}</if>
  117. <if test="supervise != null and supervise != ''">and ware.supervise = #{supervise}</if>
  118. <if test="fProperties != null and fProperties != ''">and f_properties like concat('%', #{fProperties},
  119. '%')
  120. </if>
  121. <if test="fType != null and fType != ''">and f_type like concat('%', #{fType}, '%')</if>
  122. <if test="fGoodsType != null and fGoodsType != ''">and f_goods_type like concat('%', #{fGoodsType}, '%')
  123. </if>
  124. <if test="fCoverArea != null and fCoverArea != ''">and f_cover_area like concat('%', #{fCoverArea}, '%')
  125. </if>
  126. <if test="fAddr != null and fAddr != ''">and f_addr like concat('%', #{fAddr}, '%')</if>
  127. </where>
  128. <!-- 数据范围过滤 -->
  129. ${params.dataScope}
  130. order by ware.parent_id, ware.order_num, convert(ware.f_name using gbk)
  131. </select>
  132. <select id="selectTWarehouseLists" parameterType="TWarehouse" resultMap="TWarehouseResult">
  133. <include refid="selectTWarehouseVo"/>
  134. <where>
  135. parent_id = 100
  136. </where>
  137. </select>
  138. <select id="appGetWarehouseList" resultType="map">
  139. SELECT
  140. f_id AS fId,
  141. f_name AS fName
  142. FROM t_warehouse
  143. WHERE parent_id = 100
  144. <if test="corpId != null and corpId != ''">
  145. AND f_id IN (SELECT DISTINCT f_warehouseid FROM t_whgenleg WHERE f_corpid = #{corpId})
  146. </if>
  147. </select>
  148. <select id="selectTWarehouseById" parameterType="Long" resultMap="TWarehouseResult">
  149. <include refid="selectTWarehouseVo"/>
  150. where f_id = #{fId}
  151. </select>
  152. <insert id="insertTWarehouse" parameterType="TWarehouse" useGeneratedKeys="true" keyProperty="fId">
  153. insert into t_warehouse
  154. <trim prefix="(" suffix=")" suffixOverrides=",">
  155. <if test="parentId != null and parentId != 0">parent_id,</if>
  156. <if test="ancestors != null and ancestors != ''">ancestors,</if>
  157. <if test="orderNum != null and orderNum != ''">order_num,</if>
  158. <if test="fNo != null and fNo != ''">f_no,</if>
  159. <if test="fIsBonded != null and fIsBonded != ''">f_is_bonded,</if>
  160. <if test="fName != null and fName != ''">f_name,</if>
  161. <if test="fCname != null and fCname != ''">f_cname,</if>
  162. <if test="fAddr != null and fAddr != ''">f_addr,</if>
  163. <if test="fTotalgross != null">f_totalgross,</if>
  164. <if test="fContacts != null">f_contacts,</if>
  165. <if test="fTel != null">f_tel,</if>
  166. <if test="fCharg != null">f_charg,</if>
  167. <if test="fStatus != null">f_status,</if>
  168. <if test="delFlag != null">del_flag,</if>
  169. <if test="createBy != null">create_by,</if>
  170. <if test="createTime != null">create_time,</if>
  171. <if test="updateBy != null">update_by,</if>
  172. <if test="updateTime != null">update_time,</if>
  173. <if test="remark != null">remark,</if>
  174. <if test="fLocation != null">f_location,</if>
  175. <if test="fWarehouseInformation != null">f_warehouse_information,</if>
  176. <if test="supervise != null">supervise,</if>
  177. <if test="fProperties != null">f_properties,</if>
  178. <if test="fType != null">f_type,</if>
  179. <if test="fGoodsType != null">f_goods_type,</if>
  180. <if test="fCoverArea != null">f_cover_area,</if>
  181. </trim>
  182. <trim prefix="values (" suffix=")" suffixOverrides=",">
  183. <if test="parentId != null and parentId != 0">#{parentId},</if>
  184. <if test="ancestors != null and ancestors != ''">#{ancestors},</if>
  185. <if test="orderNum != null and orderNum != ''">#{orderNum},</if>
  186. <if test="fNo != null and fNo != ''">#{fNo},</if>
  187. <if test="fIsBonded != null and fIsBonded != ''">#{fIsBonded},</if>
  188. <if test="fName != null and fName != ''">#{fName},</if>
  189. <if test="fCname != null and fCname != ''">#{fCname},</if>
  190. <if test="fAddr != null and fAddr != ''">#{fAddr},</if>
  191. <if test="fTotalgross != null">#{fTotalgross},</if>
  192. <if test="fContacts != null">#{fContacts},</if>
  193. <if test="fTel != null">#{fTel},</if>
  194. <if test="fCharg != null">#{fCharg},</if>
  195. <if test="fStatus != null">#{fStatus},</if>
  196. <if test="delFlag != null">#{delFlag},</if>
  197. <if test="createBy != null">#{createBy},</if>
  198. <if test="createTime != null">#{createTime},</if>
  199. <if test="updateBy != null">#{updateBy},</if>
  200. <if test="updateTime != null">#{updateTime},</if>
  201. <if test="remark != null">#{remark},</if>
  202. <if test="fLocation != null">#{fLocation},</if>
  203. <if test="fWarehouseInformation != null">#{fWarehouseInformation},</if>
  204. <if test="supervise != null">#{supervise},</if>
  205. <if test="fProperties != null">#{fProperties},</if>
  206. <if test="fType != null">#{fType},</if>
  207. <if test="fGoodsType != null">#{fGoodsType},</if>
  208. <if test="fCoverArea != null">#{fCoverArea},</if>
  209. </trim>
  210. </insert>
  211. <update id="updateTWarehouse" parameterType="TWarehouse">
  212. update t_warehouse
  213. <trim prefix="SET" suffixOverrides=",">
  214. <if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
  215. <if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
  216. <if test="orderNum != null and orderNum != ''">order_num = #{orderNum},</if>
  217. <if test="fNo != null and fNo != ''">f_no = #{fNo},</if>
  218. <if test="fIsBonded != null and fIsBonded != ''">f_is_bonded = #{fIsBonded},</if>
  219. <if test="fName != null and fName != ''">f_name = #{fName},</if>
  220. <if test="fCname != null and fCname != ''">f_cname = #{fCname},</if>
  221. <if test="fAddr != null and fAddr != ''">f_addr = #{fAddr},</if>
  222. <if test="fTotalgross != null">f_totalgross = #{fTotalgross},</if>
  223. <if test="fContacts != null">f_contacts = #{fContacts},</if>
  224. <if test="fTel != null">f_tel = #{fTel},</if>
  225. <if test="fCharg != null">f_charg = #{fCharg},</if>
  226. <if test="fStatus != null">f_status = #{fStatus},</if>
  227. <if test="delFlag != null">del_flag = #{delFlag},</if>
  228. <if test="createBy != null">create_by = #{createBy},</if>
  229. <if test="createTime != null">create_time = #{createTime},</if>
  230. <if test="updateBy != null">update_by = #{updateBy},</if>
  231. <if test="updateTime != null">update_time = #{updateTime},</if>
  232. <if test="remark != null">remark = #{remark},</if>
  233. <if test="fLocation != null">f_location = #{fLocation},</if>
  234. <if test="fWarehouseInformation != null">f_warehouse_information = #{fWarehouseInformation},</if>
  235. <if test="supervise != null">supervise = #{supervise},</if>
  236. <if test="fProperties != null">f_properties = #{fProperties},</if>
  237. <if test="fType != null">f_type = #{fType},</if>
  238. <if test="fGoodsType != null">f_goods_type = #{fGoodsType},</if>
  239. <if test="fCoverArea != null">f_cover_area = #{fCoverArea},</if>
  240. </trim>
  241. where f_id = #{fId}
  242. </update>
  243. <delete id="deleteTWarehouseById" parameterType="Long">
  244. delete
  245. from t_warehouse
  246. where f_id = #{fId}
  247. </delete>
  248. <delete id="deleteTWarehouseByIds" parameterType="String">
  249. delete from t_warehouse where f_id in
  250. <foreach item="fId" collection="array" open="(" separator="," close=")">
  251. #{fId}
  252. </foreach>
  253. </delete>
  254. <select id="checkFNoUnique" parameterType="String" resultMap="TWarehouseResult">
  255. select f_id, f_no
  256. from t_warehouse
  257. where f_no = #{fNo} limit 1
  258. </select>
  259. <select id="checkUFNnameUnique" parameterType="String" resultMap="TWarehouseResult">
  260. select f_id, f_name
  261. from t_warehouse
  262. where f_name = #{fAame} limit 1
  263. </select>
  264. <select id="checkUFAaddrUnique" parameterType="String" resultMap="TWarehouseResult">
  265. select f_id, f_addr
  266. from t_warehouse
  267. where f_addr = #{fAddr} limit 1
  268. </select>
  269. <select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">
  270. select count(*)
  271. from t_warehouse
  272. where f_status = 0
  273. and del_flag = '0'
  274. and find_in_set(#{fId}, ancestors)
  275. </select>
  276. <select id="selectChildrenDeptById" parameterType="Long" resultMap="TWarehouseResult">
  277. select *
  278. from t_warehouse
  279. where find_in_set(#{fId}, ancestors)
  280. </select>
  281. <select id="selectTWarehousById" resultMap="TWarehouseResult">
  282. select f_id
  283. from t_warehouse
  284. where parent_id = #{fId} limit 1
  285. </select>
  286. <update id="updateDeptChildren" parameterType="java.util.List">
  287. update t_warehouse set ancestors =
  288. <foreach collection="depts" item="item" index="index"
  289. separator=" " open="case f_id" close="end">
  290. when #{item.fId} then #{item.ancestors}
  291. </foreach>
  292. where f_id in
  293. <foreach collection="depts" item="item" index="index"
  294. separator="," open="(" close=")">
  295. #{item.fId}
  296. </foreach>
  297. </update>
  298. <update id="updateDeptStatus" parameterType="TWarehouse">
  299. update t_warehouse
  300. <set>
  301. <if test="fStatus != null and fStatus != ''">f_status = #{fStatus},</if>
  302. <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
  303. update_time = sysdate()
  304. </set>
  305. where f_id in (${ancestors})
  306. </update>
  307. <update id="updatefTotalgross">
  308. update t_warehouse
  309. <set>
  310. <if test="fTotalgross != null and fTotalgross != ''">f_totalgross = #{fTotalgross},</if>
  311. update_time = sysdate()
  312. </set>
  313. where f_id = #{fId}
  314. </update>
  315. <select id="selectTWarehouseFTotalgross" resultType="java.math.BigDecimal">
  316. SELECT sum(f_totalgross) AS fTotalgross
  317. FROM t_warehouse
  318. WHERE ancestors LIKE concat('%', #{fId}, '%')
  319. </select>
  320. <select id="checkDeptNameUnique" resultMap="TWarehouseResult">
  321. <include refid="selectTWarehouseVo"/>
  322. where f_name=#{fName} and parent_id = #{parentId} limit 1
  323. </select>
  324. <select id="hasChildByfId" parameterType="Long" resultType="int">
  325. select count(1)
  326. from t_warehouse
  327. where del_flag = '0'
  328. and parent_id = #{fId} limit 1
  329. </select>
  330. <select id="checkDeptExistarehouse" parameterType="Long" resultType="int">
  331. select count(1)
  332. from t_warehousebills
  333. where f_warehouseid = #{fId}
  334. and del_flag = '0'
  335. </select>
  336. <select id="checkDeptExistWarehouseItems" parameterType="Long" resultType="int">
  337. select count(1)
  338. from t_warehousebillsitems
  339. where f_warehouselocid = #{fId}
  340. and del_flag = '0'
  341. </select>
  342. <select id="selectByIds" resultMap="TWarehouseResult">
  343. <include refid="selectTWarehouseVo"/>
  344. where f_id in
  345. <foreach item="id" collection="ids" open="(" separator="," close=")">
  346. #{id}
  347. </foreach>
  348. </select>
  349. <select id="biWarehouseList" resultType="map">
  350. select
  351. f_id as warehouseId,
  352. f_name as warehouseName
  353. from t_warehouse
  354. where parent_id = 100
  355. <if test="external != null and external != ''">
  356. and f_id in (
  357. select distinct f_warehouseid
  358. from t_customer_contact t1 left join t_whgenleg t2 on t1.f_pid = t2.f_corpid
  359. where f_tel = #{external})
  360. </if>
  361. order by convert(f_name using gbk)
  362. </select>
  363. <select id="getWarehouseByNo" parameterType="String" resultMap="TWarehouseResult">
  364. <include refid="selectTWarehouseVo"/>
  365. <where>
  366. f_id = #{fNo} and del_flag = '0' limit 1
  367. </where>
  368. </select>
  369. <select id="queryGoodsAccountByPageV1" resultType="map">
  370. SELECT
  371. TW.f_id AS warehouseCode,
  372. TW.f_name AS warehouseName,
  373. TC.uscc AS ownerSocialIdentifier,
  374. TC.f_id AS ownerCode,
  375. TC.f_name AS ownerName,
  376. TG.f_name AS goodsName,
  377. TG.f_packagespecs AS specifications,
  378. '' AS producing,
  379. TWG.f_marks AS materialQuality,
  380. '' AS level,
  381. SUM(TWG.f_qtyD) AS totalQuantity,
  382. SUM(TWG.f_qtyblc) AS availableQuantity,
  383. TG.f_no AS goodsCode,
  384. sdd.dict_label AS goodsType,
  385. '袋' AS quantityUnit,
  386. IFNULL( ROUND( SUM(TWG.f_netweightD) / 1000, 2 ), 0 ) AS totalNetWeight,
  387. IFNULL( ROUND( SUM(TWG.f_netweightblc) / 1000, 2 ), 0 ) AS availableWeight,
  388. '吨' AS weightUnit,
  389. CONCAT_WS('-',IFNULL( TG.f_name, '' ),CONCAT_WS( IFNULL( TG.f_packagespecs, '' ), '/袋' ),IFNULL( TWG.f_marks, ''
  390. )) AS spu
  391. FROM t_warehouse TW
  392. LEFT JOIN t_whgenleg TWG ON TWG.f_warehouseid = TW.f_id
  393. LEFT JOIN t_corps TC ON TC.f_id = TWG.f_corpid
  394. LEFT JOIN t_goods TG ON TG.f_id = TWG.f_goodsid
  395. LEFT JOIN sys_dict_data sdd ON sdd.dict_type = 'data_goods_category' and TG.f_typeid = sdd.dict_value
  396. <where>
  397. TW.del_flag = '0'
  398. and TWG.f_qtyblc > 0
  399. and TWG.lock_status ='0'
  400. <if test="warehouseCode != null and warehouseCode != ''">and TW.f_id = #{warehouseCode}</if>
  401. <if test="ownerName != null and ownerName != ''">and TC.f_name like concat('%', #{ownerName}, '%')</if>
  402. <if test="goodsName != null and goodsName != ''">and TG.f_name like concat('%', #{goodsName}, '%')</if>
  403. <if test="specifications != null and specifications != ''">and TG.f_packagespecs like concat('%',
  404. #{specifications}, '%')
  405. </if>
  406. <if test="materialQuality != null and materialQuality != ''">and TWG.f_marks like concat('%',
  407. #{materialQuality}, '%')
  408. </if>
  409. <if test="ownerSocialIdentifier != null and ownerSocialIdentifier != ''">and TC.uscc =
  410. #{ownerSocialIdentifier}
  411. </if>
  412. <if test="ownerCode != null and ownerCode != ''">and TC.f_id = #{ownerCode}</if>
  413. </where>
  414. GROUP BY
  415. TW.f_id,TC.f_no,TG.f_name,TG.f_packagespecs,TWG.f_marks
  416. </select>
  417. <select id="queryGoodsAccountDetailByPageV1" resultType="map">
  418. SELECT
  419. DISTINCT
  420. TWG.f_id AS id,
  421. TW.f_id AS warehouseCode,
  422. TW.f_name AS warehouseName,
  423. ware.f_name AS areaName,
  424. ware.f_id AS areaCode,
  425. ware.f_name AS slotName,
  426. ware.f_id AS slotCode,
  427. TWG.f_originalbillno AS receiptDoc,
  428. TWG.f_mblno AS billOfLading,
  429. TC.f_id AS ownerCode,
  430. TC.f_name AS ownerName,
  431. TC.uscc AS ownerSocialIdentifier,
  432. TG.f_name AS goodsName,
  433. TG.f_no AS goodsCode,
  434. sdd.dict_label AS goodsType,
  435. TG.f_packagespecs AS specifications,
  436. '' AS producing,
  437. TWG.f_marks AS materialQuality,
  438. '' AS level,
  439. TWG.f_qtyD AS totalQuantity,
  440. TWG.f_qtyblc AS availableQuantity,
  441. '袋' AS quantityUnit,
  442. IFNULL( ROUND( TWG.f_netweightD / 1000, 2 ), 0 ) AS totalNetWeight,
  443. IFNULL( ROUND( TWG.f_netweightblc / 1000, 2 ), 0 ) AS availableWeight,
  444. '吨' AS weightUnit,
  445. TWG.f_originalbilldate AS storesTime,
  446. '' AS productionTime,
  447. TWB.f_truckno AS plateNumber,
  448. '' AS batchNo,
  449. '' AS warehouseReceiptNo
  450. FROM
  451. t_whgenleg TWG
  452. LEFT JOIN t_warehouse TW ON TWG.f_warehouseid = TW.f_id
  453. LEFT JOIN t_warehouse ware ON ware.f_id = TWG.f_warehouse_locationid
  454. LEFT JOIN t_corps TC ON TC.f_id = TWG.f_corpid
  455. LEFT JOIN t_goods TG ON TG.f_id = TWG.f_goodsid
  456. LEFT JOIN t_warehousebills TWB ON TWG.f_originalbillno = TWB.f_billno
  457. LEFT JOIN sys_dict_data sdd ON sdd.dict_type = 'data_goods_category' and TG.f_typeid = sdd.dict_value
  458. <where>
  459. TW.del_flag = '0'
  460. and TWG.f_qtyblc > 0
  461. and TWG.lock_status ='0'
  462. and TWB.del_flag = '0'
  463. <if test="warehouseCode != null and warehouseCode != ''">and TWG.f_warehouseid = #{warehouseCode}</if>
  464. <if test="ownerName != null and ownerName != ''">and TC.f_name like concat('%', #{ownerName}, '%')</if>
  465. <if test="ownerCode != null and ownerCode != ''">and TC.f_id = #{ownerCode}</if>
  466. <if test="ownerSocialIdentifier != null and ownerSocialIdentifier != ''">and TC.uscc =
  467. #{ownerSocialIdentifier}
  468. </if>
  469. <if test="goodsName != null and goodsName != ''">and TG.f_name like concat('%', #{goodsName}, '%')</if>
  470. <if test="goodsCode != null and goodsCode != ''">and TG.f_no = #{goodsCode}</if>
  471. <if test="specifications != null and specifications != ''">and TG.f_packagespecs like concat('%',
  472. #{specifications}, '%')
  473. </if>
  474. <if test="materialQuality != null and materialQuality != ''">and TWG.f_marks like concat('%',
  475. #{materialQuality}, '%')
  476. </if>
  477. <if test="receiptDoc != null and receiptDoc != ''">and TWG.f_originalbillno like concat('%', #{receiptDoc},
  478. '%')
  479. </if>
  480. <if test="billOfLading != null and billOfLading != ''">and TWG.f_mblno like concat('%', #{billOfLading},
  481. '%')
  482. </if>
  483. <if test="areaName != null and areaName != ''">and ware.f_name like concat('%', #{areaName}, '%')</if>
  484. <if test="areaCode != null and areaCode != ''">and ware.f_id = #{areaCode}</if>
  485. <if test="slotName != null and slotName != ''">and ware.f_name like concat('%', #{slotName}, '%')</if>
  486. <if test="slotCode != null and slotCode != ''">and ware.f_id = #{slotCode}</if>
  487. </where>
  488. </select>
  489. <select id="getWareHouseInfo" parameterType="String" resultMap="TWarehouseResult">
  490. <include refid="selectTWarehouseVo"/>
  491. <where>
  492. f_id = #{wareHouseId} and del_flag = '0' limit 1
  493. </where>
  494. </select>
  495. <select id="getStorageInfo" resultType="map">
  496. SELECT
  497. cast(IFNULL( ROUND( TW.f_totalgross / 1000, 2 ), 0 ) as DECIMAL(20,2)) AS capacity,
  498. IFNULL( ROUND( TWB.f_netweight / 1000, 2 ), 0 ) AS storage,
  499. TTL.value AS throughput,
  500. count(distinct(TWB.f_corpid)) AS customers
  501. FROM
  502. t_warehouse TW
  503. LEFT JOIN t_warehousebills TWB ON TW.f_id = TWB.f_warehouseid
  504. LEFT JOIN (
  505. SELECT
  506. f_warehouseid,
  507. ROUND( SUM(f_grossweight) / 1000, 2 ) as value
  508. FROM t_warehousebills
  509. where
  510. del_flag = '0'
  511. GROUP BY
  512. f_warehouseid
  513. ) TTL ON TTL.f_warehouseid = TW.f_id
  514. <where>
  515. TW.del_flag = '0'
  516. AND TW.f_id = #{wareHouseId}
  517. </where>
  518. GROUP BY
  519. TW.f_id
  520. </select>
  521. <select id="getTimeStorageInfo" resultType="map">
  522. SELECT
  523. f_bsdate as time,
  524. ROUND( SUM(f_grossweight) / 1000, 2 ) as value
  525. FROM t_warehousebills
  526. <where>
  527. del_flag = '0'
  528. AND f_warehouseid = #{wareHouseId}
  529. <if test="startTime != null and startTime != ''">
  530. and f_bsdate >= #{startTime}
  531. </if>
  532. <if test="endTime != null and endTime != ''">
  533. and f_bsdate &lt;= #{endTime}
  534. </if>
  535. <if test="(startTime == null and endTime == null) or (startTime == '' and endTime == '')">
  536. and f_bsdate>=date(now()) and f_bsdate &lt; DATE_ADD(date(now()),INTERVAL 1 DAY)
  537. </if>
  538. </where>
  539. </select>
  540. <select id="getTimeThroughputInfo" resultType="map">
  541. SELECT
  542. f_bsdate as time,
  543. ROUND( SUM(f_grossweight) / 1000, 2 ) as value
  544. FROM t_warehousebills
  545. <where>
  546. del_flag = '0'
  547. AND f_warehouseid = #{wareHouseId}
  548. and f_billtype in ('SJRK','SJCK')
  549. <if test="startTime != null and startTime != ''">
  550. and f_bsdate >= #{startTime}
  551. </if>
  552. <if test="endTime != null and endTime != ''">
  553. and f_bsdate &lt;= #{endTime}
  554. </if>
  555. <if test="(startTime == null and endTime == null) or (startTime == '' and endTime == '')">
  556. and f_bsdate>=date(now()) and f_bsdate &lt; DATE_ADD(date(now()),INTERVAL 1 DAY)
  557. </if>
  558. </where>
  559. </select>
  560. <select id="getCargoInfo" resultType="map">
  561. SELECT
  562. ROUND( SUM(f_grossweight) / 1000, 2 ) as FGrossweight
  563. FROM t_warehousebills
  564. <where>
  565. f_warehouseid = #{wareHouseId}
  566. <if test="isPledge != null and isPledge != ''">
  567. and is_pledge = #{isPledge}
  568. </if>
  569. <if test="startTime != null and startTime != ''">
  570. and f_bsdate >= #{startTime}
  571. </if>
  572. <if test="endTime != null and endTime != ''">
  573. and f_bsdate &lt;= #{endTime}
  574. </if>
  575. <if test="(startTime == null and endTime == null) or (startTime == '' and endTime == '')">
  576. and DATE_SUB( CURDATE(), INTERVAL 7 DAY ) &lt;= date(f_bsdate)
  577. </if>
  578. </where>
  579. </select>
  580. <select id="getGoodsList" resultType="map">
  581. SELECT
  582. SDD.dict_label AS goodsType,
  583. IF(da.count,da.count,0.00) AS count,
  584. IF(da.rate ,da.rate ,0.00) AS rate
  585. FROM
  586. sys_dict_data SDD
  587. LEFT JOIN (SELECT
  588. SD.dict_code AS dict_code,
  589. ROUND( SUM( TW.f_grossweight ) / 1000, 2 ) AS count,
  590. round( SUM( TW.f_grossweight ) * 100 /( SELECT SUM( f_grossweight ) AS total FROM t_warehousebills ), 2 ) AS
  591. rate
  592. FROM
  593. sys_dict_data SD
  594. JOIN t_warehousebills TW ON SD.dict_value = TW.f_trademodeid
  595. WHERE
  596. TW.f_warehouseid = #{wareHouseId}
  597. <if test="startTime != null and startTime != ''">
  598. and TW.f_bsdate >= #{startTime}
  599. </if>
  600. <if test="endTime != null and endTime != ''">
  601. and TW.f_bsdate &lt;= #{endTime}
  602. </if>
  603. <if test="(startTime == null and endTime == null) or (startTime == '' and endTime == '')">
  604. and DATE_SUB( CURDATE(), INTERVAL 7 DAY ) &lt;= date(TW.f_bsdate)
  605. </if>
  606. and SD.dict_type = 'data_trademodes'
  607. GROUP BY
  608. SD.dict_label) da on SDD.dict_code = da.dict_code
  609. WHERE
  610. SDD.dict_type = 'data_trademodes'
  611. GROUP BY
  612. SDD.dict_label
  613. </select>
  614. <select id="getCargoInfoTrend" resultType="map">
  615. SELECT
  616. f_bsdate as time,
  617. ROUND( SUM(TW.f_grossweight) / 1000, 2 ) as value
  618. FROM
  619. t_warehousebills TW
  620. LEFT JOIN sys_dict_data SDD ON SDD.dict_type = 'data_trademodes' AND SDD.dict_value = TW.f_trademodeid
  621. <where>
  622. TW.del_flag = '0'
  623. AND TW.f_warehouseid = #{wareHouseId}
  624. AND SDD.dict_value = #{FTradeModeId}
  625. <if test="startTime != null and startTime != ''">
  626. and TW.f_bsdate >= #{startTime}
  627. </if>
  628. <if test="endTime != null and endTime != ''">
  629. and TW.f_bsdate &lt;= #{endTime}
  630. </if>
  631. <if test="(startTime == null and endTime == null) or (startTime == '' and endTime == '')">
  632. and DATE_SUB( CURDATE(), INTERVAL 7 DAY ) &lt;= date(TW.f_bsdate)
  633. </if>
  634. </where>
  635. GROUP BY
  636. SDD.dict_label
  637. </select>
  638. <select id="getStorageTop" resultType="map">
  639. SELECT
  640. TG.f_name AS goodsName,
  641. ROUND( SUM(TW.f_grossweight) / 1000, 2 ) as normalCnt,
  642. '' AS receiptCnt
  643. FROM
  644. t_warehousebillsitems TW
  645. LEFT JOIN t_goods TG ON TG.f_id = TW.f_goodsid
  646. <where>
  647. TW.del_flag = '0'
  648. AND TW.f_warehouselocid = #{wareHouseId}
  649. <if test="countType != null and countType != '' and countType == 2">
  650. and TW.f_billtype in ('SJRK','SJCK')
  651. </if>
  652. </where>
  653. GROUP BY TW.f_goodsid
  654. ORDER BY IFNULL( ROUND( SUM(TW.f_grossweight) / 1000, 2 ), 0 ) DESC
  655. LIMIT #{topCnt}
  656. </select>
  657. <select id="getGoodsTop" resultType="map">
  658. SELECT
  659. TC.f_name AS ownerName,
  660. ROUND( SUM(TW.f_grossweight) / 1000, 2 ) as count
  661. FROM
  662. t_warehousebills TW
  663. LEFT JOIN t_corps TC ON TC.f_id = TW.f_corpid
  664. <where>
  665. TW.del_flag = '0'
  666. AND TW.f_warehouseid = #{wareHouseId}
  667. <if test="countType != null and countType != '' and countType == 2">
  668. and TW.f_billtype in ('SJRK','SJCK')
  669. </if>
  670. </where>
  671. GROUP BY TW.f_corpid
  672. ORDER BY IFNULL( ROUND( SUM(TW.f_grossweight) / 1000, 2 ), 0 ) DESC
  673. LIMIT #{topCnt}
  674. </select>
  675. <select id="getTransferTransaction" resultType="map">
  676. SELECT
  677. f_bsdate as time,
  678. ROUND( SUM(f_grossweight) / 1000, 2 ) as value
  679. FROM
  680. t_warehousebills
  681. <where>
  682. del_flag = '0'
  683. AND f_warehouseid = #{wareHouseId}
  684. <if test="startTime != null and startTime != ''">
  685. and f_bsdate >= #{startTime}
  686. </if>
  687. <if test="endTime != null and endTime != ''">
  688. and f_bsdate &lt;= #{endTime}
  689. </if>
  690. <if test="(startTime == null and endTime == null) or (startTime == '' and endTime == '')">
  691. and DATE_SUB( CURDATE(), INTERVAL 7 DAY ) &lt;= date(f_bsdate)
  692. </if>
  693. </where>
  694. </select>
  695. <select id="getWorkInfo" resultType="map">
  696. SELECT
  697. IFNULL( ROUND( SUM( TW.f_grossweight ) / 1000, 2 ),0) AS Fgrossweight,
  698. COUNT(f_id) AS count
  699. FROM
  700. t_warehousebills TW
  701. <where>
  702. TW.del_flag = '0'
  703. AND TW.f_warehouseid = #{wareHouseId}
  704. <if test="countType != null and countType != ''">
  705. and TW.f_billtype = #{countType}
  706. </if>
  707. </where>
  708. </select>
  709. <select id="getWorkTrend" resultType="map">
  710. SELECT
  711. TW.f_bsdate as time,
  712. count(*) AS value
  713. FROM
  714. t_warehousebills TW
  715. inner join t_warehousebillsitems TWI on TW.f_id = TWI.f_pid
  716. <where>
  717. TW.del_flag = '0' and TWI.del_flag = '0'
  718. AND TW.f_warehouseid = #{wareHouseId}
  719. <if test="countType != null and countType != ''">
  720. and TW.f_billtype = #{countType}
  721. </if>
  722. <if test="startTime != null and startTime != ''">
  723. and TW.f_bsdate >= #{startTime}
  724. </if>
  725. <if test="endTime != null and endTime != ''">
  726. and TW.f_bsdate &lt;= #{endTime}
  727. </if>
  728. <if test="(startTime == null and endTime == null) or (startTime == '' and endTime == '')">
  729. and DATE_SUB( CURDATE(), INTERVAL 7 DAY ) &lt;= date(TW.f_bsdate)
  730. </if>
  731. </where>
  732. </select>
  733. <select id="inventoryQueries" resultType="com.ruoyi.warehouseBusiness.response.InventoryQueryResponse">
  734. SELECT
  735. TWBI.f_business_type,
  736. TW.f_mblno AS warehouseSerialNumber,
  737. TW.f_originalbilldate AS originalWarehousingDate,
  738. TG.f_name AS cargoName,
  739. TW.f_marks AS cargoModel,
  740. (
  741. CASE
  742. TWBI.f_business_type
  743. WHEN '2' THEN
  744. TWBI.f_marks
  745. ELSE '' END
  746. ) AS cargoSpec,
  747. SUM( TW.f_qtyblc ) AS cargoQuantity,
  748. IFNULL( ROUND( SUM( TW.f_netweightblc ) / 1000, 2 ), 0 ) AS netWeight,
  749. IFNULL( ROUND( SUM( TW.f_grossweightblc ) / 1000, 2 ), 0 ) AS grossWeight,
  750. TWH.f_addr AS warehouseAddress,
  751. TC.f_name AS sourceOwnerName,
  752. TC.uscc AS sourceOwnerSocialIdentifier,
  753. TC.f_name AS currentOwnerName,
  754. TC.uscc AS currentOwnerSocialIdentifier,
  755. TW.f_originalbilldate AS rentBeginDate,
  756. '' AS storageRate,
  757. TW.f_marks AS mark,
  758. SUM( TW.f_qtyblc ) AS number,
  759. (CASE
  760. TWBI.f_business_type
  761. WHEN '3' THEN
  762. TWBI.f_marks ELSE ''
  763. END) AS manufacturer,
  764. '' AS trademark,
  765. '' AS grade,
  766. TG.f_packagespecs AS packing,
  767. '' AS country,
  768. '' AS process,
  769. TWBI.f_warehouse_information AS location
  770. FROM t_whgenleg TW
  771. LEFT JOIN t_goods TG ON TG.f_id = TW.f_goodsid
  772. LEFT JOIN t_warehouse TWH ON TW.f_warehouseid = TWH.f_id
  773. LEFT JOIN t_corps TC ON TC.f_id = TW.f_corpid
  774. LEFT JOIN (
  775. SELECT DISTINCT
  776. TWB.f_ifpledge,
  777. TWB.f_mblno,
  778. bi.f_business_type,
  779. bi.f_marks,
  780. bi.f_warehouse_information,
  781. bi.f_warehouselocid
  782. FROM
  783. t_warehousebills TWB
  784. LEFT JOIN t_warehousebillsitems bi ON bi.f_pid = TWB.f_id
  785. WHERE
  786. TWB.del_flag = '0'
  787. <if test="numbersList != null and numbersList != ''">
  788. and TWB.f_mblno IN
  789. <foreach item="number" collection="numbersList" open="(" separator="," close=")">
  790. #{number}
  791. </foreach>
  792. </if>
  793. ) TWBI ON TWBI.f_mblno = TW.f_mblno
  794. AND TWBI.f_warehouselocid = TW.f_warehouseid
  795. <where>
  796. TW.del_flag = '0'
  797. and TW.f_netweightblc != 0
  798. AND (TWBI.f_ifpledge != 0 or TWBI.f_ifpledge IS NULL)
  799. <if test="ownerName != null and ownerName != ''">
  800. and TC.f_name = #{ownerName}
  801. </if>
  802. <if test="identifier != null and identifier != ''">
  803. and TC.uscc = #{identifier}
  804. </if>
  805. <if test="numbersList != null and numbersList != ''">
  806. and TW.f_mblno in
  807. <foreach item="number" collection="numbersList" open="(" separator="," close=")">
  808. #{number}
  809. </foreach>
  810. </if>
  811. </where>
  812. GROUP BY
  813. TW.f_mblno
  814. </select>
  815. <select id="inventoryQueriesV2" resultType="com.ruoyi.warehouseBusiness.response.InventoryQueryTwoResponse">
  816. SELECT
  817. TWH.f_no AS warehouseCode,
  818. TWH.f_name AS warehouseName,
  819. TW.f_mblno AS blNo,
  820. TW.f_originalbilldate AS originalWarehousingDate,
  821. TW.f_originalbilldate AS rentBeginDate,
  822. TC.f_name AS sourceOwnerName,
  823. TC.uscc AS sourceOwnerSocialIdentifier,
  824. TC.f_name AS currentOwnerName,
  825. TC.uscc AS currentOwnerSocialIdentifier,
  826. TWH.f_addr AS warehouseAddress,
  827. TG.f_name AS cargoName,
  828. TW.f_marks AS cargoModel,
  829. TG.f_specs AS cargoSpec,
  830. IFNULL( ROUND( SUM( TW.f_netweightblc ) / 1000, 2 ), 0 ) AS netWeight,
  831. IFNULL( ROUND( SUM( TW.f_grossweightblc ) / 1000, 2 ), 0 ) AS grossWeight,
  832. SUM( TW.f_qtyblc ) AS cargoQuantity,
  833. '' AS storageRate,
  834. TW.f_marks AS mark,
  835. SUM( TW.f_qtyblc ) AS number,
  836. '' AS manufacturer,
  837. '' AS trademark,
  838. '' AS grade,
  839. TG.f_packagespecs AS packing,
  840. '' AS country,
  841. '' AS process,
  842. '' AS location
  843. FROM t_whgenleg TW
  844. LEFT JOIN t_goods TG ON TG.f_id = TW.f_goodsid
  845. LEFT JOIN t_warehouse TWH ON TW.f_warehouseid = TWH.f_id
  846. LEFT JOIN t_corps TC ON TC.f_id = TW.f_corpid
  847. <where>
  848. TW.del_flag = '0'
  849. and TW.f_netweightblc != 0
  850. /* AND (TWBI.f_ifpledge != 0 or TWBI.f_ifpledge IS NULL)*/
  851. <if test="ownerName != null and ownerName != ''">
  852. and TC.f_name = #{ownerName}
  853. </if>
  854. <if test="identifier != null and identifier != ''">
  855. and TC.uscc = #{identifier}
  856. </if>
  857. <if test="queryAll = 1">
  858. and TWH.parent_id = 100
  859. </if>
  860. <if test="numbersList != null and numbersList != '' and queryAll = 0">
  861. and TWH.f_no in
  862. <foreach item="number" collection="numbersList" open="(" separator="," close=")">
  863. #{number}
  864. </foreach>
  865. </if>
  866. <if test="blNosList != null and blNosList != ''">
  867. and TW.f_mblno in
  868. <foreach item="number" collection="blNosList" open="(" separator="," close=")">
  869. #{number}
  870. </foreach>
  871. </if>
  872. </where>
  873. GROUP BY
  874. TW.f_mblno
  875. </select>
  876. <update id="receiptRegister">
  877. update t_warehousebills TW
  878. LEFT JOIN t_corps TC ON TC.f_id = TW.f_corpid
  879. SET TW.f_ifpledge = '0'
  880. <where>
  881. TW.del_flag = '0'
  882. <if test="ownerName != null and ownerName != ''">
  883. and TC.f_name = #{ownerName}
  884. </if>
  885. <if test="identifier != null and identifier != ''">
  886. and TC.uscc = #{identifier}
  887. </if>
  888. <if test="numbers != null and numbers != ''">
  889. and TW.f_mblno = #{numbers}
  890. </if>
  891. </where>
  892. </update>
  893. <update id="receiptCancel">
  894. update t_warehousebills TW
  895. LEFT JOIN t_corps TC ON TC.f_id = TW.f_corpid
  896. SET TW.f_ifpledge = '1'
  897. <where>
  898. TW.del_flag = '0'
  899. <if test="ownerName != null and ownerName != ''">
  900. and TC.f_name = #{ownerName}
  901. </if>
  902. <if test="identifier != null and identifier != ''">
  903. and TC.uscc = #{identifier}
  904. </if>
  905. <if test="numbers != null and numbers != ''">
  906. and TW.f_mblno = #{numbers}
  907. </if>
  908. </where>
  909. </update>
  910. <select id="selectByPidANDName" resultMap="TWarehouseResult">
  911. <include refid="selectTWarehouseVo"/>
  912. <where>
  913. parent_id = #{fWarehouseid} and del_flag = '0' and f_name =#{stringCellValue}
  914. </where>
  915. </select>
  916. <select id="getStorageTopS" resultType="java.util.Map">
  917. SELECT
  918. TG.f_name AS goodsName,
  919. ROUND( SUM(TW.f_grossweightblc) / 1000, 2 ) as normalCnt,
  920. '' AS receiptCnt
  921. FROM
  922. t_whgenleg TW
  923. LEFT JOIN t_goods TG ON TG.f_id = TW.f_goodsid
  924. <where>
  925. TW.del_flag = '0'
  926. AND TW.f_warehouseid = #{wareHouseId}
  927. </where>
  928. GROUP BY TW.f_goodsid
  929. ORDER BY IFNULL( ROUND( SUM(TW.f_grossweightblc) / 1000, 2 ), 0 ) DESC
  930. LIMIT #{topCnt}
  931. </select>
  932. <select id="nominateTreeselect" resultMap="TWarehouseResult">
  933. <include refid="selectTWarehouseVo"/>
  934. <where>
  935. parent_id = 100 and
  936. <if test="warehouseIdList != null and warehouseIdList != ''">
  937. f_id in
  938. <foreach item="number" collection="warehouseIdList" open="(" separator="," close=")">
  939. #{number}
  940. </foreach>
  941. or
  942. <foreach collection="warehouseIdList" item="item" index="index" separator="OR">
  943. ancestors LIKE CONCAT('%',#{item},'%')
  944. </foreach>
  945. </if>
  946. <if test="tWarehouse.parentId != null and tWarehouse.parentId != ''">and parent_id =
  947. #{tWarehouse.parentId}
  948. </if>
  949. <if test="tWarehouse.fIsBonded != null and tWarehouse.fIsBonded != ''">and f_is_bonded =
  950. #{tWarehouse.fIsBonded}
  951. </if>
  952. <if test="tWarehouse.ancestors != null and tWarehouse.ancestors != ''">and ancestors like concat('%',
  953. #{tWarehouse.ancestors}, '%')
  954. </if>
  955. <if test="tWarehouse.fNo != null and tWarehouse.fNo != ''">and f_no like concat('%', #{tWarehouse.fNo},
  956. '%')
  957. </if>
  958. <if test="tWarehouse.fName != null and tWarehouse.fName != ''">and f_name like concat('%',
  959. #{tWarehouse.fName}, '%')
  960. </if>
  961. <if test="tWarehouse.fCname != null and tWarehouse.fCname != ''">and f_cname like concat('%',
  962. #{tWarehouse.fCname}, '%')
  963. </if>
  964. <if test="tWarehouse.fAddr != null and tWarehouse.fAddr != ''">and f_addr like concat('%',
  965. #{tWarehouse.fAddr}, '%')
  966. </if>
  967. <if test="tWarehouse.fTotalgross != null ">and f_totalgross like concat('%', #{tWarehouse.fTotalgross},
  968. '%')
  969. </if>
  970. <if test="tWarehouse.fContacts != null and tWarehouse.fContacts != ''">and f_contacts =
  971. #{tWarehouse.fContacts}
  972. </if>
  973. <if test="tWarehouse.fTel != null and tWarehouse.fTel != ''">and f_tel = #{tWarehouse.fTel}</if>
  974. <if test="tWarehouse.fCharg != null ">and f_charg = #{tWarehouse.fCharg}</if>
  975. <if test="tWarehouse.fStatus != null and tWarehouse.fStatus != ''">and f_status = #{tWarehouse.fStatus}
  976. </if>
  977. <if test="tWarehouse.supervise != null and tWarehouse.supervise != ''">and supervise =
  978. #{tWarehouse.supervise}
  979. </if>
  980. <if test="tWarehouse.fProperties != null and tWarehouse.fProperties != ''">and f_properties like concat('%',
  981. #{tWarehouse.fProperties}, '%')
  982. </if>
  983. <if test="tWarehouse.fType != null and tWarehouse.fType != ''">and f_type like concat('%',
  984. #{tWarehouse.fType}, '%')
  985. </if>
  986. <if test="tWarehouse.fGoodsType != null and tWarehouse.fGoodsType != ''">and f_goods_type like concat('%',
  987. #{tWarehouse.fGoodsType}, '%')
  988. </if>
  989. <if test="tWarehouse.fCoverArea != null and tWarehouse.fCoverArea != ''">and f_cover_area like concat('%',
  990. #{tWarehouse.fCoverArea}, '%')
  991. </if>
  992. </where>
  993. <!-- 数据范围过滤 -->
  994. order by parent_id, order_num, convert(f_name using gbk)
  995. </select>
  996. <select id="getByFIdList" resultMap="TWarehouseResult">
  997. <include refid="selectTWarehouseVo"/>
  998. <where>
  999. parent_id = 100 and f_id in
  1000. <foreach collection="warehouseIdList" item="fid" index="index" open="(" close=")"
  1001. separator=",">
  1002. #{fid}
  1003. </foreach>
  1004. </where>
  1005. </select>
  1006. <select id="getOne" resultType="TWarehouse" resultMap="TWarehouseResult">
  1007. <include refid="selectTWarehouseVo"/>
  1008. <where>
  1009. <if test="fNo != null and fNo != ''">and f_no = #{fNo}</if>
  1010. <if test="fId != null and fId != ''">and f_id = #{fId}</if>
  1011. <if test="parentId != null and parentId != ''">and parent_id = #{parentId}</if>
  1012. </where>
  1013. </select>
  1014. <select id="getWarehouseByFNo" parameterType="String" resultMap="TWarehouseResult">
  1015. <include refid="selectTWarehouseVo"/>
  1016. <where>
  1017. f_no = #{fNo} and del_flag = '0' limit 1
  1018. </where>
  1019. </select>
  1020. </mapper>