TWhgenlegMapper.xml 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479
  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.reportManagement.mapper.TWhgenlegMapper">
  6. <resultMap type="TWhgenleg" id="TWhgenlegResult">
  7. <result property="fId" column="f_id"/>
  8. <result property="fAccyear" column="f_accyear"/>
  9. <result property="fAccmonth" column="f_accmonth"/>
  10. <result property="fCorpid" column="f_corpid"/>
  11. <result property="fMblno" column="f_mblno"/>
  12. <result property="fOriginalbillno" column="f_originalbillno"/>
  13. <result property="fWarehouseLocationid" column="f_warehouse_locationid"/>
  14. <result property="fGoodsid" column="f_goodsid"/>
  15. <result property="fChargedate" column="f_chargedate"/>
  16. <result property="fTrademodeid" column="f_trademodeid"/>
  17. <result property="fPreqty" column="f_preqty"/>
  18. <result property="fWarehouseid" column="f_warehouseid"/>
  19. <result property="fPregrossweight" column="f_pregrossweight"/>
  20. <result property="fPrenetweight" column="f_prenetweight"/>
  21. <result property="fQtyd" column="f_qtyD"/>
  22. <result property="fVolumnd" column="f_volumnD"/>
  23. <result property="fBillingway" column="f_billingway"/>
  24. <result property="fGrossweightd" column="f_grossweightD"/>
  25. <result property="fNetweightd" column="f_netweightD"/>
  26. <result property="fVolumnc" column="f_volumnC"/>
  27. <result property="fQtyc" column="f_qtyC"/>
  28. <result property="fGrossweightc" column="f_grossweightC"/>
  29. <result property="fQtyblc" column="f_qtyblc"/>
  30. <result property="fGrossweightblc" column="f_grossweightblc"/>
  31. <result property="fNetweightc" column="f_netweightC"/>
  32. <result property="fNetweightblc" column="f_netweightblc"/>
  33. <result property="fCntrno" column="f_cntrno"/>
  34. <result property="fStatus" column="f_status"/>
  35. <result property="delFlag" column="del_flag"/>
  36. <result property="createBy" column="create_by"/>
  37. <result property="fMarks" column="f_marks"/>
  38. <result property="createTime" column="create_time"/>
  39. <result property="updateBy" column="update_by"/>
  40. <result property="updateTime" column="update_time"/>
  41. <result property="remark" column="remark"/>
  42. <result property="fOriginalbilldate" column="f_originalbilldate"/>
  43. </resultMap>
  44. <sql id="selectTWhgenlegVo">
  45. select f_id, f_accyear, f_accmonth, f_corpid, f_mblno, f_originalbillno, f_warehouse_locationid, f_goodsid, f_chargedate, f_trademodeid, f_preqty, f_warehouseid, f_pregrossweight, f_prenetweight, f_qtyD, f_volumnD, f_billingway, f_grossweightD, f_netweightD, f_volumnC, f_qtyC, f_grossweightC, f_qtyblc, f_grossweightblc, f_netweightC, f_netweightblc, f_cntrno, f_status, del_flag, create_by, f_marks, create_time, update_by, update_time, remark, f_originalbilldate from t_whgenleg
  46. </sql>
  47. <select id="selectTWhgenlegList" parameterType="TWhgenleg" resultMap="TWhgenlegResult">
  48. <include refid="selectTWhgenlegVo"/>
  49. <where>
  50. <if test="fOriginalbillno != null and fOriginalbillno != ''">and f_originalbillno = #{fOriginalbillno}</if>
  51. <if test="fChargedate != null ">and f_chargedate = #{fChargedate}</if>
  52. <if test="fPreqty != null ">and f_preqty = #{fPreqty}</if>
  53. <if test="fWarehouseid != null ">and f_warehouseid = #{fWarehouseid}</if>
  54. <if test="fPregrossweight != null ">and f_pregrossweight = #{fPregrossweight}</if>
  55. <if test="fPrenetweight != null ">and f_prenetweight = #{fPrenetweight}</if>
  56. <if test="fQtyd != null ">and f_qtyD = #{fQtyd}</if>
  57. <if test="fVolumnd != null ">and f_volumnD = #{fVolumnd}</if>
  58. <if test="fBillingway != null ">and f_billingway = #{fBillingway}</if>
  59. <if test="fGrossweightd != null ">and f_grossweightD = #{fGrossweightd}</if>
  60. <if test="fNetweightd != null ">and f_netweightD = #{fNetweightd}</if>
  61. <if test="fVolumnc != null ">and f_volumnC = #{fVolumnc}</if>
  62. <if test="fQtyc != null ">and f_qtyC = #{fQtyc}</if>
  63. <if test="fGrossweightc != null ">and f_grossweightC = #{fGrossweightc}</if>
  64. <if test="fQtyblc != null ">and f_qtyblc = #{fQtyblc}</if>
  65. <if test="fGrossweightblc != null ">and f_grossweightblc = #{fGrossweightblc}</if>
  66. <if test="fNetweightc != null ">and f_netweightC = #{fNetweightc}</if>
  67. <if test="fNetweightblc != null ">and f_netweightblc = #{fNetweightblc}</if>
  68. <if test="fCntrno != null and fCntrno != ''">and f_cntrno = #{fCntrno}</if>
  69. <if test="fStatus != null and fStatus != ''">and f_status = #{fStatus}</if>
  70. <if test="fMarks != null and fMarks != ''">and f_marks = #{fMarks}</if>
  71. <if test="fOriginalbilldate != null ">and f_originalbilldate = #{fOriginalbilldate}</if>
  72. </where>
  73. </select>
  74. <select id="selectInventoryList" parameterType="TWhgenleg" resultType="Map">
  75. select
  76. DISTINCT
  77. leg.f_id AS fId,
  78. corp.f_name AS fCorpid,
  79. area.f_name AS fWarehouseLocationids,
  80. leg.f_originalbillno AS fOriginalbillno,
  81. leg.f_warehouse_locationid AS fWarehouseLocationid,
  82. leg.f_trademodeid AS fTrademodeid,
  83. goods.f_name AS fGoodsids,
  84. leg.f_goodsid AS fGoodsid,
  85. leg.f_volumnD AS fVolumnD,
  86. leg.f_qtyD AS fQtyD,
  87. leg.f_mblno AS fMblno,
  88. leg.f_grossweightD AS fGrossweightD,
  89. leg.f_netweightD AS fNetweightD,
  90. leg.f_volumnC AS fVolumnC,
  91. leg.f_qtyC AS fQtyC,
  92. leg.f_grossweightC AS fGrossweightC,
  93. leg.f_netweightC AS fNetweightC,
  94. leg.f_qtyblc AS fQtyblc,
  95. leg.f_grossweightblc AS fGrossweightblc,
  96. leg.f_netweightblc AS fNetweightblc,
  97. leg.f_marks AS fMarks,
  98. DATE_FORMAT( leg.create_time, '%Y-%m-%d' ) AS createTime,
  99. DATE_FORMAT( leg.f_originalbilldate, '%Y-%m-%d' ) AS fOriginalbilldate,
  100. leg.f_cntrno AS fCntrno
  101. FROM
  102. t_whgenleg leg
  103. LEFT JOIN t_corps corp ON corp.f_id = leg.f_corpid
  104. LEFT JOIN t_warehouse_area area ON area.f_id = leg.f_warehouse_locationid
  105. LEFT JOIN t_goods goods ON goods.f_id = leg.f_goodsid
  106. <where>
  107. <if test="fOriginalbillno != null and fOriginalbillno != ''">and leg.f_originalbillno =
  108. #{fOriginalbillno}
  109. </if>
  110. <if test="fPreqty != null ">and leg.f_preqty = #{fPreqty}</if>
  111. <if test="fCorpid != null ">and leg.f_corpid = #{fCorpid}</if>
  112. <if test="fMblno != null ">and leg.f_mblno = #{fMblno}</if>
  113. <if test='orgStorageDate != null and orgStorageDate[0] != null and orgStorageDate[0]!= ""'>
  114. and leg.f_originalbilldate &gt;= #{orgStorageDate[0]}
  115. </if>
  116. <if test='orgStorageDate != null and orgStorageDate[1] != null and orgStorageDate[1]!= ""'>
  117. and leg.f_originalbilldate &lt;= #{orgStorageDate[1]}
  118. </if>
  119. <if test="fPregrossweight != null ">and leg.f_pregrossweight = #{fPregrossweight}</if>
  120. <if test="fPrenetweight != null ">and leg.f_prenetweight = #{fPrenetweight}</if>
  121. <if test="fQtyd != null ">and leg.f_qtyD = #{fQtyd}</if>
  122. <if test="fTrademodeid != null ">and leg.f_trademodeid = #{fTrademodeid}</if>
  123. <if test="fGoodsid != null ">and leg.f_goodsid = #{fGoodsid}</if>
  124. <if test="fWarehouseid != null ">and leg.f_warehouseid = #{fWarehouseid}</if>
  125. <if test="fWarehouseLocationid != null ">and leg.f_warehouse_locationid = #{fWarehouseLocationid}</if>
  126. <if test="fVolumnd != null ">and leg.f_volumnD = #{fVolumnd}</if>
  127. <if test="fGrossweightd != null ">and leg.f_grossweightD = #{fGrossweightd}</if>
  128. <if test="fNetweightd != null ">and leg.f_netweightD = #{fNetweightd}</if>
  129. <if test="fVolumnc != null ">and leg.f_volumnC = #{fVolumnc}</if>
  130. <if test="fQtyc != null ">and leg.f_qtyC = #{fQtyc}</if>
  131. <if test="fOriginalbilldate != null ">and leg.f_originalbilldate = #{fOriginalbilldate}</if>
  132. <if test="fMarks != null and fMarks != ''">and leg.f_marks = #{fMarks}</if>
  133. <if test="fQtyblc != null ">and leg.f_qtyblc = #{fQtyblc}</if>
  134. <if test="fGrossweightc != null ">and leg.f_grossweightC = #{fGrossweightc}</if>
  135. <if test="fNetweightc != null ">and leg.f_netweightC = #{fNetweightc}</if>
  136. <if test="fGrossweightblc != null ">and leg.f_grossweightblc = #{fGrossweightblc}</if>
  137. <if test="fNetweightblc != null ">and leg.f_netweightblc = #{fNetweightblc}</if>
  138. <if test="fCntrno != null and fCntrno != ''">and leg.f_cntrno = #{fCntrno}</if>
  139. <if test="fStatus != null and fStatus != ''">and leg.f_status = #{fStatus}</if>
  140. </where>
  141. </select>
  142. <select id="selectTWhgenleg" parameterType="TWhgenleg" resultMap="TWhgenlegResult">
  143. <include refid="selectTWhgenlegVo"/>
  144. <where>
  145. <if test="fCorpid != null ">and f_corpid = #{fCorpid}</if>
  146. <if test="fMblno != null ">and f_mblno = #{fMblno}</if>
  147. <if test="fGoodsid != null ">and f_goodsid = #{fGoodsid}</if>
  148. <if test="fTrademodeid != null ">and f_trademodeid = #{fTrademodeid}</if>
  149. <if test="fWarehouseLocationid != null ">and f_warehouse_locationid = #{fWarehouseLocationid}</if>
  150. </where>
  151. </select>
  152. <select id="selectTWhgenlegById" parameterType="Long" resultMap="TWhgenlegResult">
  153. <include refid="selectTWhgenlegVo"/>
  154. where f_accyear = #{fAccyear}
  155. </select>
  156. <insert id="insertTWhgenleg" parameterType="TWhgenleg">
  157. insert into t_whgenleg
  158. <trim prefix="(" suffix=")" suffixOverrides=",">
  159. <if test="fAccyear != null">f_accyear,</if>
  160. <if test="fAccmonth != null">f_accmonth,</if>
  161. <if test="fCorpid != null">f_corpid,</if>
  162. <if test="fMblno != null">f_mblno,</if>
  163. <if test="fOriginalbillno != null">f_originalbillno,</if>
  164. <if test="fWarehouseLocationid != null">f_warehouse_locationid,</if>
  165. <if test="fGoodsid != null">f_goodsid,</if>
  166. <if test="fChargedate != null">f_chargedate,</if>
  167. <if test="fTrademodeid != null">f_trademodeid,</if>
  168. <if test="fPreqty != null">f_preqty,</if>
  169. <if test="fWarehouseid != null">f_warehouseid,</if>
  170. <if test="fPregrossweight != null">f_pregrossweight,</if>
  171. <if test="fPrenetweight != null">f_prenetweight,</if>
  172. <if test="fQtyd != null">f_qtyD,</if>
  173. <if test="fVolumnd != null">f_volumnD,</if>
  174. <if test="fBillingway != null">f_billingway,</if>
  175. <if test="fGrossweightd != null">f_grossweightD,</if>
  176. <if test="fNetweightd != null">f_netweightD,</if>
  177. <if test="fVolumnc != null">f_volumnC,</if>
  178. <if test="fQtyc != null">f_qtyC,</if>
  179. <if test="fGrossweightc != null">f_grossweightC,</if>
  180. <if test="fQtyblc != null">f_qtyblc,</if>
  181. <if test="fGrossweightblc != null">f_grossweightblc,</if>
  182. <if test="fNetweightc != null">f_netweightC,</if>
  183. <if test="fNetweightblc != null">f_netweightblc,</if>
  184. <if test="fCntrno != null">f_cntrno,</if>
  185. <if test="fStatus != null">f_status,</if>
  186. <if test="delFlag != null">del_flag,</if>
  187. <if test="createBy != null">create_by,</if>
  188. <if test="fMarks != null and fMarks != ''">f_marks,</if>
  189. <if test="createTime != null">create_time,</if>
  190. <if test="updateBy != null">update_by,</if>
  191. <if test="updateTime != null">update_time,</if>
  192. <if test="remark != null">remark,</if>
  193. <if test="fOriginalbilldate != null">f_originalbilldate,</if>
  194. </trim>
  195. <trim prefix="values (" suffix=")" suffixOverrides=",">
  196. <if test="fAccyear != null">#{fAccyear},</if>
  197. <if test="fAccmonth != null">#{fAccmonth},</if>
  198. <if test="fCorpid != null">#{fCorpid},</if>
  199. <if test="fMblno != null">#{fMblno},</if>
  200. <if test="fOriginalbillno != null">#{fOriginalbillno},</if>
  201. <if test="fWarehouseLocationid != null">#{fWarehouseLocationid},</if>
  202. <if test="fGoodsid != null">#{fGoodsid},</if>
  203. <if test="fChargedate != null">#{fChargedate},</if>
  204. <if test="fTrademodeid != null">#{fTrademodeid},</if>
  205. <if test="fPreqty != null">#{fPreqty},</if>
  206. <if test="fWarehouseid != null">#{fWarehouseid},</if>
  207. <if test="fPregrossweight != null">#{fPregrossweight},</if>
  208. <if test="fPrenetweight != null">#{fPrenetweight},</if>
  209. <if test="fQtyd != null">#{fQtyd},</if>
  210. <if test="fVolumnd != null">#{fVolumnd},</if>
  211. <if test="fBillingway != null">#{fBillingway},</if>
  212. <if test="fGrossweightd != null">#{fGrossweightd},</if>
  213. <if test="fNetweightd != null">#{fNetweightd},</if>
  214. <if test="fVolumnc != null">#{fVolumnc},</if>
  215. <if test="fQtyc != null">#{fQtyc},</if>
  216. <if test="fGrossweightc != null">#{fGrossweightc},</if>
  217. <if test="fQtyblc != null">#{fQtyblc},</if>
  218. <if test="fGrossweightblc != null">#{fGrossweightblc},</if>
  219. <if test="fNetweightc != null">#{fNetweightc},</if>
  220. <if test="fNetweightblc != null">#{fNetweightblc},</if>
  221. <if test="fCntrno != null">#{fCntrno},</if>
  222. <if test="fStatus != null">#{fStatus},</if>
  223. <if test="delFlag != null">#{delFlag},</if>
  224. <if test="createBy != null">#{createBy},</if>
  225. <if test="fMarks != null and fMarks != ''">#{fMarks},</if>
  226. <if test="createTime != null">#{createTime},</if>
  227. <if test="updateBy != null">#{updateBy},</if>
  228. <if test="updateTime != null">#{updateTime},</if>
  229. <if test="remark != null">#{remark},</if>
  230. <if test="fOriginalbilldate != null">#{fOriginalbilldate},</if>
  231. </trim>
  232. </insert>
  233. <update id="updateTWhgenleg" parameterType="TWhgenleg">
  234. update t_whgenleg
  235. <trim prefix="SET" suffixOverrides=",">
  236. <if test="fAccyear != null">f_accyear = #{fAccyear},</if>
  237. <if test="fAccmonth != null">f_accmonth = #{fAccmonth},</if>
  238. <if test="fCorpid != null">f_corpid = #{fCorpid},</if>
  239. <if test="fMblno != null">f_mblno = #{fMblno},</if>
  240. <if test="fOriginalbillno != null">f_originalbillno = #{fOriginalbillno},</if>
  241. <if test="fWarehouseLocationid != null">f_warehouse_locationid = #{fWarehouseLocationid},</if>
  242. <if test="fGoodsid != null">f_goodsid = #{fGoodsid},</if>
  243. <if test="fChargedate != null">f_chargedate = #{fChargedate},</if>
  244. <if test="fTrademodeid != null">f_trademodeid = #{fTrademodeid},</if>
  245. <if test="fPreqty != null">f_preqty = #{fPreqty},</if>
  246. <if test="fWarehouseid != null">f_warehouseid = #{fWarehouseid},</if>
  247. <if test="fPregrossweight != null">f_pregrossweight = #{fPregrossweight},</if>
  248. <if test="fPrenetweight != null">f_prenetweight = #{fPrenetweight},</if>
  249. <if test="fQtyd != null">f_qtyD = #{fQtyd},</if>
  250. <if test="fVolumnd != null">f_volumnD = #{fVolumnd},</if>
  251. <if test="fBillingway != null">f_billingway = #{fBillingway},</if>
  252. <if test="fGrossweightd != null">f_grossweightD = #{fGrossweightd},</if>
  253. <if test="fNetweightd != null">f_netweightD = #{fNetweightd},</if>
  254. <if test="fVolumnc != null">f_volumnC = #{fVolumnc},</if>
  255. <if test="fQtyc != null">f_qtyC = #{fQtyc},</if>
  256. <if test="fGrossweightc != null">f_grossweightC = #{fGrossweightc},</if>
  257. <if test="fQtyblc != null">f_qtyblc = #{fQtyblc},</if>
  258. <if test="fGrossweightblc != null">f_grossweightblc = #{fGrossweightblc},</if>
  259. <if test="fNetweightc != null">f_netweightC = #{fNetweightc},</if>
  260. <if test="fNetweightblc != null">f_netweightblc = #{fNetweightblc},</if>
  261. <if test="fCntrno != null">f_cntrno = #{fCntrno},</if>
  262. <if test="fStatus != null">f_status = #{fStatus},</if>
  263. <if test="delFlag != null">del_flag = #{delFlag},</if>
  264. <if test="createBy != null">create_by = #{createBy},</if>
  265. <if test="fMarks != null and fMarks != ''">f_marks = #{fMarks},</if>
  266. <if test="createTime != null">create_time = #{createTime},</if>
  267. <if test="updateBy != null">update_by = #{updateBy},</if>
  268. <if test="updateTime != null">update_time = #{updateTime},</if>
  269. <if test="remark != null">remark = #{remark},</if>
  270. <if test="fOriginalbilldate != null">f_originalbilldate = #{fOriginalbilldate},</if>
  271. </trim>
  272. where f_accyear = #{fAccyear}
  273. </update>
  274. <update id="updateTWhgenlegData" parameterType="Map">
  275. update t_whgenleg
  276. <trim prefix="SET" suffixOverrides=",">
  277. /*判断是否入库*/
  278. <if test="map.billType == 'SJRK'">
  279. f_qtyD = f_qtyD + #{map.warehousebillsitems.fQty},
  280. f_volumnD = f_volumnD + #{map.warehousebillsitems.fVolumn},
  281. f_netweightD = f_netweightD + #{map.warehousebillsitems.fNetweight},
  282. f_grossweightD = f_grossweightD + #{map.warehousebillsitems.fGrossweight},
  283. f_qtyblc = f_qtyblc + #{map.warehousebillsitems.fQty}
  284. </if>
  285. /*判断是否撤销入库*/
  286. <if test="map.billType == 'SJRKRevoke'">
  287. f_qtyD = f_qtyD - #{map.warehousebillsitems.fQty},
  288. f_volumnD = f_volumnD - #{map.warehousebillsitems.fVolumn},
  289. f_netweightD = f_netweightD - #{map.warehousebillsitems.fNetweight},
  290. f_grossweightD = f_grossweightD - #{map.warehousebillsitems.fGrossweight},
  291. f_qtyblc = f_qtyblc - #{map.warehousebillsitems.fQty}
  292. </if>
  293. /*判断是否出库*/
  294. <if test="map.billType == 'SJCK'">
  295. f_qtyC = f_qtyC + #{map.warehousebillsitems.fQty},
  296. f_volumnC = f_volumnC + #{map.warehousebillsitems.fVolumn},
  297. f_netweightC = f_netweightC + #{map.warehousebillsitems.fNetweight},
  298. f_grossweightC = f_grossweightC + #{map.warehousebillsitems.fGrossweight},
  299. f_qtyblc = f_qtyblc - #{map.warehousebillsitems.fQty}
  300. </if>
  301. /*判断是否撤销出库*/
  302. <if test="map.billType == 'SJCKRevoke'">
  303. f_qtyC = f_qtyC - #{map.warehousebillsitems.fQty},
  304. f_volumnC = f_volumnC - #{map.warehousebillsitems.fVolumn},
  305. f_netweightC = f_netweightC - #{map.warehousebillsitems.fNetweight},
  306. f_grossweightC = f_grossweightC - #{map.warehousebillsitems.fGrossweight},
  307. f_qtyblc = f_qtyblc + #{map.warehousebillsitems.fQty}
  308. </if>
  309. -- update_by = NOW()
  310. </trim>
  311. where f_id = #{map.whgenlegId}
  312. </update>
  313. <delete id="deleteTWhgenlegById" parameterType="Long">
  314. delete from t_whgenleg where f_accyear = #{fAccyear}
  315. </delete>
  316. <delete id="deleteTWhgenlegByIds" parameterType="String">
  317. delete from t_whgenleg where f_accyear in
  318. <foreach item="fAccyear" collection="array" open="(" separator="," close=")">
  319. #{fAccyear}
  320. </foreach>
  321. </delete>
  322. <select id="selectGoodsList" resultType="Map">
  323. SELECT
  324. t.f_goodsid AS fGoodsid,
  325. g.f_name AS fName
  326. FROM
  327. t_goods g
  328. RIGHT JOIN (
  329. SELECT
  330. f_goodsid AS f_goodsid
  331. FROM
  332. t_whgenleg
  333. GROUP BY
  334. f_goodsid
  335. ) t ON g.f_id = t.f_goodsid
  336. </select>
  337. <select id="selectGoodsListWhouse" resultType="Map">
  338. SELECT
  339. t.f_goodsid AS fGoodsid,
  340. g.f_name AS fName,
  341. w.f_name AS fWarehouseName,
  342. w.f_totalgross AS fTotalgross,
  343. t.f_grossweightD AS fGrossweightD
  344. FROM
  345. t_goods g
  346. RIGHT JOIN (
  347. SELECT
  348. f_goodsid AS f_goodsid,
  349. f_warehouseid AS f_warehouseid,
  350. sum( f_grossweightD ) AS f_grossweightD
  351. FROM
  352. t_whgenleg
  353. GROUP BY
  354. f_goodsid,
  355. f_warehouseid
  356. ORDER BY
  357. sum( f_grossweightD ) DESC
  358. ) t ON g.f_id = t.f_goodsid
  359. LEFT JOIN t_warehouse w ON w.f_id = t.f_warehouseid
  360. <where>
  361. <if test="fId != null ">and g.f_id = #{fId}</if>
  362. </where>
  363. </select>
  364. <select id="selectWareHouseList" resultType="Map">
  365. SELECT
  366. t.f_warehouseid AS fWarehouseid,
  367. w.f_name AS fName,
  368. t.f_grossweightD AS fGrossweightD,
  369. w.f_totalgross AS fTotalgross
  370. FROM
  371. t_warehouse w
  372. RIGHT JOIN (
  373. SELECT
  374. f_warehouseid AS f_warehouseid,
  375. sum( f_grossweightD ) AS f_grossweightD
  376. FROM
  377. t_whgenleg
  378. GROUP BY
  379. f_warehouseid
  380. ORDER BY
  381. sum( f_grossweightD ) DESC
  382. ) t ON w.f_id = t.f_warehouseid
  383. </select>
  384. <select id="selectWareHouseListWhouse" resultType="Map">
  385. SELECT
  386. t.f_warehouseid AS fWarehouseid,
  387. w.f_name AS fName,
  388. t.f_grossweightD AS fGrossweightD,
  389. w.f_totalgross AS fTotalgross
  390. FROM
  391. t_warehouse w
  392. RIGHT JOIN (
  393. SELECT
  394. f_warehouseid AS f_warehouseid,
  395. sum( f_grossweightD ) AS f_grossweightD
  396. FROM
  397. t_whgenleg
  398. GROUP BY
  399. f_warehouseid
  400. ORDER BY
  401. sum( f_grossweightD ) DESC
  402. ) t ON w.f_id = t.f_warehouseid
  403. <where>
  404. <if test="fId != null ">and w.f_id = #{fId}</if>
  405. </where>
  406. </select>
  407. <select id="selectCorpsList" resultType="Map">
  408. SELECT
  409. t.f_corpid AS fCorpid,
  410. c.f_name AS fName
  411. FROM
  412. t_corps c
  413. RIGHT JOIN (
  414. SELECT
  415. f_corpid AS f_corpid
  416. FROM
  417. t_whgenleg
  418. GROUP BY
  419. f_corpid
  420. ) t ON c.f_id = t.f_corpid
  421. </select>
  422. <select id="selectCorpsListWhouse" resultType="Map">
  423. SELECT
  424. t.f_corpid AS fCorpid,
  425. g.f_name AS fName,
  426. w.f_name AS fWarehouseName,
  427. w.f_totalgross AS fTotalgross,
  428. t.f_grossweightD AS fGrossweightD
  429. FROM
  430. t_corps g
  431. RIGHT JOIN (
  432. SELECT
  433. f_corpid AS f_corpid,
  434. f_warehouseid AS f_warehouseid,
  435. sum( f_grossweightD ) AS f_grossweightD
  436. FROM
  437. t_whgenleg
  438. GROUP BY
  439. f_corpid,
  440. f_warehouseid
  441. ORDER BY
  442. sum( f_grossweightD ) DESC
  443. ) t ON g.f_id = t.f_corpid
  444. LEFT JOIN t_warehouse w ON w.f_id = t.f_warehouseid
  445. <where>
  446. <if test="fId != null ">and g.f_id = #{fId}</if>
  447. </where>
  448. </select>
  449. <select id="selectDateFQtyblcListList" resultType="Map">
  450. SELECT
  451. t.f_originalbilldate AS fOriginalbilldate,
  452. sum(t.f_qtyblc) AS fQtyblc
  453. FROM
  454. t_whgenleg t
  455. WHERE
  456. t.f_originalbilldate &gt; #{map.frontday}
  457. AND t.f_originalbilldate &lt; #{map.nowadays}
  458. GROUP BY
  459. t.f_originalbilldate
  460. ORDER BY
  461. t.f_originalbilldate
  462. </select>
  463. </mapper>