TWarehouseMapper.xml 45 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073
  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. <if test="lockStatus != null and lockStatus != '' and lockStatus == '1'">and TWG.lock_status != '1'</if>
  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 TWB.del_flag = '0'
  462. <if test="lockStatus != null and lockStatus != '' and lockStatus == '1'">and TWG.lock_status != '1'</if>
  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. <!--and TWG.lock_status ='0'-->
  490. <select id="getWareHouseInfo" parameterType="String" resultMap="TWarehouseResult">
  491. <include refid="selectTWarehouseVo"/>
  492. <where>
  493. f_id = #{wareHouseId} and del_flag = '0' limit 1
  494. </where>
  495. </select>
  496. <select id="getStorageInfo" resultType="map">
  497. SELECT
  498. cast(IFNULL( ROUND( TW.f_totalgross / 1000, 2 ), 0 ) as DECIMAL(20,2)) AS capacity,
  499. IFNULL( ROUND( TWB.f_netweight / 1000, 2 ), 0 ) AS storage,
  500. TTL.value AS throughput,
  501. count(distinct(TWB.f_corpid)) AS customers
  502. FROM
  503. t_warehouse TW
  504. LEFT JOIN t_warehousebills TWB ON TW.f_id = TWB.f_warehouseid
  505. LEFT JOIN (
  506. SELECT
  507. f_warehouseid,
  508. ROUND( SUM(f_grossweight) / 1000, 2 ) as value
  509. FROM t_warehousebills
  510. where
  511. del_flag = '0'
  512. GROUP BY
  513. f_warehouseid
  514. ) TTL ON TTL.f_warehouseid = TW.f_id
  515. <where>
  516. TW.del_flag = '0'
  517. AND TW.f_id = #{wareHouseId}
  518. </where>
  519. GROUP BY
  520. TW.f_id
  521. </select>
  522. <select id="getTimeStorageInfo" resultType="map">
  523. SELECT
  524. f_bsdate as time,
  525. ROUND( SUM(f_grossweight) / 1000, 2 ) as value
  526. FROM t_warehousebills
  527. <where>
  528. del_flag = '0'
  529. AND f_warehouseid = #{wareHouseId}
  530. <if test="startTime != null and startTime != ''">
  531. and f_bsdate >= #{startTime}
  532. </if>
  533. <if test="endTime != null and endTime != ''">
  534. and f_bsdate &lt;= #{endTime}
  535. </if>
  536. <if test="(startTime == null and endTime == null) or (startTime == '' and endTime == '')">
  537. and f_bsdate>=date(now()) and f_bsdate &lt; DATE_ADD(date(now()),INTERVAL 1 DAY)
  538. </if>
  539. </where>
  540. </select>
  541. <select id="getTimeThroughputInfo" resultType="map">
  542. SELECT
  543. f_bsdate as time,
  544. ROUND( SUM(f_grossweight) / 1000, 2 ) as value
  545. FROM t_warehousebills
  546. <where>
  547. del_flag = '0'
  548. AND f_warehouseid = #{wareHouseId}
  549. and f_billtype in ('SJRK','SJCK')
  550. <if test="startTime != null and startTime != ''">
  551. and f_bsdate >= #{startTime}
  552. </if>
  553. <if test="endTime != null and endTime != ''">
  554. and f_bsdate &lt;= #{endTime}
  555. </if>
  556. <if test="(startTime == null and endTime == null) or (startTime == '' and endTime == '')">
  557. and f_bsdate>=date(now()) and f_bsdate &lt; DATE_ADD(date(now()),INTERVAL 1 DAY)
  558. </if>
  559. </where>
  560. </select>
  561. <select id="getCargoInfo" resultType="map">
  562. SELECT
  563. ROUND( SUM(f_grossweight) / 1000, 2 ) as FGrossweight
  564. FROM t_warehousebills
  565. <where>
  566. f_warehouseid = #{wareHouseId}
  567. <if test="isPledge != null and isPledge != ''">
  568. and is_pledge = #{isPledge}
  569. </if>
  570. <if test="startTime != null and startTime != ''">
  571. and f_bsdate >= #{startTime}
  572. </if>
  573. <if test="endTime != null and endTime != ''">
  574. and f_bsdate &lt;= #{endTime}
  575. </if>
  576. <if test="(startTime == null and endTime == null) or (startTime == '' and endTime == '')">
  577. and DATE_SUB( CURDATE(), INTERVAL 7 DAY ) &lt;= date(f_bsdate)
  578. </if>
  579. </where>
  580. </select>
  581. <select id="getGoodsList" resultType="map">
  582. SELECT
  583. SDD.dict_label AS goodsType,
  584. IF(da.count,da.count,0.00) AS count,
  585. IF(da.rate ,da.rate ,0.00) AS rate
  586. FROM
  587. sys_dict_data SDD
  588. LEFT JOIN (SELECT
  589. SD.dict_code AS dict_code,
  590. ROUND( SUM( TW.f_grossweight ) / 1000, 2 ) AS count,
  591. round( SUM( TW.f_grossweight ) * 100 /( SELECT SUM( f_grossweight ) AS total FROM t_warehousebills ), 2 ) AS
  592. rate
  593. FROM
  594. sys_dict_data SD
  595. JOIN t_warehousebills TW ON SD.dict_value = TW.f_trademodeid
  596. WHERE
  597. TW.f_warehouseid = #{wareHouseId}
  598. <if test="startTime != null and startTime != ''">
  599. and TW.f_bsdate >= #{startTime}
  600. </if>
  601. <if test="endTime != null and endTime != ''">
  602. and TW.f_bsdate &lt;= #{endTime}
  603. </if>
  604. <if test="(startTime == null and endTime == null) or (startTime == '' and endTime == '')">
  605. and DATE_SUB( CURDATE(), INTERVAL 7 DAY ) &lt;= date(TW.f_bsdate)
  606. </if>
  607. and SD.dict_type = 'data_trademodes'
  608. GROUP BY
  609. SD.dict_label) da on SDD.dict_code = da.dict_code
  610. WHERE
  611. SDD.dict_type = 'data_trademodes'
  612. GROUP BY
  613. SDD.dict_label
  614. </select>
  615. <select id="getCargoInfoTrend" resultType="map">
  616. SELECT
  617. f_bsdate as time,
  618. ROUND( SUM(TW.f_grossweight) / 1000, 2 ) as value
  619. FROM
  620. t_warehousebills TW
  621. LEFT JOIN sys_dict_data SDD ON SDD.dict_type = 'data_trademodes' AND SDD.dict_value = TW.f_trademodeid
  622. <where>
  623. TW.del_flag = '0'
  624. AND TW.f_warehouseid = #{wareHouseId}
  625. AND SDD.dict_value = #{FTradeModeId}
  626. <if test="startTime != null and startTime != ''">
  627. and TW.f_bsdate >= #{startTime}
  628. </if>
  629. <if test="endTime != null and endTime != ''">
  630. and TW.f_bsdate &lt;= #{endTime}
  631. </if>
  632. <if test="(startTime == null and endTime == null) or (startTime == '' and endTime == '')">
  633. and DATE_SUB( CURDATE(), INTERVAL 7 DAY ) &lt;= date(TW.f_bsdate)
  634. </if>
  635. </where>
  636. GROUP BY
  637. SDD.dict_label
  638. </select>
  639. <select id="getStorageTop" resultType="map">
  640. SELECT
  641. TG.f_name AS goodsName,
  642. ROUND( SUM(TW.f_grossweight) / 1000, 2 ) as normalCnt,
  643. '' AS receiptCnt
  644. FROM
  645. t_warehousebillsitems TW
  646. LEFT JOIN t_goods TG ON TG.f_id = TW.f_goodsid
  647. <where>
  648. TW.del_flag = '0'
  649. AND TW.f_warehouselocid = #{wareHouseId}
  650. <if test="countType != null and countType != '' and countType == 2">
  651. and TW.f_billtype in ('SJRK','SJCK')
  652. </if>
  653. </where>
  654. GROUP BY TW.f_goodsid
  655. ORDER BY IFNULL( ROUND( SUM(TW.f_grossweight) / 1000, 2 ), 0 ) DESC
  656. LIMIT #{topCnt}
  657. </select>
  658. <select id="getGoodsTop" resultType="map">
  659. SELECT
  660. TC.f_name AS ownerName,
  661. ROUND( SUM(TW.f_grossweight) / 1000, 2 ) as count
  662. FROM
  663. t_warehousebills TW
  664. LEFT JOIN t_corps TC ON TC.f_id = TW.f_corpid
  665. <where>
  666. TW.del_flag = '0'
  667. AND TW.f_warehouseid = #{wareHouseId}
  668. <if test="countType != null and countType != '' and countType == 2">
  669. and TW.f_billtype in ('SJRK','SJCK')
  670. </if>
  671. </where>
  672. GROUP BY TW.f_corpid
  673. ORDER BY IFNULL( ROUND( SUM(TW.f_grossweight) / 1000, 2 ), 0 ) DESC
  674. LIMIT #{topCnt}
  675. </select>
  676. <select id="getTransferTransaction" resultType="map">
  677. SELECT
  678. f_bsdate as time,
  679. ROUND( SUM(f_grossweight) / 1000, 2 ) as value
  680. FROM
  681. t_warehousebills
  682. <where>
  683. del_flag = '0'
  684. AND f_warehouseid = #{wareHouseId}
  685. <if test="startTime != null and startTime != ''">
  686. and f_bsdate >= #{startTime}
  687. </if>
  688. <if test="endTime != null and endTime != ''">
  689. and f_bsdate &lt;= #{endTime}
  690. </if>
  691. <if test="(startTime == null and endTime == null) or (startTime == '' and endTime == '')">
  692. and DATE_SUB( CURDATE(), INTERVAL 7 DAY ) &lt;= date(f_bsdate)
  693. </if>
  694. </where>
  695. </select>
  696. <select id="getWorkInfo" resultType="map">
  697. SELECT
  698. IFNULL( ROUND( SUM( TW.f_grossweight ) / 1000, 2 ),0) AS Fgrossweight,
  699. COUNT(f_id) AS count
  700. FROM
  701. t_warehousebills TW
  702. <where>
  703. TW.del_flag = '0'
  704. AND TW.f_warehouseid = #{wareHouseId}
  705. <if test="countType != null and countType != ''">
  706. and TW.f_billtype = #{countType}
  707. </if>
  708. </where>
  709. </select>
  710. <select id="getWorkTrend" resultType="map">
  711. SELECT
  712. TW.f_bsdate as time,
  713. count(*) AS value
  714. FROM
  715. t_warehousebills TW
  716. inner join t_warehousebillsitems TWI on TW.f_id = TWI.f_pid
  717. <where>
  718. TW.del_flag = '0' and TWI.del_flag = '0'
  719. AND TW.f_warehouseid = #{wareHouseId}
  720. <if test="countType != null and countType != ''">
  721. and TW.f_billtype = #{countType}
  722. </if>
  723. <if test="startTime != null and startTime != ''">
  724. and TW.f_bsdate >= #{startTime}
  725. </if>
  726. <if test="endTime != null and endTime != ''">
  727. and TW.f_bsdate &lt;= #{endTime}
  728. </if>
  729. <if test="(startTime == null and endTime == null) or (startTime == '' and endTime == '')">
  730. and DATE_SUB( CURDATE(), INTERVAL 7 DAY ) &lt;= date(TW.f_bsdate)
  731. </if>
  732. </where>
  733. </select>
  734. <select id="inventoryQueries" resultType="com.ruoyi.warehouseBusiness.response.InventoryQueryResponse">
  735. SELECT
  736. TWBI.f_business_type,
  737. TW.f_mblno AS warehouseSerialNumber,
  738. TW.f_originalbilldate AS originalWarehousingDate,
  739. TG.f_name AS cargoName,
  740. TW.f_marks AS cargoModel,
  741. (
  742. CASE
  743. TWBI.f_business_type
  744. WHEN '2' THEN
  745. TWBI.f_marks
  746. ELSE '' END
  747. ) AS cargoSpec,
  748. SUM( TW.f_qtyblc ) AS cargoQuantity,
  749. IFNULL( ROUND( SUM( TW.f_netweightblc ) / 1000, 2 ), 0 ) AS netWeight,
  750. IFNULL( ROUND( SUM( TW.f_grossweightblc ) / 1000, 2 ), 0 ) AS grossWeight,
  751. TWH.f_addr AS warehouseAddress,
  752. TC.f_name AS sourceOwnerName,
  753. TC.uscc AS sourceOwnerSocialIdentifier,
  754. TC.f_name AS currentOwnerName,
  755. TC.uscc AS currentOwnerSocialIdentifier,
  756. TW.f_originalbilldate AS rentBeginDate,
  757. '' AS storageRate,
  758. TW.f_marks AS mark,
  759. SUM( TW.f_qtyblc ) AS number,
  760. (CASE
  761. TWBI.f_business_type
  762. WHEN '3' THEN
  763. TWBI.f_marks ELSE ''
  764. END) AS manufacturer,
  765. '' AS trademark,
  766. '' AS grade,
  767. TG.f_packagespecs AS packing,
  768. '' AS country,
  769. '' AS process,
  770. TWBI.f_warehouse_information AS location
  771. FROM t_whgenleg TW
  772. LEFT JOIN t_goods TG ON TG.f_id = TW.f_goodsid
  773. LEFT JOIN t_warehouse TWH ON TW.f_warehouseid = TWH.f_id
  774. LEFT JOIN t_corps TC ON TC.f_id = TW.f_corpid
  775. LEFT JOIN (
  776. SELECT DISTINCT
  777. TWB.f_ifpledge,
  778. TWB.f_mblno,
  779. bi.f_business_type,
  780. bi.f_marks,
  781. bi.f_warehouse_information,
  782. bi.f_warehouselocid
  783. FROM
  784. t_warehousebills TWB
  785. LEFT JOIN t_warehousebillsitems bi ON bi.f_pid = TWB.f_id
  786. WHERE
  787. TWB.del_flag = '0'
  788. <if test="numbersList != null and numbersList != ''">
  789. and TWB.f_mblno IN
  790. <foreach item="number" collection="numbersList" open="(" separator="," close=")">
  791. #{number}
  792. </foreach>
  793. </if>
  794. ) TWBI ON TWBI.f_mblno = TW.f_mblno
  795. AND TWBI.f_warehouselocid = TW.f_warehouseid
  796. <where>
  797. TW.del_flag = '0'
  798. and TW.f_netweightblc != 0
  799. AND (TWBI.f_ifpledge != 0 or TWBI.f_ifpledge IS NULL)
  800. <if test="ownerName != null and ownerName != ''">
  801. and TC.f_name = #{ownerName}
  802. </if>
  803. <if test="identifier != null and identifier != ''">
  804. and TC.uscc = #{identifier}
  805. </if>
  806. <if test="numbersList != null and numbersList != ''">
  807. and TW.f_mblno in
  808. <foreach item="number" collection="numbersList" open="(" separator="," close=")">
  809. #{number}
  810. </foreach>
  811. </if>
  812. </where>
  813. GROUP BY
  814. TW.f_mblno
  815. </select>
  816. <select id="inventoryQueriesV2" resultType="com.ruoyi.warehouseBusiness.response.InventoryQueryTwoResponse">
  817. SELECT
  818. TWH.f_no AS warehouseCode,
  819. TWH.f_name AS warehouseName,
  820. TW.f_mblno AS blNo,
  821. TW.f_originalbilldate AS originalWarehousingDate,
  822. TW.f_originalbilldate AS rentBeginDate,
  823. TC.f_name AS sourceOwnerName,
  824. TC.uscc AS sourceOwnerSocialIdentifier,
  825. TC.f_name AS currentOwnerName,
  826. TC.uscc AS currentOwnerSocialIdentifier,
  827. TWH.f_addr AS warehouseAddress,
  828. TG.f_name AS cargoName,
  829. TW.f_marks AS cargoModel,
  830. TG.f_specs AS cargoSpec,
  831. IFNULL( ROUND( SUM( TW.f_netweightblc ) / 1000, 2 ), 0 ) AS netWeight,
  832. IFNULL( ROUND( SUM( TW.f_grossweightblc ) / 1000, 2 ), 0 ) AS grossWeight,
  833. SUM( TW.f_qtyblc ) AS cargoQuantity,
  834. '' AS storageRate,
  835. TW.f_marks AS mark,
  836. SUM( TW.f_qtyblc ) AS number,
  837. '' AS manufacturer,
  838. '' AS trademark,
  839. '' AS grade,
  840. TG.f_packagespecs AS packing,
  841. '' AS country,
  842. '' AS process,
  843. '' AS location
  844. FROM t_whgenleg TW
  845. LEFT JOIN t_goods TG ON TG.f_id = TW.f_goodsid
  846. LEFT JOIN t_warehouse TWH ON TW.f_warehouseid = TWH.f_id
  847. LEFT JOIN t_corps TC ON TC.f_id = TW.f_corpid
  848. <where>
  849. TW.del_flag = '0'
  850. and TW.f_netweightblc != 0
  851. /* AND (TWBI.f_ifpledge != 0 or TWBI.f_ifpledge IS NULL)*/
  852. <if test="ownerName != null and ownerName != ''">
  853. and TC.f_name = #{ownerName}
  854. </if>
  855. <if test="identifier != null and identifier != ''">
  856. and TC.uscc = #{identifier}
  857. </if>
  858. <if test="queryAll = 1">
  859. and TWH.parent_id = 100
  860. </if>
  861. <if test="numbersList != null and numbersList != '' and queryAll = 0">
  862. and TWH.f_no in
  863. <foreach item="number" collection="numbersList" open="(" separator="," close=")">
  864. #{number}
  865. </foreach>
  866. </if>
  867. <if test="blNosList != null and blNosList != ''">
  868. and TW.f_mblno in
  869. <foreach item="number" collection="blNosList" open="(" separator="," close=")">
  870. #{number}
  871. </foreach>
  872. </if>
  873. </where>
  874. GROUP BY
  875. TW.f_mblno
  876. </select>
  877. <update id="receiptRegister">
  878. update t_warehousebills TW
  879. LEFT JOIN t_corps TC ON TC.f_id = TW.f_corpid
  880. SET TW.f_ifpledge = '0'
  881. <where>
  882. TW.del_flag = '0'
  883. <if test="ownerName != null and ownerName != ''">
  884. and TC.f_name = #{ownerName}
  885. </if>
  886. <if test="identifier != null and identifier != ''">
  887. and TC.uscc = #{identifier}
  888. </if>
  889. <if test="numbers != null and numbers != ''">
  890. and TW.f_mblno = #{numbers}
  891. </if>
  892. </where>
  893. </update>
  894. <update id="receiptCancel">
  895. update t_warehousebills TW
  896. LEFT JOIN t_corps TC ON TC.f_id = TW.f_corpid
  897. SET TW.f_ifpledge = '1'
  898. <where>
  899. TW.del_flag = '0'
  900. <if test="ownerName != null and ownerName != ''">
  901. and TC.f_name = #{ownerName}
  902. </if>
  903. <if test="identifier != null and identifier != ''">
  904. and TC.uscc = #{identifier}
  905. </if>
  906. <if test="numbers != null and numbers != ''">
  907. and TW.f_mblno = #{numbers}
  908. </if>
  909. </where>
  910. </update>
  911. <select id="selectByPidANDName" resultMap="TWarehouseResult">
  912. <include refid="selectTWarehouseVo"/>
  913. <where>
  914. parent_id = #{fWarehouseid} and del_flag = '0' and f_name =#{stringCellValue}
  915. </where>
  916. </select>
  917. <select id="getStorageTopS" resultType="java.util.Map">
  918. SELECT
  919. TG.f_name AS goodsName,
  920. ROUND( SUM(TW.f_grossweightblc) / 1000, 2 ) as normalCnt,
  921. '' AS receiptCnt
  922. FROM
  923. t_whgenleg TW
  924. LEFT JOIN t_goods TG ON TG.f_id = TW.f_goodsid
  925. <where>
  926. TW.del_flag = '0'
  927. AND TW.f_warehouseid = #{wareHouseId}
  928. </where>
  929. GROUP BY TW.f_goodsid
  930. ORDER BY IFNULL( ROUND( SUM(TW.f_grossweightblc) / 1000, 2 ), 0 ) DESC
  931. LIMIT #{topCnt}
  932. </select>
  933. <select id="nominateTreeselect" resultMap="TWarehouseResult">
  934. <include refid="selectTWarehouseVo"/>
  935. <where>
  936. parent_id = 100 and
  937. <if test="warehouseIdList != null and warehouseIdList != ''">
  938. f_id in
  939. <foreach item="number" collection="warehouseIdList" open="(" separator="," close=")">
  940. #{number}
  941. </foreach>
  942. or
  943. <foreach collection="warehouseIdList" item="item" index="index" separator="OR">
  944. ancestors LIKE CONCAT('%',#{item},'%')
  945. </foreach>
  946. </if>
  947. <if test="tWarehouse.parentId != null and tWarehouse.parentId != ''">and parent_id =
  948. #{tWarehouse.parentId}
  949. </if>
  950. <if test="tWarehouse.fIsBonded != null and tWarehouse.fIsBonded != ''">and f_is_bonded =
  951. #{tWarehouse.fIsBonded}
  952. </if>
  953. <if test="tWarehouse.ancestors != null and tWarehouse.ancestors != ''">and ancestors like concat('%',
  954. #{tWarehouse.ancestors}, '%')
  955. </if>
  956. <if test="tWarehouse.fNo != null and tWarehouse.fNo != ''">and f_no like concat('%', #{tWarehouse.fNo},
  957. '%')
  958. </if>
  959. <if test="tWarehouse.fName != null and tWarehouse.fName != ''">and f_name like concat('%',
  960. #{tWarehouse.fName}, '%')
  961. </if>
  962. <if test="tWarehouse.fCname != null and tWarehouse.fCname != ''">and f_cname like concat('%',
  963. #{tWarehouse.fCname}, '%')
  964. </if>
  965. <if test="tWarehouse.fAddr != null and tWarehouse.fAddr != ''">and f_addr like concat('%',
  966. #{tWarehouse.fAddr}, '%')
  967. </if>
  968. <if test="tWarehouse.fTotalgross != null ">and f_totalgross like concat('%', #{tWarehouse.fTotalgross},
  969. '%')
  970. </if>
  971. <if test="tWarehouse.fContacts != null and tWarehouse.fContacts != ''">and f_contacts =
  972. #{tWarehouse.fContacts}
  973. </if>
  974. <if test="tWarehouse.fTel != null and tWarehouse.fTel != ''">and f_tel = #{tWarehouse.fTel}</if>
  975. <if test="tWarehouse.fCharg != null ">and f_charg = #{tWarehouse.fCharg}</if>
  976. <if test="tWarehouse.fStatus != null and tWarehouse.fStatus != ''">and f_status = #{tWarehouse.fStatus}
  977. </if>
  978. <if test="tWarehouse.supervise != null and tWarehouse.supervise != ''">and supervise =
  979. #{tWarehouse.supervise}
  980. </if>
  981. <if test="tWarehouse.fProperties != null and tWarehouse.fProperties != ''">and f_properties like concat('%',
  982. #{tWarehouse.fProperties}, '%')
  983. </if>
  984. <if test="tWarehouse.fType != null and tWarehouse.fType != ''">and f_type like concat('%',
  985. #{tWarehouse.fType}, '%')
  986. </if>
  987. <if test="tWarehouse.fGoodsType != null and tWarehouse.fGoodsType != ''">and f_goods_type like concat('%',
  988. #{tWarehouse.fGoodsType}, '%')
  989. </if>
  990. <if test="tWarehouse.fCoverArea != null and tWarehouse.fCoverArea != ''">and f_cover_area like concat('%',
  991. #{tWarehouse.fCoverArea}, '%')
  992. </if>
  993. </where>
  994. <!-- 数据范围过滤 -->
  995. order by parent_id, order_num, convert(f_name using gbk)
  996. </select>
  997. <select id="getByFIdList" resultMap="TWarehouseResult">
  998. <include refid="selectTWarehouseVo"/>
  999. <where>
  1000. parent_id = 100 and f_id in
  1001. <foreach collection="warehouseIdList" item="fid" index="index" open="(" close=")"
  1002. separator=",">
  1003. #{fid}
  1004. </foreach>
  1005. </where>
  1006. </select>
  1007. <select id="getOne" resultType="TWarehouse" resultMap="TWarehouseResult">
  1008. <include refid="selectTWarehouseVo"/>
  1009. <where>
  1010. <if test="fNo != null and fNo != ''">and f_no = #{fNo}</if>
  1011. <if test="fId != null and fId != ''">and f_id = #{fId}</if>
  1012. <if test="parentId != null and parentId != ''">and parent_id = #{parentId}</if>
  1013. </where>
  1014. </select>
  1015. <select id="getWarehouseByFNo" parameterType="String" resultMap="TWarehouseResult">
  1016. <include refid="selectTWarehouseVo"/>
  1017. <where>
  1018. f_no = #{fNo} and del_flag = '0' limit 1
  1019. </where>
  1020. </select>
  1021. </mapper>