TWarehouseMapper.xml 43 KB

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