DataKcglKcswDefaultMapper.xml 68 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.chinaitop.agile.mapper.DataKcglKcswDefaultMapper">
  4. <resultMap id="BaseResultMap" type="com.chinaitop.agile.model.DataKcglKcswDefault">
  5. <id column="DataID" jdbcType="CHAR" property="dataid" />
  6. <result column="UnitID" jdbcType="CHAR" property="unitid" />
  7. <result column="PeriodID" jdbcType="CHAR" property="periodid" />
  8. <result column="RoundID" jdbcType="TINYINT" property="roundid" />
  9. <result column="ModifyDate" jdbcType="TIMESTAMP" property="modifydate" />
  10. <result column="builder" jdbcType="CHAR" property="builder" />
  11. <result column="lkmc" jdbcType="VARCHAR" property="lkmc" />
  12. <result column="lkbm" jdbcType="VARCHAR" property="lkbm" />
  13. <result column="hwxz" jdbcType="CHAR" property="hwxz" />
  14. <result column="ch" jdbcType="INTEGER" property="ch" />
  15. <result column="hwh" jdbcType="INTEGER" property="hwh" />
  16. <result column="pz" jdbcType="CHAR" property="pz" />
  17. <result column="mxpz" jdbcType="CHAR" property="mxpz" />
  18. <result column="dj" jdbcType="CHAR" property="dj" />
  19. <result column="rq" jdbcType="TIMESTAMP" property="rq" />
  20. <result column="wjh" jdbcType="VARCHAR" property="wjh" />
  21. <result column="kcsl" jdbcType="DOUBLE" property="kcsl" />
  22. <result column="cjsj" jdbcType="TIMESTAMP" property="cjsj" />
  23. <result column="gb" jdbcType="VARCHAR" property="gb" />
  24. <result column="scnf" jdbcType="INTEGER" property="scnf" />
  25. </resultMap>
  26. <sql id="Example_Where_Clause">
  27. <where>
  28. <foreach collection="oredCriteria" item="criteria" separator="or">
  29. <if test="criteria.valid">
  30. <trim prefix="(" prefixOverrides="and" suffix=")">
  31. <foreach collection="criteria.criteria" item="criterion">
  32. <choose>
  33. <when test="criterion.noValue">
  34. and ${criterion.condition}
  35. </when>
  36. <when test="criterion.singleValue">
  37. and ${criterion.condition} #{criterion.value}
  38. </when>
  39. <when test="criterion.betweenValue">
  40. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  41. </when>
  42. <when test="criterion.listValue">
  43. and ${criterion.condition}
  44. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  45. #{listItem}
  46. </foreach>
  47. </when>
  48. </choose>
  49. </foreach>
  50. </trim>
  51. </if>
  52. </foreach>
  53. </where>
  54. </sql>
  55. <sql id="Update_By_Example_Where_Clause">
  56. <where>
  57. <foreach collection="example.oredCriteria" item="criteria" separator="or">
  58. <if test="criteria.valid">
  59. <trim prefix="(" prefixOverrides="and" suffix=")">
  60. <foreach collection="criteria.criteria" item="criterion">
  61. <choose>
  62. <when test="criterion.noValue">
  63. and ${criterion.condition}
  64. </when>
  65. <when test="criterion.singleValue">
  66. and ${criterion.condition} #{criterion.value}
  67. </when>
  68. <when test="criterion.betweenValue">
  69. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  70. </when>
  71. <when test="criterion.listValue">
  72. and ${criterion.condition}
  73. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  74. #{listItem}
  75. </foreach>
  76. </when>
  77. </choose>
  78. </foreach>
  79. </trim>
  80. </if>
  81. </foreach>
  82. </where>
  83. </sql>
  84. <sql id="Base_Column_List">
  85. DataID, UnitID, PeriodID, RoundID, ModifyDate, builder, lkmc, lkbm, hwxz, ch, hwh,
  86. pz, mxpz, dj, rq, wjh, kcsl, cjsj , gb
  87. </sql>
  88. <select id="selectByExample" parameterType="com.chinaitop.agile.model.DataKcglKcswDefaultExample" resultMap="BaseResultMap">
  89. select
  90. <if test="distinct">
  91. distinct
  92. </if>
  93. <include refid="Base_Column_List" />
  94. from data_kcgl_kcsw_default
  95. <if test="_parameter != null">
  96. <include refid="Example_Where_Clause" />
  97. </if>
  98. <if test="orderByClause != null">
  99. order by ${orderByClause}
  100. </if>
  101. </select>
  102. <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
  103. select
  104. <include refid="Base_Column_List" />
  105. from data_kcgl_kcsw_default
  106. where DataID = #{dataid,jdbcType=CHAR}
  107. </select>
  108. <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
  109. delete from data_kcgl_kcsw_default
  110. where DataID = #{dataid,jdbcType=CHAR}
  111. </delete>
  112. <delete id="deleteByExample" parameterType="com.chinaitop.agile.model.DataKcglKcswDefaultExample">
  113. delete from data_kcgl_kcsw_default
  114. <if test="_parameter != null">
  115. <include refid="Example_Where_Clause" />
  116. </if>
  117. </delete>
  118. <insert id="insert" parameterType="com.chinaitop.agile.model.DataKcglKcswDefault">
  119. insert into data_kcgl_kcsw_default (DataID, UnitID, PeriodID,
  120. RoundID, ModifyDate, builder,
  121. lkmc, lkbm, hwxz, ch,
  122. hwh, pz, mxpz, dj,
  123. rq, wjh, kcsl, cjsj
  124. )
  125. values (#{dataid,jdbcType=CHAR}, #{unitid,jdbcType=CHAR}, #{periodid,jdbcType=CHAR},
  126. #{roundid,jdbcType=TINYINT}, #{modifydate,jdbcType=TIMESTAMP}, #{builder,jdbcType=CHAR},
  127. #{lkmc,jdbcType=VARCHAR}, #{lkbm,jdbcType=VARCHAR}, #{hwxz,jdbcType=CHAR}, #{ch,jdbcType=INTEGER},
  128. #{hwh,jdbcType=INTEGER}, #{pz,jdbcType=CHAR}, #{mxpz,jdbcType=CHAR}, #{dj,jdbcType=CHAR},
  129. #{rq,jdbcType=TIMESTAMP}, #{wjh,jdbcType=VARCHAR}, #{kcsl,jdbcType=DOUBLE}, #{cjsj,jdbcType=TIMESTAMP}
  130. )
  131. </insert>
  132. <insert id="insertSelective" parameterType="com.chinaitop.agile.model.DataKcglKcswDefault">
  133. insert into data_kcgl_kcsw_default
  134. <trim prefix="(" suffix=")" suffixOverrides=",">
  135. <if test="dataid != null">
  136. DataID,
  137. </if>
  138. <if test="unitid != null">
  139. UnitID,
  140. </if>
  141. <if test="periodid != null">
  142. PeriodID,
  143. </if>
  144. <if test="roundid != null">
  145. RoundID,
  146. </if>
  147. <if test="modifydate != null">
  148. ModifyDate,
  149. </if>
  150. <if test="builder != null">
  151. builder,
  152. </if>
  153. <if test="lkmc != null">
  154. lkmc,
  155. </if>
  156. <if test="lkbm != null">
  157. lkbm,
  158. </if>
  159. <if test="hwxz != null">
  160. hwxz,
  161. </if>
  162. <if test="ch != null">
  163. ch,
  164. </if>
  165. <if test="hwh != null">
  166. hwh,
  167. </if>
  168. <if test="pz != null">
  169. pz,
  170. </if>
  171. <if test="mxpz != null">
  172. mxpz,
  173. </if>
  174. <if test="dj != null">
  175. dj,
  176. </if>
  177. <if test="rq != null">
  178. rq,
  179. </if>
  180. <if test="wjh != null">
  181. wjh,
  182. </if>
  183. <if test="kcsl != null">
  184. kcsl,
  185. </if>
  186. <if test="cjsj != null">
  187. cjsj,
  188. </if>
  189. </trim>
  190. <trim prefix="values (" suffix=")" suffixOverrides=",">
  191. <if test="dataid != null">
  192. #{dataid,jdbcType=CHAR},
  193. </if>
  194. <if test="unitid != null">
  195. #{unitid,jdbcType=CHAR},
  196. </if>
  197. <if test="periodid != null">
  198. #{periodid,jdbcType=CHAR},
  199. </if>
  200. <if test="roundid != null">
  201. #{roundid,jdbcType=TINYINT},
  202. </if>
  203. <if test="modifydate != null">
  204. #{modifydate,jdbcType=TIMESTAMP},
  205. </if>
  206. <if test="builder != null">
  207. #{builder,jdbcType=CHAR},
  208. </if>
  209. <if test="lkmc != null">
  210. #{lkmc,jdbcType=VARCHAR},
  211. </if>
  212. <if test="lkbm != null">
  213. #{lkbm,jdbcType=VARCHAR},
  214. </if>
  215. <if test="hwxz != null">
  216. #{hwxz,jdbcType=CHAR},
  217. </if>
  218. <if test="ch != null">
  219. #{ch,jdbcType=INTEGER},
  220. </if>
  221. <if test="hwh != null">
  222. #{hwh,jdbcType=INTEGER},
  223. </if>
  224. <if test="pz != null">
  225. #{pz,jdbcType=CHAR},
  226. </if>
  227. <if test="mxpz != null">
  228. #{mxpz,jdbcType=CHAR},
  229. </if>
  230. <if test="dj != null">
  231. #{dj,jdbcType=CHAR},
  232. </if>
  233. <if test="rq != null">
  234. #{rq,jdbcType=TIMESTAMP},
  235. </if>
  236. <if test="wjh != null">
  237. #{wjh,jdbcType=VARCHAR},
  238. </if>
  239. <if test="kcsl != null">
  240. #{kcsl,jdbcType=DOUBLE},
  241. </if>
  242. <if test="cjsj != null">
  243. #{cjsj,jdbcType=TIMESTAMP},
  244. </if>
  245. </trim>
  246. </insert>
  247. <select id="countByExample" parameterType="com.chinaitop.agile.model.DataKcglKcswDefaultExample" resultType="java.lang.Integer">
  248. select count(*) from data_kcgl_kcsw_default
  249. <if test="_parameter != null">
  250. <include refid="Example_Where_Clause" />
  251. </if>
  252. </select>
  253. <update id="updateByExampleSelective" parameterType="map">
  254. update data_kcgl_kcsw_default
  255. <set>
  256. <if test="record.dataid != null">
  257. DataID = #{record.dataid,jdbcType=CHAR},
  258. </if>
  259. <if test="record.unitid != null">
  260. UnitID = #{record.unitid,jdbcType=CHAR},
  261. </if>
  262. <if test="record.periodid != null">
  263. PeriodID = #{record.periodid,jdbcType=CHAR},
  264. </if>
  265. <if test="record.roundid != null">
  266. RoundID = #{record.roundid,jdbcType=TINYINT},
  267. </if>
  268. <if test="record.modifydate != null">
  269. ModifyDate = #{record.modifydate,jdbcType=TIMESTAMP},
  270. </if>
  271. <if test="record.builder != null">
  272. builder = #{record.builder,jdbcType=CHAR},
  273. </if>
  274. <if test="record.lkmc != null">
  275. lkmc = #{record.lkmc,jdbcType=VARCHAR},
  276. </if>
  277. <if test="record.lkbm != null">
  278. lkbm = #{record.lkbm,jdbcType=VARCHAR},
  279. </if>
  280. <if test="record.hwxz != null">
  281. hwxz = #{record.hwxz,jdbcType=CHAR},
  282. </if>
  283. <if test="record.ch != null">
  284. ch = #{record.ch,jdbcType=INTEGER},
  285. </if>
  286. <if test="record.hwh != null">
  287. hwh = #{record.hwh,jdbcType=DOUBLE},
  288. </if>
  289. <if test="record.pz != null">
  290. pz = #{record.pz,jdbcType=CHAR},
  291. </if>
  292. <if test="record.mxpz != null">
  293. mxpz = #{record.mxpz,jdbcType=CHAR},
  294. </if>
  295. <if test="record.dj != null">
  296. dj = #{record.dj,jdbcType=CHAR},
  297. </if>
  298. <if test="record.rq != null">
  299. rq = #{record.rq,jdbcType=TIMESTAMP},
  300. </if>
  301. <if test="record.wjh != null">
  302. wjh = #{record.wjh,jdbcType=VARCHAR},
  303. </if>
  304. <if test="record.kcsl != null">
  305. kcsl = #{record.kcsl,jdbcType=DOUBLE},
  306. </if>
  307. <if test="record.cjsj != null">
  308. cjsj = #{record.cjsj,jdbcType=TIMESTAMP},
  309. </if>
  310. </set>
  311. <if test="_parameter != null">
  312. <include refid="Update_By_Example_Where_Clause" />
  313. </if>
  314. </update>
  315. <update id="updateByExample" parameterType="map">
  316. update data_kcgl_kcsw_default
  317. set DataID = #{record.dataid,jdbcType=CHAR},
  318. UnitID = #{record.unitid,jdbcType=CHAR},
  319. PeriodID = #{record.periodid,jdbcType=CHAR},
  320. RoundID = #{record.roundid,jdbcType=TINYINT},
  321. ModifyDate = #{record.modifydate,jdbcType=TIMESTAMP},
  322. builder = #{record.builder,jdbcType=CHAR},
  323. lkmc = #{record.lkmc,jdbcType=VARCHAR},
  324. lkbm = #{record.lkbm,jdbcType=VARCHAR},
  325. hwxz = #{record.hwxz,jdbcType=CHAR},
  326. ch = #{record.ch,jdbcType=INTEGER},
  327. hwh = #{record.hwh,jdbcType=DOUBLE},
  328. pz = #{record.pz,jdbcType=CHAR},
  329. mxpz = #{record.mxpz,jdbcType=CHAR},
  330. dj = #{record.dj,jdbcType=CHAR},
  331. rq = #{record.rq,jdbcType=TIMESTAMP},
  332. wjh = #{record.wjh,jdbcType=VARCHAR},
  333. kcsl = #{record.kcsl,jdbcType=DOUBLE},
  334. cjsj = #{record.cjsj,jdbcType=TIMESTAMP}
  335. <if test="_parameter != null">
  336. <include refid="Update_By_Example_Where_Clause" />
  337. </if>
  338. </update>
  339. <update id="updateByPrimaryKeySelective" parameterType="com.chinaitop.agile.model.DataKcglKcswDefault">
  340. update data_kcgl_kcsw_default
  341. <set>
  342. <if test="unitid != null">
  343. UnitID = #{unitid,jdbcType=CHAR},
  344. </if>
  345. <if test="periodid != null">
  346. PeriodID = #{periodid,jdbcType=CHAR},
  347. </if>
  348. <if test="roundid != null">
  349. RoundID = #{roundid,jdbcType=TINYINT},
  350. </if>
  351. <if test="modifydate != null">
  352. ModifyDate = #{modifydate,jdbcType=TIMESTAMP},
  353. </if>
  354. <if test="builder != null">
  355. builder = #{builder,jdbcType=CHAR},
  356. </if>
  357. <if test="lkmc != null">
  358. lkmc = #{lkmc,jdbcType=VARCHAR},
  359. </if>
  360. <if test="lkbm != null">
  361. lkbm = #{lkbm,jdbcType=VARCHAR},
  362. </if>
  363. <if test="hwxz != null">
  364. hwxz = #{hwxz,jdbcType=CHAR},
  365. </if>
  366. <if test="ch != null">
  367. ch = #{ch,jdbcType=INTEGER},
  368. </if>
  369. <if test="hwh != null">
  370. hwh = #{hwh,jdbcType=INTEGER},
  371. </if>
  372. <if test="pz != null">
  373. pz = #{pz,jdbcType=CHAR},
  374. </if>
  375. <if test="mxpz != null">
  376. mxpz = #{mxpz,jdbcType=CHAR},
  377. </if>
  378. <if test="dj != null">
  379. dj = #{dj,jdbcType=CHAR},
  380. </if>
  381. <if test="rq != null">
  382. rq = #{rq,jdbcType=TIMESTAMP},
  383. </if>
  384. <if test="wjh != null">
  385. wjh = #{wjh,jdbcType=VARCHAR},
  386. </if>
  387. <if test="kcsl != null">
  388. kcsl = #{kcsl,jdbcType=DOUBLE},
  389. </if>
  390. <if test="cjsj != null">
  391. cjsj = #{cjsj,jdbcType=TIMESTAMP},
  392. </if>
  393. </set>
  394. where DataID = #{dataid,jdbcType=CHAR}
  395. </update>
  396. <update id="updateByPrimaryKey" parameterType="com.chinaitop.agile.model.DataKcglKcswDefault">
  397. update data_kcgl_kcsw_default
  398. set UnitID = #{unitid,jdbcType=CHAR},
  399. PeriodID = #{periodid,jdbcType=CHAR},
  400. RoundID = #{roundid,jdbcType=TINYINT},
  401. ModifyDate = #{modifydate,jdbcType=TIMESTAMP},
  402. builder = #{builder,jdbcType=CHAR},
  403. lkmc = #{lkmc,jdbcType=VARCHAR},
  404. lkbm = #{lkbm,jdbcType=VARCHAR},
  405. hwxz = #{hwxz,jdbcType=CHAR},
  406. ch = #{ch,jdbcType=INTEGER},
  407. hwh = #{hwh,jdbcType=INTEGER},
  408. pz = #{pz,jdbcType=CHAR},
  409. mxpz = #{mxpz,jdbcType=CHAR},
  410. dj = #{dj,jdbcType=CHAR},
  411. rq = #{rq,jdbcType=TIMESTAMP},
  412. wjh = #{wjh,jdbcType=VARCHAR},
  413. kcsl = #{kcsl,jdbcType=DOUBLE},
  414. cjsj = #{cjsj,jdbcType=TIMESTAMP}
  415. where DataID = #{dataid,jdbcType=CHAR}
  416. </update>
  417. <select id="countByLspz" parameterType="java.util.Map" resultType="com.chinaitop.agile.model.DataKcswScedule">
  418. select pz ,rq ,ROUND(sum(kcsl/1000),2) sumCksl from data_kcgl_kcsw_default
  419. where UnitID=#{orgId}
  420. group by pz, rq HAVING year(rq) > year(TODAY) -5 order by rq
  421. </select>
  422. <select id="countByDj" parameterType="java.util.Map" resultType="com.chinaitop.agile.model.DataKcswScedule">
  423. select dj djmc ,ROUND(sum(kcsl/1000),4) sumCksl from data_kcgl_kcsw_default where UnitID=#{orgId}
  424. group by dj
  425. </select>
  426. <select id="countByBl" parameterType="java.util.Map" resultType="java.lang.String">
  427. select sum(kcsl) sumCksl from data_kcgl_kcsw_default where UnitID=#{orgId}
  428. </select>
  429. <!-- 分别查询油罐、粮仓、粮和油所有的储量 -->
  430. <select id="countByBlType" parameterType="java.util.Map" resultType="java.util.Map">
  431. select nvl(sum(a.kcsl), 0) kczl from data_kcgl_kcsw_default a
  432. right join depot:basic_storehouse b on b.storehouse_id=a.ch and b.datatype=0
  433. where a.unitid=#{orgId}
  434. union all
  435. select nvl(sum(a.kcsl), 0) kczl from data_kcgl_kcsw_default a
  436. right join depot:basic_storehouse b on b.storehouse_id=a.ch and b.datatype=1
  437. where a.unitid=#{orgId}
  438. union all
  439. select nvl(sum(a.kcsl), 0) kczl from data_kcgl_kcsw_default a
  440. where a.unitid=#{orgId}
  441. </select>
  442. <select id="queryLKNewData" parameterType="java.util.Map" resultMap="BaseResultMap">
  443. SELECT
  444. default1.*
  445. FROM
  446. data_kcgl_kcsw_default default1,
  447. (
  448. SELECT
  449. ch,
  450. MAX(ModifyDate) ModifyDate
  451. FROM
  452. data_kcgl_kcsw_default WHERE 1=1
  453. <if test="orgId != null">
  454. AND UnitID=#{orgId}
  455. </if>
  456. GROUP BY
  457. ch
  458. ) default2
  459. WHERE default1.ch = default2.ch
  460. AND default1.ModifyDate = default2.ModifyDate
  461. </select>
  462. <!-- 小麦两年、其他都是三年 -->
  463. <select id="getHouseOrWareList" parameterType="java.util.Map" resultType="com.chinaitop.agile.model.DataKcglKcswDefault">
  464. SELECT * FROM data_kcgl_kcsw_default
  465. WHERE
  466. (
  467. add_months(sysdate, -24) >=rq
  468. AND pz = "3164"
  469. AND UnitID = #{UnitID}
  470. )
  471. OR (
  472. add_months(sysdate, -36) >=rq
  473. AND pz != "3164"
  474. AND UnitID = #{UnitID}
  475. );
  476. </select>
  477. <select id="getMassageBych" parameterType="java.util.Map" resultType="com.chinaitop.agile.model.DataKcglKcswDefault">
  478. select <include refid="Base_Column_List" /> from data_kcgl_kcsw_default where ch=#{storehouseId} and hwh=#{warehouseId};
  479. </select>
  480. <select id="countByPz" resultType="java.util.Map">
  481. select b.EnumItemName as pz, a.kcsl kcsl
  482. from (select pz, unitid, sum(kcsl) kcsl from data_kcgl_kcsw_default group by pz,unitid) a
  483. left join enumitem b on b.EnumItemId = a.pz
  484. </select>
  485. <select id="countByXz" resultType="java.util.Map">
  486. select b.EnumItemName as xz, a.hwxz, a.kcsl as kcsl
  487. from (SELECT hwxz,unitid,SUM(kcsl) kcsl FROM lsreport_tj:data_kcgl_kcsw_default GROUP BY hwxz,unitid) a
  488. left join enumitem b on b.EnumItemId = a.hwxz;
  489. </select>
  490. <select id="countByYear" resultType="java.util.Map">
  491. select unitid,YEAR(rq) as year,sum(kcsl) as kcsl from data_kcgl_kcsw_default group by unitid,rq
  492. </select>
  493. <select id="countByCity" resultType="java.util.Map">
  494. select unitid,YEAR(rq) as year,sum(kcsl) as kcsl from data_kcgl_kcsw_default group by unitid,rq
  495. </select>
  496. <select id="getDateByChHwh" parameterType="java.util.Map" resultType="com.chinaitop.agile.model.DataKcglKcswDefault">
  497. select unitid,hwxz,ch,hwh,pz,mxpz,dj,kcsl,gb,rq from data_kcgl_kcsw_default where unitid = #{orgId} and ch = #{houseId} and hwh = #{wareHouseId}
  498. </select>
  499. <select id="getWheatList" parameterType="java.util.Map" resultType="java.util.Map">
  500. select datas.* from (
  501. SELECT
  502. a.cph as cphm, b.sjcfbh as cf, b.sjhwbh as hw, c.enumname as lspz, d.enumname scnf,
  503. b.cpzsj as rq, b.xzklhjz as rksl, e.enumname lsdj, sf.sf, rz.rz, zzzl.zzzl,
  504. kwz.kwz, wjzz.wjzz, yjzz.yjzz, bwslzl.bwslzl, csl.csl, bblzl.bblzl, hpl.hpl,
  505. cmbl.cmbl, psl.psl, syl.syl, sml.sml, szqw.szqw, ydzs.ydzs, substr(be.enumname,0,2) ccfs
  506. FROM (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  507. from data_crkyw_rmdj_default)t1 where t1.rn = 1) a
  508. inner JOIN data_crkyw_cpz_default b ON a.BizNo = b.BizNo
  509. LEFT JOIN depot:basic_enum c on a.lspz = c.enumid
  510. LEFT JOIN depot:basic_enum d on a.scnf = d.enumid
  511. left join (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  512. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx on jyxx.bizno = a.bizno
  513. LEFT JOIN depot:basic_enum e on jyxx.lsdj = e.enumid
  514. left join depot:basic_storehouse bs on bs.storehouse_id = b.sjchID
  515. left join depot:basic_enum be on be.enumid = bs.keeping_way
  516. left join(
  517. select jyxx.bizno,flt.jyz as sf
  518. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  519. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  520. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  521. where flt.zbxmc = '2783'
  522. <if test="orgId != null">
  523. and jyxx.unitid = #{orgId}
  524. </if>
  525. ) sf on sf.bizno = a.bizno
  526. left join(
  527. select jyxx.bizno,flt.jyz as rz
  528. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  529. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  530. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  531. where flt.zbxmc = '2785'
  532. <if test="orgId != null">
  533. and jyxx.unitid = #{orgId}
  534. </if>
  535. ) rz on rz.bizno = a.bizno
  536. left join(
  537. select jyxx.bizno,flt.jyz as zzzl
  538. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  539. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  540. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  541. where flt.zbxmc = '2784'
  542. <if test="orgId != null">
  543. and jyxx.unitid = #{orgId}
  544. </if>
  545. ) zzzl on zzzl.bizno = a.bizno
  546. left join(
  547. select jyxx.bizno,flt.jyz as kwz
  548. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  549. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  550. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  551. where flt.zbxmc = '402882e87318022e017318df7ea0003c'
  552. <if test="orgId != null">
  553. and jyxx.unitid = #{orgId}
  554. </if>
  555. ) kwz on kwz.bizno = a.bizno
  556. left join(
  557. select jyxx.bizno,flt.jyz as wjzz
  558. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  559. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  560. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  561. where flt.zbxmc = '402882e87318022e017318dfc5b3003e'
  562. <if test="orgId != null">
  563. and jyxx.unitid = #{orgId}
  564. </if>
  565. ) wjzz on wjzz.bizno = a.bizno
  566. left join(
  567. select jyxx.bizno,flt.jyz as yjzz
  568. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  569. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  570. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  571. where flt.zbxmc = '402882e87318022e017318e015d70041'
  572. <if test="orgId != null">
  573. and jyxx.unitid = #{orgId}
  574. </if>
  575. ) yjzz on yjzz.bizno = a.bizno
  576. left join(
  577. select jyxx.bizno,flt.jyz as bwslzl
  578. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  579. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  580. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  581. where flt.zbxmc = '2786'
  582. <if test="orgId != null">
  583. and jyxx.unitid=#{orgId}
  584. </if>
  585. ) bwslzl on bwslzl.bizno = a.bizno
  586. left join(
  587. select jyxx.bizno,flt.jyz as csl
  588. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  589. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  590. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  591. where flt.zbxmc = '402882e87318022e017318e405240048'
  592. <if test="orgId != null">
  593. and jyxx.unitid = #{orgId}
  594. </if>
  595. ) csl on csl.bizno = a.bizno
  596. left join(
  597. select jyxx.bizno,flt.jyz as bblzl
  598. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  599. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  600. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  601. where flt.zbxmc = '402882e87318022e017318e43b61004a'
  602. <if test="orgId != null">
  603. and jyxx.unitid = #{orgId}
  604. </if>
  605. ) bblzl on bblzl.bizno = a.bizno
  606. left join(
  607. select jyxx.bizno,flt.jyz as hpl
  608. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  609. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  610. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  611. where flt.zbxmc = '402882e87318022e017318e5dc530054'
  612. <if test="orgId != null">
  613. and jyxx.unitid = #{orgId}
  614. </if>
  615. ) hpl on hpl.bizno = a.bizno
  616. left join(
  617. select jyxx.bizno,flt.jyz as cmbl
  618. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  619. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  620. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  621. where flt.zbxmc = '402882e87318022e017318e6206e0056'
  622. <if test="orgId != null">
  623. and jyxx.unitid = #{orgId}
  624. </if>
  625. ) cmbl on cmbl.bizno = a.bizno
  626. left join(
  627. select jyxx.bizno,flt.jyz as psl
  628. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  629. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  630. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  631. where flt.zbxmc = '402882e87318022e017318e47009004c'
  632. <if test="orgId != null">
  633. and jyxx.unitid = #{orgId}
  634. </if>
  635. ) psl on psl.bizno = a.bizno
  636. left join(
  637. select jyxx.bizno,flt.jyz as syl
  638. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  639. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  640. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  641. where flt.zbxmc = '402882e87318022e017318e4a5c4004e'
  642. <if test="orgId != null">
  643. and jyxx.unitid = #{orgId}
  644. </if>
  645. ) syl on syl.bizno = a.bizno
  646. left join(
  647. select jyxx.bizno,flt.jyz as sml
  648. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  649. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  650. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  651. where flt.zbxmc = '402882e87318022e017318e4f9c00050'
  652. <if test="orgId != null">
  653. and jyxx.unitid = #{orgId}
  654. </if>
  655. ) sml on sml.bizno = a.bizno
  656. left join(
  657. select jyxx.bizno,flt.jyz as szqw
  658. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  659. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  660. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  661. where flt.zbxmc = '2788'
  662. <if test="orgId != null">
  663. and jyxx.unitid = #{orgId}
  664. </if>
  665. ) szqw on szqw.bizno = a.bizno
  666. left join(
  667. select jyxx.bizno,flt.jyz as ydzs
  668. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  669. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  670. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  671. where flt.zbxmc = '2787'
  672. <if test="orgId != null">
  673. and jyxx.unitid = #{orgId}
  674. </if>
  675. ) ydzs on ydzs.bizno = a.bizno
  676. WHERE nvl(a.BizNo,'-1') != '-1' and a.lspz = '3164'
  677. <if test="orgId != null">
  678. and jyxx.unitid = #{orgId}
  679. </if>
  680. <if test="houseId != null">
  681. and b.sjchID = #{houseId}
  682. </if>
  683. <if test="warehouseId != null">
  684. and b.sjhwID = #{warehouseId}
  685. </if>
  686. <if test="startDate != null">
  687. and to_char(b.cpzsj,'yyyy-mm-dd') >= #{startDate}
  688. </if>
  689. <if test="endDate != null">
  690. and #{endDate} >= to_char(b.cpzsj,'yyyy-mm-dd')
  691. </if>
  692. UNION ALL
  693. select wheat.clbh cphm,wheat.cfmc cf,wheat.hwmc hw,wheat.pzmc lspz,wheat.scnd scnf,
  694. wheat.rkrq rq,wheat.rksl*1000 rksl,wheat.dj lsdj,wheat.sf,wheat.rz,wheat.zzzl,
  695. wheat.zzkwz kwz,wheat.wjzz,wheat.yjzz,wheat.bwslzl,wheat.csl,wheat.bblzl,wheat.hpl,
  696. wheat.cmbl,wheat.psl,wheat.syl,wheat.sml,wheat.szqw,wheat.ydzs,wheat.ccfs
  697. from depot:record_wheat_info wheat
  698. left join depot:basic_storehouse storehouse on storehouse.org_id = wheat.org_id and storehouse.del_flag = 1
  699. and storehouse.library_type = 0 and storehouse.storehouse_name = wheat.cfmc
  700. left join depot:basic_warehouse warehouse on warehouse.org_id = wheat.org_id and warehouse.del_flag = 1
  701. and warehouse.library_type = 0 and warehouse.warehouse_name = wheat.hwmc
  702. WHERE 1=1
  703. <if test="orgId != null">
  704. and wheat.org_id = #{orgId}
  705. </if>
  706. <if test="houseId != null">
  707. and storehouse.storehouse_id = #{houseId}
  708. </if>
  709. <if test="warehouseId != null">
  710. and warehouse.warehouse_id = #{warehouseId}
  711. </if>
  712. <if test="startDate != null">
  713. and to_char(wheat.rkrq,'yyyy-mm-dd') >= #{startDate}
  714. </if>
  715. <if test="endDate != null">
  716. and #{endDate} >= to_char(wheat.rkrq,'yyyy-mm-dd')
  717. </if>
  718. ) datas
  719. order by datas.rq desc
  720. </select>
  721. <select id="getCornList" parameterType="java.util.Map" resultType="java.util.Map">
  722. select datas.* from (
  723. SELECT
  724. a.cph as cphm, b.sjcfbh as cf, b.sjhwbh as hw, c.enumname as lspz, d.enumname scnf,
  725. b.cpzsj as rq, b.xzklhjz as rksl, e.enumname lsdj, sf.sf, rz.rz, zzzl.zzzl,
  726. wjzz.wjzz, yjzz.yjzz, bwslzl.bwslzl, csl.csl, bbl.bbl, psl.psl, syl.syl, sml.sml,
  727. zrssl.zrssl, hgssl.hgssl, szqw.szqw, mbl.mbl, substr(be.enumname,0,2) ccfs
  728. FROM (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  729. from data_crkyw_rmdj_default)t1 where t1.rn = 1) a
  730. inner JOIN data_crkyw_cpz_default b ON a.BizNo = b.BizNo
  731. LEFT JOIN depot:basic_enum c on a.lspz = c.enumid
  732. LEFT JOIN depot:basic_enum d on a.scnf = d.enumid
  733. left join (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  734. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx on jyxx.bizno = a.bizno
  735. LEFT JOIN depot:basic_enum e on jyxx.lsdj = e.enumid
  736. left join depot:basic_storehouse bs on bs.storehouse_id = b.sjchID
  737. left join depot:basic_enum be on be.enumid = bs.keeping_way
  738. left join(
  739. select jyxx.bizno,flt.jyz as sf
  740. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  741. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  742. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  743. where flt.zbxmc = '2791'
  744. <if test="orgId != null">
  745. and jyxx.unitid = #{orgId}
  746. </if>
  747. ) sf on sf.bizno = a.bizno
  748. left join(
  749. select jyxx.bizno,flt.jyz as rz
  750. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  751. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  752. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  753. where flt.zbxmc = '2793'
  754. <if test="orgId != null">
  755. and jyxx.unitid = #{orgId}
  756. </if>
  757. ) rz on rz.bizno = a.bizno
  758. left join(
  759. select jyxx.bizno,flt.jyz as zzzl
  760. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  761. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  762. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  763. where flt.zbxmc = '2792'
  764. <if test="orgId != null">
  765. and jyxx.unitid = #{orgId}
  766. </if>
  767. ) zzzl on zzzl.bizno = a.bizno
  768. left join(
  769. select jyxx.bizno,flt.jyz as wjzz
  770. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  771. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  772. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  773. where flt.zbxmc = '402882e87318022e017318fec4120072'
  774. <if test="orgId != null">
  775. and jyxx.unitid = #{orgId}
  776. </if>
  777. ) wjzz on wjzz.bizno = a.bizno
  778. left join(
  779. select jyxx.bizno,flt.jyz as yjzz
  780. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  781. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  782. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  783. where flt.zbxmc = '402882e87318022e017318fe87940070'
  784. <if test="orgId != null">
  785. and jyxx.unitid = #{orgId}
  786. </if>
  787. ) yjzz on yjzz.bizno = a.bizno
  788. left join(
  789. select jyxx.bizno,flt.jyz as bwslzl
  790. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  791. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  792. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  793. where flt.zbxmc = '2794'
  794. <if test="orgId != null">
  795. and jyxx.unitid=#{orgId}
  796. </if>
  797. ) bwslzl on bwslzl.bizno = a.bizno
  798. left join(
  799. select jyxx.bizno,flt.jyz as csl
  800. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  801. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  802. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  803. where flt.zbxmc = '402882e87318022e01731900c5bf0077'
  804. <if test="orgId != null">
  805. and jyxx.unitid = #{orgId}
  806. </if>
  807. ) csl on csl.bizno = a.bizno
  808. left join(
  809. select jyxx.bizno,flt.jyz as bbl
  810. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  811. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  812. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  813. where flt.zbxmc = '402882e87318022e0173190106c50079'
  814. <if test="orgId != null">
  815. and jyxx.unitid = #{orgId}
  816. </if>
  817. ) bbl on bbl.bizno = a.bizno
  818. left join(
  819. select jyxx.bizno,flt.jyz as psl
  820. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  821. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  822. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  823. where flt.zbxmc = '402882e87318022e01731901394a007b'
  824. <if test="orgId != null">
  825. and jyxx.unitid = #{orgId}
  826. </if>
  827. ) psl on psl.bizno = a.bizno
  828. left join(
  829. select jyxx.bizno,flt.jyz as syl
  830. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  831. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  832. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  833. where flt.zbxmc = '402882e87318022e017319018066007d'
  834. <if test="orgId != null">
  835. and jyxx.unitid = #{orgId}
  836. </if>
  837. ) syl on syl.bizno = a.bizno
  838. left join(
  839. select jyxx.bizno,flt.jyz as sml
  840. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  841. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  842. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  843. where flt.zbxmc = '402882e87318022e017319020ca9007f'
  844. <if test="orgId != null">
  845. and jyxx.unitid = #{orgId}
  846. </if>
  847. ) sml on sml.bizno = a.bizno
  848. left join(
  849. select jyxx.bizno,flt.jyz as zrssl
  850. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  851. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  852. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  853. where flt.zbxmc = '402882e87318022e0173190334040083'
  854. <if test="orgId != null">
  855. and jyxx.unitid = #{orgId}
  856. </if>
  857. ) zrssl on zrssl.bizno = a.bizno
  858. left join(
  859. select jyxx.bizno,flt.jyz as hgssl
  860. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  861. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  862. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  863. where flt.zbxmc = '402882e87318022e0173190373aa0085'
  864. <if test="orgId != null">
  865. and jyxx.unitid = #{orgId}
  866. </if>
  867. ) hgssl on hgssl.bizno = a.bizno
  868. left join(
  869. select jyxx.bizno,flt.jyz as szqw
  870. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  871. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  872. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  873. where flt.zbxmc = '2796'
  874. <if test="orgId != null">
  875. and jyxx.unitid = #{orgId}
  876. </if>
  877. ) szqw on szqw.bizno = a.bizno
  878. left join(
  879. select jyxx.bizno,flt.jyz as mbl
  880. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  881. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  882. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  883. where flt.zbxmc = '2795'
  884. <if test="orgId != null">
  885. and jyxx.unitid = #{orgId}
  886. </if>
  887. ) mbl on mbl.bizno = a.bizno
  888. WHERE nvl(a.BizNo,'-1') != '-1' and a.lspz = '3165'
  889. <if test="orgId != null">
  890. and jyxx.unitid = #{orgId}
  891. </if>
  892. <if test="houseId != null">
  893. and b.sjchID = #{houseId}
  894. </if>
  895. <if test="warehouseId != null">
  896. and b.sjhwID = #{warehouseId}
  897. </if>
  898. <if test="startDate != null">
  899. and to_char(b.cpzsj,'yyyy-mm-dd') >= #{startDate}
  900. </if>
  901. <if test="endDate != null">
  902. and #{endDate} >= to_char(b.cpzsj,'yyyy-mm-dd')
  903. </if>
  904. UNION ALL
  905. select corn.clbh cphm,corn.cfmc cf,corn.hwmc hw,corn.pzmc lspz,corn.scnd scnf,
  906. corn.rkrq rq,corn.rksl*1000 rksl,corn.dj lsdj,corn.sf,corn.rz,corn.zzzl,
  907. corn.wjzz,corn.yjzz,corn.bwslzl,corn.csl,corn.bbl,corn.psl,corn.syl,corn.sml,
  908. corn.zrrssl zrssl,corn.hgrssl hgssl,corn.szqw,corn.mbl,corn.ccfs
  909. from depot:record_corn_info corn
  910. left join depot:basic_storehouse storehouse on storehouse.org_id = corn.org_id and storehouse.del_flag = 1
  911. and storehouse.library_type = 0 and storehouse.storehouse_name = corn.cfmc
  912. left join depot:basic_warehouse warehouse on warehouse.org_id = corn.org_id and warehouse.del_flag = 1
  913. and warehouse.library_type = 0 and warehouse.warehouse_name = corn.hwmc
  914. WHERE 1=1
  915. <if test="orgId != null">
  916. and corn.org_id = #{orgId}
  917. </if>
  918. <if test="houseId != null">
  919. and storehouse.storehouse_id = #{houseId}
  920. </if>
  921. <if test="warehouseId != null">
  922. and warehouse.warehouse_id = #{warehouseId}
  923. </if>
  924. <if test="startDate != null">
  925. and to_char(corn.rkrq,'yyyy-mm-dd') >= #{startDate}
  926. </if>
  927. <if test="endDate != null">
  928. and #{endDate} >= to_char(corn.rkrq,'yyyy-mm-dd')
  929. </if>
  930. ) datas
  931. order by datas.rq desc
  932. </select>
  933. <select id="getSoybeanList" parameterType="java.util.Map" resultType="java.util.Map">
  934. select datas.* from (
  935. SELECT
  936. a.cph as cphm, b.sjcfbh as cf, b.sjhwbh as hw, c.enumname as lspz, d.enumname scnf,
  937. b.cpzsj as rq, b.xzklhjz as rksl, e.enumname lsdj, sf.sf, wzll.wzll, wsll.wsll,
  938. psl.psl, zzzl.zzzl, wjzz.wjzz, yjzz.yjzz, sslzl.sslzl, rssl.rssl,csl.csl, bbl.bbl,syl.syl, sml.sml,
  939. dsl.dsl, czfhl.czfhl, szqw.szqw, substr(be.enumname,0,2) ccfs
  940. FROM (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  941. from data_crkyw_rmdj_default)t1 where t1.rn = 1) a
  942. inner JOIN data_crkyw_cpz_default b ON a.BizNo = b.BizNo
  943. LEFT JOIN depot:basic_enum c on a.lspz = c.enumid
  944. LEFT JOIN depot:basic_enum d on a.scnf = d.enumid
  945. left join (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  946. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx on jyxx.bizno = a.bizno
  947. LEFT JOIN depot:basic_enum e on jyxx.lsdj = e.enumid
  948. left join depot:basic_storehouse bs on bs.storehouse_id = b.sjchID
  949. left join depot:basic_enum be on be.enumid = bs.keeping_way
  950. left join(
  951. select jyxx.bizno,flt.jyz as sf
  952. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  953. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  954. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  955. where flt.zbxmc = '2809'
  956. <if test="orgId != null">
  957. and jyxx.unitid = #{orgId}
  958. </if>
  959. ) sf on sf.bizno = a.bizno
  960. left join(
  961. select jyxx.bizno,flt.jyz as wzll
  962. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  963. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  964. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  965. where flt.zbxmc = '2810'
  966. <if test="orgId != null">
  967. and jyxx.unitid = #{orgId}
  968. </if>
  969. ) wzll on wzll.bizno = a.bizno
  970. left join(
  971. select jyxx.bizno,flt.jyz as wsll
  972. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  973. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  974. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  975. where flt.zbxmc = '2811'
  976. <if test="orgId != null">
  977. and jyxx.unitid = #{orgId}
  978. </if>
  979. ) wsll on wsll.bizno = a.bizno
  980. left join(
  981. select jyxx.bizno,flt.jyz as psl
  982. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  983. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  984. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  985. where flt.zbxmc = '2812'
  986. <if test="orgId != null">
  987. and jyxx.unitid = #{orgId}
  988. </if>
  989. ) psl on psl.bizno = a.bizno
  990. left join(
  991. select jyxx.bizno,flt.jyz as zzzl
  992. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  993. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  994. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  995. where flt.zbxmc = '2813'
  996. <if test="orgId != null">
  997. and jyxx.unitid = #{orgId}
  998. </if>
  999. ) zzzl on zzzl.bizno = a.bizno
  1000. left join(
  1001. select jyxx.bizno,flt.jyz as wjzz
  1002. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  1003. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  1004. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  1005. where flt.zbxmc = '402882e87318022e01731918c9e50093'
  1006. <if test="orgId != null">
  1007. and jyxx.unitid=#{orgId}
  1008. </if>
  1009. ) wjzz on wjzz.bizno = a.bizno
  1010. left join(
  1011. select jyxx.bizno,flt.jyz as yjzz
  1012. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  1013. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  1014. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  1015. where flt.zbxmc = '402882e87318022e0173191895750091'
  1016. <if test="orgId != null">
  1017. and jyxx.unitid = #{orgId}
  1018. </if>
  1019. ) yjzz on yjzz.bizno = a.bizno
  1020. left join(
  1021. select jyxx.bizno,flt.jyz as sslzl
  1022. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  1023. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  1024. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  1025. where flt.zbxmc = '2814'
  1026. <if test="orgId != null">
  1027. and jyxx.unitid = #{orgId}
  1028. </if>
  1029. ) sslzl on sslzl.bizno = a.bizno
  1030. left join(
  1031. select jyxx.bizno,flt.jyz as rssl
  1032. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  1033. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  1034. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  1035. where flt.zbxmc = '402882e87318022e0173191c07a00097'
  1036. <if test="orgId != null">
  1037. and jyxx.unitid = #{orgId}
  1038. </if>
  1039. ) rssl on rssl.bizno = a.bizno
  1040. left join(
  1041. select jyxx.bizno,flt.jyz as csl
  1042. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  1043. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  1044. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  1045. where flt.zbxmc = '402882e87318022e0173191c3bcc0099'
  1046. <if test="orgId != null">
  1047. and jyxx.unitid = #{orgId}
  1048. </if>
  1049. ) csl on csl.bizno = a.bizno
  1050. left join(
  1051. select jyxx.bizno,flt.jyz as bbl
  1052. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  1053. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  1054. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  1055. where flt.zbxmc = '402882e87318022e0173191c8815009b'
  1056. <if test="orgId != null">
  1057. and jyxx.unitid = #{orgId}
  1058. </if>
  1059. ) bbl on bbl.bizno = a.bizno
  1060. left join(
  1061. select jyxx.bizno,flt.jyz as syl
  1062. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  1063. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  1064. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  1065. where flt.zbxmc = '402882e87318022e0173191cd4bd009d'
  1066. <if test="orgId != null">
  1067. and jyxx.unitid = #{orgId}
  1068. </if>
  1069. ) syl on syl.bizno = a.bizno
  1070. left join(
  1071. select jyxx.bizno,flt.jyz as sml
  1072. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  1073. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  1074. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  1075. where flt.zbxmc = '402882e87318022e0173191d34f2009f'
  1076. <if test="orgId != null">
  1077. and jyxx.unitid = #{orgId}
  1078. </if>
  1079. ) sml on sml.bizno = a.bizno
  1080. left join(
  1081. select jyxx.bizno,flt.jyz as dsl
  1082. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  1083. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  1084. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  1085. where flt.zbxmc = '402882e87318022e0173191d790800a1'
  1086. <if test="orgId != null">
  1087. and jyxx.unitid = #{orgId}
  1088. </if>
  1089. ) dsl on dsl.bizno = a.bizno
  1090. left join(
  1091. select jyxx.bizno,flt.jyz as czfhl
  1092. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  1093. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  1094. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  1095. where flt.zbxmc = '2765'
  1096. <if test="orgId != null">
  1097. and jyxx.unitid = #{orgId}
  1098. </if>
  1099. ) czfhl on czfhl.bizno = a.bizno
  1100. left join(
  1101. select jyxx.bizno,flt.jyz as szqw
  1102. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  1103. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  1104. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  1105. where flt.zbxmc = '2815'
  1106. <if test="orgId != null">
  1107. and jyxx.unitid = #{orgId}
  1108. </if>
  1109. ) szqw on szqw.bizno = a.bizno
  1110. WHERE nvl(a.BizNo,'-1') != '-1' and a.lspz = '2777'
  1111. <if test="orgId != null">
  1112. and jyxx.unitid = #{orgId}
  1113. </if>
  1114. <if test="houseId != null">
  1115. and b.sjchID = #{houseId}
  1116. </if>
  1117. <if test="warehouseId != null">
  1118. and b.sjhwID = #{warehouseId}
  1119. </if>
  1120. <if test="startDate != null">
  1121. and to_char(b.cpzsj,'yyyy-mm-dd') >= #{startDate}
  1122. </if>
  1123. <if test="endDate != null">
  1124. and #{endDate} >= to_char(b.cpzsj,'yyyy-mm-dd')
  1125. </if>
  1126. UNION ALL
  1127. select soybean.clbh cphm,soybean.cfmc cf,soybean.hwmc hw,soybean.pzmc lspz,soybean.scnd scnf,
  1128. soybean.rkrq rq,soybean.rksl*1000 rksl,soybean.dj lsdj,soybean.sf,soybean.wzll,soybean.wsll,
  1129. soybean.psl,soybean.zzzl,soybean.wjzz,soybean.yjzz,soybean.ssllzl sslzl,soybean.rssl,soybean.csl,soybean.bbl,
  1130. soybean.syzdl syl,soybean.sml,soybean.dsl,soybean.czfhl,soybean.szqw,soybean.ccfs
  1131. from depot:record_soybean_info soybean
  1132. left join depot:basic_storehouse storehouse on storehouse.org_id = soybean.org_id and storehouse.del_flag = 1
  1133. and storehouse.library_type = 0 and storehouse.storehouse_name = soybean.cfmc
  1134. left join depot:basic_warehouse warehouse on warehouse.org_id = soybean.org_id and warehouse.del_flag = 1
  1135. and warehouse.library_type = 0 and warehouse.warehouse_name = soybean.hwmc
  1136. WHERE 1=1
  1137. <if test="orgId != null">
  1138. and soybean.org_id = #{orgId}
  1139. </if>
  1140. <if test="houseId != null">
  1141. and storehouse.storehouse_id = #{houseId}
  1142. </if>
  1143. <if test="warehouseId != null">
  1144. and warehouse.warehouse_id = #{warehouseId}
  1145. </if>
  1146. <if test="startDate != null">
  1147. and to_char(soybean.rkrq,'yyyy-mm-dd') >= #{startDate}
  1148. </if>
  1149. <if test="endDate != null">
  1150. and #{endDate} >= to_char(soybean.rkrq,'yyyy-mm-dd')
  1151. </if>
  1152. ) datas
  1153. order by datas.rq desc
  1154. </select>
  1155. <select id="getRiceList" parameterType="java.util.Map" resultType="java.util.Map">
  1156. select datas.* from (
  1157. SELECT
  1158. a.cph as cphm, b.sjcfbh as cf, b.sjhwbh as hw, c.enumname as lspz, d.enumname scnf,
  1159. b.cpzsj as rq, b.xzklhjz as rksl, e.enumname lsdj, sf.sf, ccl.ccl, zjml.zjml, gwcm.gwcm,
  1160. hhl.hhl, zzzl.zzzl, wjzz.wjzz, yjzz.yjzz, bwslzl.bwslzl, wsl.wsl,csl.csl, bbl.bbl,syl.syl, sml.sml,
  1161. hlm.hlm, szqw.szqw, substr(be.enumname,0,2) ccfs
  1162. FROM (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  1163. from data_crkyw_rmdj_default)t1 where t1.rn = 1) a
  1164. inner JOIN data_crkyw_cpz_default b ON a.BizNo = b.BizNo
  1165. LEFT JOIN depot:basic_enum c on a.lspz = c.enumid
  1166. LEFT JOIN depot:basic_enum d on a.scnf = d.enumid
  1167. left join (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  1168. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx on jyxx.bizno = a.bizno
  1169. LEFT JOIN depot:basic_enum e on jyxx.lsdj = e.enumid
  1170. left join depot:basic_storehouse bs on bs.storehouse_id = b.sjchID
  1171. left join depot:basic_enum be on be.enumid = bs.keeping_way
  1172. left join(
  1173. select jyxx.bizno,flt.jyz as sf
  1174. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  1175. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  1176. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  1177. where flt.zbxmc = '2799'
  1178. <if test="orgId != null">
  1179. and jyxx.unitid = #{orgId}
  1180. </if>
  1181. ) sf on sf.bizno = a.bizno
  1182. left join(
  1183. select jyxx.bizno,flt.jyz as ccl
  1184. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  1185. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  1186. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  1187. where flt.zbxmc = '2800'
  1188. <if test="orgId != null">
  1189. and jyxx.unitid = #{orgId}
  1190. </if>
  1191. ) ccl on ccl.bizno = a.bizno
  1192. left join(
  1193. select jyxx.bizno,flt.jyz as zjml
  1194. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  1195. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  1196. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  1197. where flt.zbxmc = '2801'
  1198. <if test="orgId != null">
  1199. and jyxx.unitid = #{orgId}
  1200. </if>
  1201. ) zjml on zjml.bizno = a.bizno
  1202. left join(
  1203. select jyxx.bizno,flt.jyz as gwcm
  1204. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  1205. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  1206. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  1207. where flt.zbxmc = '2803'
  1208. <if test="orgId != null">
  1209. and jyxx.unitid = #{orgId}
  1210. </if>
  1211. ) gwcm on gwcm.bizno = a.bizno
  1212. left join(
  1213. select jyxx.bizno,flt.jyz as hhl
  1214. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  1215. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  1216. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  1217. where flt.zbxmc = '2804'
  1218. <if test="orgId != null">
  1219. and jyxx.unitid = #{orgId}
  1220. </if>
  1221. ) hhl on hhl.bizno = a.bizno
  1222. left join(
  1223. select jyxx.bizno,flt.jyz as zzzl
  1224. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  1225. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  1226. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  1227. where flt.zbxmc = '2802'
  1228. <if test="orgId != null">
  1229. and jyxx.unitid=#{orgId}
  1230. </if>
  1231. ) zzzl on zzzl.bizno = a.bizno
  1232. left join(
  1233. select jyxx.bizno,flt.jyz as wjzz
  1234. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  1235. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  1236. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  1237. where flt.zbxmc = '402882e87318022e0173192479b000a9'
  1238. <if test="orgId != null">
  1239. and jyxx.unitid = #{orgId}
  1240. </if>
  1241. ) wjzz on wjzz.bizno = a.bizno
  1242. left join(
  1243. select jyxx.bizno,flt.jyz as yjzz
  1244. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  1245. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  1246. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  1247. where flt.zbxmc = '402882e87318022e01731924403600a7'
  1248. <if test="orgId != null">
  1249. and jyxx.unitid = #{orgId}
  1250. </if>
  1251. ) yjzz on yjzz.bizno = a.bizno
  1252. left join(
  1253. select jyxx.bizno,flt.jyz as bwslzl
  1254. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  1255. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  1256. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  1257. where flt.zbxmc = '2805'
  1258. <if test="orgId != null">
  1259. and jyxx.unitid = #{orgId}
  1260. </if>
  1261. ) bwslzl on bwslzl.bizno = a.bizno
  1262. left join(
  1263. select jyxx.bizno,flt.jyz as wsl
  1264. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  1265. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  1266. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  1267. where flt.zbxmc = '402882e87318022e017319255ff300ad'
  1268. <if test="orgId != null">
  1269. and jyxx.unitid = #{orgId}
  1270. </if>
  1271. ) wsl on wsl.bizno = a.bizno
  1272. left join(
  1273. select jyxx.bizno,flt.jyz as csl
  1274. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  1275. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  1276. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  1277. where flt.zbxmc = '402882e87318022e017319259f3c00af'
  1278. <if test="orgId != null">
  1279. and jyxx.unitid = #{orgId}
  1280. </if>
  1281. ) csl on csl.bizno = a.bizno
  1282. left join(
  1283. select jyxx.bizno,flt.jyz as bbl
  1284. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  1285. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  1286. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  1287. where flt.zbxmc = '402882e87318022e01731925d38a00b1'
  1288. <if test="orgId != null">
  1289. and jyxx.unitid = #{orgId}
  1290. </if>
  1291. ) bbl on bbl.bizno = a.bizno
  1292. left join(
  1293. select jyxx.bizno,flt.jyz as syl
  1294. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  1295. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  1296. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  1297. where flt.zbxmc = '402882e87318022e0173192619ff00b3'
  1298. <if test="orgId != null">
  1299. and jyxx.unitid = #{orgId}
  1300. </if>
  1301. ) syl on syl.bizno = a.bizno
  1302. left join(
  1303. select jyxx.bizno,flt.jyz as sml
  1304. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  1305. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  1306. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  1307. where flt.zbxmc = '402882e87318022e01731926565600b5'
  1308. <if test="orgId != null">
  1309. and jyxx.unitid = #{orgId}
  1310. </if>
  1311. ) sml on sml.bizno = a.bizno
  1312. left join(
  1313. select jyxx.bizno,flt.jyz as hlm
  1314. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  1315. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  1316. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  1317. where flt.zbxmc = '2806'
  1318. <if test="orgId != null">
  1319. and jyxx.unitid = #{orgId}
  1320. </if>
  1321. ) hlm on hlm.bizno = a.bizno
  1322. left join(
  1323. select jyxx.bizno,flt.jyz as szqw
  1324. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  1325. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  1326. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  1327. where flt.zbxmc = '2807'
  1328. <if test="orgId != null">
  1329. and jyxx.unitid = #{orgId}
  1330. </if>
  1331. ) szqw on szqw.bizno = a.bizno
  1332. WHERE nvl(a.BizNo,'-1') != '-1' and a.lspz = '3166'
  1333. <if test="orgId != null">
  1334. and jyxx.unitid = #{orgId}
  1335. </if>
  1336. <if test="houseId != null">
  1337. and b.sjchID = #{houseId}
  1338. </if>
  1339. <if test="warehouseId != null">
  1340. and b.sjhwID = #{warehouseId}
  1341. </if>
  1342. <if test="startDate != null">
  1343. and to_char(b.cpzsj,'yyyy-mm-dd') >= #{startDate}
  1344. </if>
  1345. <if test="endDate != null">
  1346. and #{endDate} >= to_char(b.cpzsj,'yyyy-mm-dd')
  1347. </if>
  1348. UNION ALL
  1349. select rice.clbh cphm,rice.cfmc cf,rice.hwmc hw,rice.pzmc lspz,rice.scnd scnf,
  1350. rice.rkrq rq,rice.rksl*1000 rksl,rice.dj lsdj,rice.sf,rice.ccl,rice.zjml,
  1351. rice.gwcm,rice.hhl,rice.zzzl,rice.wjzz,rice.yjzz,rice.bwslzl,rice.wsl,rice.csl,rice.bbl,
  1352. rice.syl,rice.sml,rice.hlm,rice.szqw,rice.ccfs
  1353. from depot:record_rice_info rice
  1354. left join depot:basic_storehouse storehouse on storehouse.org_id = rice.org_id and storehouse.del_flag = 1
  1355. and storehouse.library_type = 0 and storehouse.storehouse_name = rice.cfmc
  1356. left join depot:basic_warehouse warehouse on warehouse.org_id = rice.org_id and warehouse.del_flag = 1
  1357. and warehouse.library_type = 0 and warehouse.warehouse_name = rice.hwmc
  1358. WHERE 1=1
  1359. <if test="orgId != null">
  1360. and rice.org_id = #{orgId}
  1361. </if>
  1362. <if test="houseId != null">
  1363. and storehouse.storehouse_id = #{houseId}
  1364. </if>
  1365. <if test="warehouseId != null">
  1366. and warehouse.warehouse_id = #{warehouseId}
  1367. </if>
  1368. <if test="startDate != null">
  1369. and to_char(rice.rkrq,'yyyy-mm-dd') >= #{startDate}
  1370. </if>
  1371. <if test="endDate != null">
  1372. and #{endDate} >= to_char(rice.rkrq,'yyyy-mm-dd')
  1373. </if>
  1374. ) datas
  1375. order by datas.rq desc
  1376. </select>
  1377. <select id="getCrudeOilList" parameterType="java.util.Map" resultType="java.util.Map">
  1378. select datas.* from (
  1379. SELECT
  1380. a.cph as cphm, b.sjcfbh as cf, c.enumname as lspz, d.enumname scnf,
  1381. b.cpzsj as rq, b.xzklhjz as rksl, qwzw.qwzw, sfhfw.sfhfw, brxzz.brxzz,
  1382. sj.sj, gyhz.gyhz, rjcll.rjcll, '罐装' ccfs
  1383. FROM (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  1384. from data_crkyw_rmdj_default)t1 where t1.rn = 1) a
  1385. inner JOIN data_crkyw_cpz_default b ON a.BizNo = b.BizNo
  1386. LEFT JOIN depot:basic_enum c on a.lspz = c.enumid
  1387. LEFT JOIN depot:basic_enum d on a.scnf = d.enumid
  1388. <!-- left join (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  1389. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx on jyxx.bizno = a.bizno -->
  1390. <!-- left join depot:basic_tank bs on bs.id = b.sjchID -->
  1391. left join(
  1392. select jyxx.bizno,flt.jyz as qwzw
  1393. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  1394. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  1395. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  1396. where flt.zbxmc = '402882e87321dc72017321f9314f000e'
  1397. <if test="orgId != null">
  1398. and jyxx.unitid = #{orgId}
  1399. </if>
  1400. ) qwzw on qwzw.bizno = a.bizno
  1401. left join(
  1402. select jyxx.bizno,flt.jyz as sfhfw
  1403. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  1404. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  1405. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  1406. where flt.zbxmc = 'c8baedcc732711eabc7300ff188bbfa4'
  1407. <if test="orgId != null">
  1408. and jyxx.unitid = #{orgId}
  1409. </if>
  1410. ) sfhfw on sfhfw.bizno = a.bizno
  1411. left join(
  1412. select jyxx.bizno,flt.jyz as brxzz
  1413. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  1414. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  1415. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  1416. where flt.zbxmc = 'c8bdddc4732711eabc7300ff188bbfa4'
  1417. <if test="orgId != null">
  1418. and jyxx.unitid = #{orgId}
  1419. </if>
  1420. ) brxzz on brxzz.bizno = a.bizno
  1421. left join(
  1422. select jyxx.bizno,flt.jyz as sj
  1423. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  1424. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  1425. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  1426. where flt.zbxmc = 'c8c0bbf7732711eabc7300ff188bbfa4'
  1427. <if test="orgId != null">
  1428. and jyxx.unitid = #{orgId}
  1429. </if>
  1430. ) sj on sj.bizno = a.bizno
  1431. left join(
  1432. select jyxx.bizno,flt.jyz as gyhz
  1433. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  1434. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  1435. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  1436. where flt.zbxmc = 'c8c3c8f4732711eabc7300ff188bbfa4'
  1437. <if test="orgId != null">
  1438. and jyxx.unitid = #{orgId}
  1439. </if>
  1440. ) gyhz on gyhz.bizno = a.bizno
  1441. left join(
  1442. select jyxx.bizno,flt.jyz as rjcll
  1443. from (select * from (select *,row_number() over(partition by BizNo order by 1) rn
  1444. from data_crkyw_jyxx_default)t1 where t1.rn = 1) jyxx
  1445. left join data_crkyw_jyxx_flt_001 flt on jyxx.DataID = flt.maindataid
  1446. where flt.zbxmc = 'c8c3c8f4732711eabc7300ff188bbfa5'
  1447. <if test="orgId != null">
  1448. and jyxx.unitid=#{orgId}
  1449. </if>
  1450. ) rjcll on rjcll.bizno = a.bizno
  1451. WHERE nvl(a.BizNo,'-1') != '-1' and a.lspz = '7052'
  1452. <if test="orgId != null">
  1453. and a.unitid = #{orgId}
  1454. </if>
  1455. <if test="tankId != null">
  1456. and b.sjchID = #{tankId}
  1457. </if>
  1458. <if test="startDate != null">
  1459. and to_char(b.cpzsj,'yyyy-mm-dd') >= #{startDate}
  1460. </if>
  1461. <if test="endDate != null">
  1462. and #{endDate} >= to_char(b.cpzsj,'yyyy-mm-dd')
  1463. </if>
  1464. UNION ALL
  1465. select crudeoil.clbh cphm,crudeoil.ygmc cf,crudeoil.pzmc lspz,crudeoil.scnd scnf,
  1466. crudeoil.rkrq rq,crudeoil.rksl*1000 rksl,crudeoil.qwzw,crudeoil.sfjhfwhl sfhfw,
  1467. crudeoil.brxzzhl brxzz,crudeoil.sj,crudeoil.gyhz,crudeoil.rjcll,crudeoil.ccfs
  1468. from depot:record_crudeoil_info crudeoil
  1469. left join depot:basic_tank tank on tank.org_id = crudeoil.org_id and tank.del_flag = 1
  1470. and tank.storagetank_name = crudeoil.ygmc
  1471. WHERE 1=1
  1472. <if test="orgId != null">
  1473. and crudeoil.org_id = #{orgId}
  1474. </if>
  1475. <if test="tankId != null">
  1476. and tank.id = #{tankId}
  1477. </if>
  1478. <if test="startDate != null">
  1479. and to_char(crudeoil.rkrq,'yyyy-mm-dd') >= #{startDate}
  1480. </if>
  1481. <if test="endDate != null">
  1482. and #{endDate} >= to_char(crudeoil.rkrq,'yyyy-mm-dd')
  1483. </if>
  1484. ) datas
  1485. order by datas.rq desc
  1486. </select>
  1487. <!-- 查询已验收数量 -->
  1488. <select id="queryYYSSL" parameterType="java.util.Map" resultType="java.util.Map">
  1489. select a.check_type_num checktype,a.rksl rksl,a.accept_date accept_date from depot:storage_grain_card a
  1490. left join depot:basic_enum b on b.enumname=a.scnd and b.parentid=1004
  1491. where 1=1
  1492. <if test="orgId != null">
  1493. and a.org_id = #{orgId}
  1494. </if>
  1495. <if test="ch != null">
  1496. and a.storehouse_id=#{ch}
  1497. </if>
  1498. <if test="hwh != null">
  1499. and a.warehouse_id=#{hwh}
  1500. </if>
  1501. <if test="scnd != null">
  1502. and b.enumid=#{scnd}
  1503. </if>
  1504. order by a.accept_date desc
  1505. </select>
  1506. <!-- 查询验收方式为入库验收的验收数量 -->
  1507. <select id="findNumManager" parameterType="java.util.Map" resultType="java.util.Map">
  1508. select nvl(sum(a.rksl), 0) rksl from depot:storage_grain_card a
  1509. left join depot:basic_enum b on b.enumname=a.scnd and b.parentid=1004
  1510. where a.check_type_num='0'
  1511. <if test="orgId != null">
  1512. and a.org_id = #{orgId}
  1513. </if>
  1514. <if test="ch != null">
  1515. and a.storehouse_id=#{ch}
  1516. </if>
  1517. <if test="hwh != null">
  1518. and a.warehouse_id=#{hwh}
  1519. </if>
  1520. <if test="scnd != null">
  1521. and b.enumid=#{scnd}
  1522. </if>
  1523. </select>
  1524. <select id="findListOrRcsj" parameterType="java.util.Map" resultMap="BaseResultMap">
  1525. SELECT
  1526. T1.DataID, T1.UnitID, T1.PeriodID, T1.RoundID, T1.ModifyDate, T1.builder, T1.lkmc, T1.lkbm, T1.hwxz,
  1527. T1.ch, T1.hwh, T1.pz, T1.mxpz, T1.dj, T1.rq, T1.wjh, T1.kcsl, T1.gb,
  1528. REPLACE (T1.cjsj, T1.cjsj, T2.cjsj) cjsj,DECODE(T2.scnf,'','0',T2.scnf) scnf
  1529. FROM
  1530. data_kcgl_kcsw_default T1
  1531. LEFT JOIN data_kcgl_fcbgz_default T2 ON T1.ch = T2.ch and T1.UnitID = T2.UnitID and T1.hwh=T1.hwh
  1532. <where>
  1533. <if test="unitid !=null">
  1534. and T1.unitid = #{unitid}
  1535. </if>
  1536. <if test="ch !=null">
  1537. and T1.ch = #{ch,jdbcType=VARCHAR}
  1538. </if>
  1539. <if test="hwh !=null">
  1540. and T1.hwh = #{hwh,jdbcType=VARCHAR}
  1541. </if>
  1542. AND T2.srsl>0
  1543. </where>
  1544. ORDER BY T2.rq desc
  1545. </select>
  1546. <select id="findCondition" resultType="java.util.Map" parameterType="java.util.Map">
  1547. select
  1548. row_number () over (PARTITION BY a.DataID ORDER BY 1) rn,
  1549. a.DataID id,
  1550. a.lkmc agent_depot_name,
  1551. a.pz lspz,
  1552. a.dj LEVEL,
  1553. a.hwxz nature,
  1554. a.kcsl inventory,
  1555. b.scnf harvest_year,
  1556. ware.warehouse_name,
  1557. store.storehouse_name,
  1558. '1' AS sjly
  1559. FROM
  1560. data_kcgl_kcsw_default a
  1561. LEFT JOIN data_kcgl_fcbgz_default b ON b.UnitID = a.UnitID AND b.ch = a.ch
  1562. AND b.hwh = a.hwh
  1563. LEFT JOIN depot:basic_storehouse store ON store.storehouse_id = a.ch
  1564. LEFT JOIN depot:basic_warehouse ware ON ware.warehouse_id = a.hwh
  1565. WHERE 1=1
  1566. <if test="orgId != null">
  1567. AND a.UnitID = #{orgId}
  1568. </if>
  1569. <if test="houseId != null">
  1570. AND a.ch = #{houseId,jdbcType=VARCHAR}
  1571. </if>
  1572. <if test="wareId != null">
  1573. AND a.hwh = #{wareId}
  1574. </if>
  1575. order by a.rq DESC
  1576. limit 200
  1577. </select>
  1578. </mapper>