sj_rcssj_SqlMap.xml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd" >
  3. <sqlMap namespace="sj_rcssj" >
  4. <resultMap id="ibatorgenerated_BaseResultMap" class="com.huimv.sj.dataobject.SjRcssj" >
  5. <!--
  6. WARNING - This element is automatically generated by Apache iBATIS ibator, do not modify.
  7. This element was generated on Thu Jun 19 15:59:45 CST 2014.
  8. -->
  9. <result column="ID" property="id" jdbcType="INTEGER" />
  10. <result column="LQID" property="lqid" jdbcType="INTEGER" />
  11. <result column="RZCSL" property="rzcsl" jdbcType="DECIMAL" />
  12. <result column="CSQ1CSL" property="csq1csl" jdbcType="DECIMAL" />
  13. <result column="CSQ2CSL" property="csq2csl" jdbcType="DECIMAL" />
  14. <result column="GLQCSL" property="glqcsl" jdbcType="DECIMAL" />
  15. <result column="TJSJ" property="tjsj" jdbcType="TIMESTAMP" />
  16. </resultMap>
  17. <sql id="ibatorgenerated_Example_Where_Clause" >
  18. <!--
  19. WARNING - This element is automatically generated by Apache iBATIS ibator, do not modify.
  20. This element was generated on Thu Jun 19 15:59:45 CST 2014.
  21. -->
  22. <iterate property="oredCriteria" conjunction="or" prepend="where" removeFirstPrepend="iterate" >
  23. <isEqual property="oredCriteria[].valid" compareValue="true" >
  24. (
  25. <iterate prepend="and" property="oredCriteria[].criteriaWithoutValue" conjunction="and" >
  26. $oredCriteria[].criteriaWithoutValue[]$
  27. </iterate>
  28. <iterate prepend="and" property="oredCriteria[].criteriaWithSingleValue" conjunction="and" >
  29. $oredCriteria[].criteriaWithSingleValue[].condition$
  30. #oredCriteria[].criteriaWithSingleValue[].value#
  31. </iterate>
  32. <iterate prepend="and" property="oredCriteria[].criteriaWithListValue" conjunction="and" >
  33. $oredCriteria[].criteriaWithListValue[].condition$
  34. <iterate property="oredCriteria[].criteriaWithListValue[].values" open="(" close=")" conjunction="," >
  35. #oredCriteria[].criteriaWithListValue[].values[]#
  36. </iterate>
  37. </iterate>
  38. <iterate prepend="and" property="oredCriteria[].criteriaWithBetweenValue" conjunction="and" >
  39. $oredCriteria[].criteriaWithBetweenValue[].condition$
  40. #oredCriteria[].criteriaWithBetweenValue[].values[0]# and
  41. #oredCriteria[].criteriaWithBetweenValue[].values[1]#
  42. </iterate>
  43. )
  44. </isEqual>
  45. </iterate>
  46. </sql>
  47. <select id="ibatorgenerated_selectByExample" resultMap="ibatorgenerated_BaseResultMap" parameterClass="com.huimv.sj.dataobject.SjRcssjExample" >
  48. <!--
  49. WARNING - This element is automatically generated by Apache iBATIS ibator, do not modify.
  50. This element was generated on Thu Jun 19 15:59:45 CST 2014.
  51. -->
  52. select ID, LQID, RZCSL, CSQ1CSL, CSQ2CSL, GLQCSL, TJSJ
  53. from sj_rcssj
  54. <isParameterPresent >
  55. <include refid="sj_rcssj.ibatorgenerated_Example_Where_Clause" />
  56. <isNotNull property="orderByClause" >
  57. order by $orderByClause$
  58. </isNotNull>
  59. <isGreaterEqual property="start" compareValue="0" >
  60. limit $start$ , $limit$
  61. </isGreaterEqual>
  62. </isParameterPresent>
  63. </select>
  64. <select id="ibatorgenerated_selectByPrimaryKey" resultMap="ibatorgenerated_BaseResultMap" parameterClass="com.huimv.sj.dataobject.SjRcssj" >
  65. <!--
  66. WARNING - This element is automatically generated by Apache iBATIS ibator, do not modify.
  67. This element was generated on Thu Jun 19 15:59:45 CST 2014.
  68. -->
  69. select ID, LQID, RZCSL, CSQ1CSL, CSQ2CSL, GLQCSL, TJSJ
  70. from sj_rcssj
  71. where ID = #id:INTEGER#
  72. </select>
  73. <delete id="ibatorgenerated_deleteByPrimaryKey" parameterClass="com.huimv.sj.dataobject.SjRcssj" >
  74. <!--
  75. WARNING - This element is automatically generated by Apache iBATIS ibator, do not modify.
  76. This element was generated on Thu Jun 19 15:59:45 CST 2014.
  77. -->
  78. delete from sj_rcssj
  79. where ID = #id:INTEGER#
  80. </delete>
  81. <delete id="ibatorgenerated_deleteByExample" parameterClass="com.huimv.sj.dataobject.SjRcssjExample" >
  82. <!--
  83. WARNING - This element is automatically generated by Apache iBATIS ibator, do not modify.
  84. This element was generated on Thu Jun 19 15:59:45 CST 2014.
  85. -->
  86. delete from sj_rcssj
  87. <include refid="sj_rcssj.ibatorgenerated_Example_Where_Clause" />
  88. </delete>
  89. <insert id="ibatorgenerated_insert" parameterClass="com.huimv.sj.dataobject.SjRcssj" >
  90. <!--
  91. WARNING - This element is automatically generated by Apache iBATIS ibator, do not modify.
  92. This element was generated on Thu Jun 19 15:59:45 CST 2014.
  93. -->
  94. insert into sj_rcssj (ID, LQID, RZCSL, CSQ1CSL, CSQ2CSL, GLQCSL, TJSJ)
  95. values (#id:INTEGER#, #lqid:INTEGER#, #rzcsl:DECIMAL#, #csq1csl:DECIMAL#, #csq2csl:DECIMAL#,
  96. #glqcsl:DECIMAL#, #tjsj:TIMESTAMP#)
  97. </insert>
  98. <insert id="ibatorgenerated_insertSelective" parameterClass="com.huimv.sj.dataobject.SjRcssj" >
  99. <!--
  100. WARNING - This element is automatically generated by Apache iBATIS ibator, do not modify.
  101. This element was generated on Thu Jun 19 15:59:45 CST 2014.
  102. -->
  103. insert into sj_rcssj
  104. <dynamic prepend="(" >
  105. <isNotNull prepend="," property="id" >
  106. ID
  107. </isNotNull>
  108. <isNotNull prepend="," property="lqid" >
  109. LQID
  110. </isNotNull>
  111. <isNotNull prepend="," property="rzcsl" >
  112. RZCSL
  113. </isNotNull>
  114. <isNotNull prepend="," property="csq1csl" >
  115. CSQ1CSL
  116. </isNotNull>
  117. <isNotNull prepend="," property="csq2csl" >
  118. CSQ2CSL
  119. </isNotNull>
  120. <isNotNull prepend="," property="glqcsl" >
  121. GLQCSL
  122. </isNotNull>
  123. <isNotNull prepend="," property="tjsj" >
  124. TJSJ
  125. </isNotNull>
  126. )
  127. </dynamic>
  128. values
  129. <dynamic prepend="(" >
  130. <isNotNull prepend="," property="id" >
  131. #id:INTEGER#
  132. </isNotNull>
  133. <isNotNull prepend="," property="lqid" >
  134. #lqid:INTEGER#
  135. </isNotNull>
  136. <isNotNull prepend="," property="rzcsl" >
  137. #rzcsl:DECIMAL#
  138. </isNotNull>
  139. <isNotNull prepend="," property="csq1csl" >
  140. #csq1csl:DECIMAL#
  141. </isNotNull>
  142. <isNotNull prepend="," property="csq2csl" >
  143. #csq2csl:DECIMAL#
  144. </isNotNull>
  145. <isNotNull prepend="," property="glqcsl" >
  146. #glqcsl:DECIMAL#
  147. </isNotNull>
  148. <isNotNull prepend="," property="tjsj" >
  149. #tjsj:TIMESTAMP#
  150. </isNotNull>
  151. )
  152. </dynamic>
  153. </insert>
  154. <select id="ibatorgenerated_countByExample" parameterClass="com.huimv.sj.dataobject.SjRcssjExample" resultClass="java.lang.Integer" >
  155. <!--
  156. WARNING - This element is automatically generated by Apache iBATIS ibator, do not modify.
  157. This element was generated on Thu Jun 19 15:59:45 CST 2014.
  158. -->
  159. select count(*) from sj_rcssj
  160. <include refid="sj_rcssj.ibatorgenerated_Example_Where_Clause" />
  161. </select>
  162. <update id="ibatorgenerated_updateByExampleSelective" >
  163. <!--
  164. WARNING - This element is automatically generated by Apache iBATIS ibator, do not modify.
  165. This element was generated on Thu Jun 19 15:59:45 CST 2014.
  166. -->
  167. update sj_rcssj
  168. <dynamic prepend="set" >
  169. <isNotNull prepend="," property="record.id" >
  170. ID = #record.id:INTEGER#
  171. </isNotNull>
  172. <isNotNull prepend="," property="record.lqid" >
  173. LQID = #record.lqid:INTEGER#
  174. </isNotNull>
  175. <isNotNull prepend="," property="record.rzcsl" >
  176. RZCSL = #record.rzcsl:DECIMAL#
  177. </isNotNull>
  178. <isNotNull prepend="," property="record.csq1csl" >
  179. CSQ1CSL = #record.csq1csl:DECIMAL#
  180. </isNotNull>
  181. <isNotNull prepend="," property="record.csq2csl" >
  182. CSQ2CSL = #record.csq2csl:DECIMAL#
  183. </isNotNull>
  184. <isNotNull prepend="," property="record.glqcsl" >
  185. GLQCSL = #record.glqcsl:DECIMAL#
  186. </isNotNull>
  187. <isNotNull prepend="," property="record.tjsj" >
  188. TJSJ = #record.tjsj:TIMESTAMP#
  189. </isNotNull>
  190. </dynamic>
  191. <isParameterPresent >
  192. <include refid="sj_rcssj.ibatorgenerated_Example_Where_Clause" />
  193. </isParameterPresent>
  194. </update>
  195. <update id="ibatorgenerated_updateByExample" >
  196. <!--
  197. WARNING - This element is automatically generated by Apache iBATIS ibator, do not modify.
  198. This element was generated on Thu Jun 19 15:59:45 CST 2014.
  199. -->
  200. update sj_rcssj
  201. set ID = #record.id:INTEGER#,
  202. LQID = #record.lqid:INTEGER#,
  203. RZCSL = #record.rzcsl:DECIMAL#,
  204. CSQ1CSL = #record.csq1csl:DECIMAL#,
  205. CSQ2CSL = #record.csq2csl:DECIMAL#,
  206. GLQCSL = #record.glqcsl:DECIMAL#,
  207. TJSJ = #record.tjsj:TIMESTAMP#
  208. <isParameterPresent >
  209. <include refid="sj_rcssj.ibatorgenerated_Example_Where_Clause" />
  210. </isParameterPresent>
  211. </update>
  212. <update id="ibatorgenerated_updateByPrimaryKeySelective" parameterClass="com.huimv.sj.dataobject.SjRcssj" >
  213. <!--
  214. WARNING - This element is automatically generated by Apache iBATIS ibator, do not modify.
  215. This element was generated on Thu Jun 19 15:59:45 CST 2014.
  216. -->
  217. update sj_rcssj
  218. <dynamic prepend="set" >
  219. <isNotNull prepend="," property="lqid" >
  220. LQID = #lqid:INTEGER#
  221. </isNotNull>
  222. <isNotNull prepend="," property="rzcsl" >
  223. RZCSL = #rzcsl:DECIMAL#
  224. </isNotNull>
  225. <isNotNull prepend="," property="csq1csl" >
  226. CSQ1CSL = #csq1csl:DECIMAL#
  227. </isNotNull>
  228. <isNotNull prepend="," property="csq2csl" >
  229. CSQ2CSL = #csq2csl:DECIMAL#
  230. </isNotNull>
  231. <isNotNull prepend="," property="glqcsl" >
  232. GLQCSL = #glqcsl:DECIMAL#
  233. </isNotNull>
  234. <isNotNull prepend="," property="tjsj" >
  235. TJSJ = #tjsj:TIMESTAMP#
  236. </isNotNull>
  237. </dynamic>
  238. where ID = #id:INTEGER#
  239. </update>
  240. <update id="ibatorgenerated_updateByPrimaryKey" parameterClass="com.huimv.sj.dataobject.SjRcssj" >
  241. <!--
  242. WARNING - This element is automatically generated by Apache iBATIS ibator, do not modify.
  243. This element was generated on Thu Jun 19 15:59:45 CST 2014.
  244. -->
  245. update sj_rcssj
  246. set LQID = #lqid:INTEGER#,
  247. RZCSL = #rzcsl:DECIMAL#,
  248. CSQ1CSL = #csq1csl:DECIMAL#,
  249. CSQ2CSL = #csq2csl:DECIMAL#,
  250. GLQCSL = #glqcsl:DECIMAL#,
  251. TJSJ = #tjsj:TIMESTAMP#
  252. where ID = #id:INTEGER#
  253. </update>
  254. <!-- 日采食次数 -->
  255. <select id="tjt.cscs.by.yt" resultClass="com.huimv.busi.tjt.dto.TjtDTO">
  256. select '1日' as tjzl, count(*) tjjg from sj_rcssj where tjsj >= '2014-06-01 00:00:00' and '2014-06-01 23:59:59' > tjsj
  257. union select '2日' as tjzl, count(*) tjjg from sj_rcssj where tjsj >= '2014-06-02 00:00:00' and '2014-06-02 23:59:59' > tjsj
  258. union select '3日' as tjzl, count(*) tjjg from sj_rcssj where tjsj >= '2014-06-03 00:00:00' and '2014-06-03 23:59:59' > tjsj
  259. union select '4日' as tjzl, count(*) tjjg from sj_rcssj where tjsj >= '2014-06-04 00:00:00' and '2014-06-04 23:59:59' > tjsj
  260. union select '5日' as tjzl, count(*) tjjg from sj_rcssj where tjsj >= '2014-06-05 00:00:00' and '2014-06-05 23:59:59' > tjsj
  261. union select '6日' as tjzl, count(*) tjjg from sj_rcssj where tjsj >= '2014-06-06 00:00:00' and '2014-06-06 23:59:59' > tjsj
  262. union select '7日' as tjzl, count(*) tjjg from sj_rcssj where tjsj >= '2014-06-07 00:00:00' and '2014-06-07 23:59:59' > tjsj
  263. union select '8日' as tjzl, count(*) tjjg from sj_rcssj where tjsj >= '2014-06-08 00:00:00' and '2014-06-08 23:59:59' > tjsj
  264. union select '9日' as tjzl, count(*) tjjg from sj_rcssj where tjsj >= '2014-06-09 00:00:00' and '2014-06-09 23:59:59' > tjsj
  265. union select '10日' as tjzl, count(*) tjjg from sj_rcssj where tjsj >= '2014-06-10 00:00:00' and '2014-06-10 23:59:59' > tjsj
  266. union select '11日' as tjzl, count(*) tjjg from sj_rcssj where tjsj >= '2014-06-11 00:00:00' and '2014-06-11 23:59:59' > tjsj
  267. union select '12日' as tjzl, count(*) tjjg from sj_rcssj where tjsj >= '2014-06-12 00:00:00' and '2014-06-12 23:59:59' > tjsj
  268. union select '13日' as tjzl, count(*) tjjg from sj_rcssj where tjsj >= '2014-06-13 00:00:00' and '2014-06-13 23:59:59' > tjsj
  269. union select '14日' as tjzl, count(*) tjjg from sj_rcssj where tjsj >= '2014-06-14 00:00:00' and '2014-06-14 23:59:59' > tjsj
  270. union select '15日' as tjzl, count(*) tjjg from sj_rcssj where tjsj >= '2014-06-15 00:00:00' and '2014-06-15 23:59:59' > tjsj
  271. union select '16日' as tjzl, count(*) tjjg from sj_rcssj where tjsj >= '2014-06-16 00:00:00' and '2014-06-16 23:59:59' > tjsj
  272. union select '17日' as tjzl, count(*) tjjg from sj_rcssj where tjsj >= '2014-06-17 00:00:00' and '2014-06-17 23:59:59' > tjsj
  273. union select '18日' as tjzl, count(*) tjjg from sj_rcssj where tjsj >= '2014-06-18 00:00:00' and '2014-06-18 23:59:59' > tjsj
  274. union select '19日' as tjzl, count(*) tjjg from sj_rcssj where tjsj >= '2014-06-19 00:00:00' and '2014-06-19 23:59:59' > tjsj
  275. union select '20日' as tjzl, count(*) tjjg from sj_rcssj where tjsj >= '2014-06-20 00:00:00' and '2014-06-20 23:59:59' > tjsj
  276. union select '21日' as tjzl, count(*) tjjg from sj_rcssj where tjsj >= '2014-06-21 00:00:00' and '2014-06-21 23:59:59' > tjsj
  277. union select '22日' as tjzl, count(*) tjjg from sj_rcssj where tjsj >= '2014-06-22 00:00:00' and '2014-06-22 23:59:59' > tjsj
  278. union select '23日' as tjzl, count(*) tjjg from sj_rcssj where tjsj >= '2014-06-23 00:00:00' and '2014-06-23 23:59:59' > tjsj
  279. union select '24日' as tjzl, count(*) tjjg from sj_rcssj where tjsj >= '2014-06-24 00:00:00' and '2014-06-24 23:59:59' > tjsj
  280. union select '25日' as tjzl, count(*) tjjg from sj_rcssj where tjsj >= '2014-06-25 00:00:00' and '2014-06-25 23:59:59' > tjsj
  281. union select '26日' as tjzl, count(*) tjjg from sj_rcssj where tjsj >= '2014-06-26 00:00:00' and '2014-06-26 23:59:59' > tjsj
  282. union select '27日' as tjzl, count(*) tjjg from sj_rcssj where tjsj >= '2014-06-27 00:00:00' and '2014-06-27 23:59:59' > tjsj
  283. union select '28日' as tjzl, count(*) tjjg from sj_rcssj where tjsj >= '2014-06-28 00:00:00' and '2014-06-28 23:59:59' > tjsj
  284. union select '29日' as tjzl, count(*) tjjg from sj_rcssj where tjsj >= '2014-06-29 00:00:00' and '2014-06-29 23:59:59' > tjsj
  285. union select '30日' as tjzl, count(*) tjjg from sj_rcssj where tjsj >= '2014-06-30 00:00:00' and '2014-06-30 23:59:59' > tjsj
  286. union select '31日' as tjzl, count(*) tjjg from sj_rcssj where tjsj >= '2014-06-31 00:00:00' and '2014-06-31 23:59:59' > tjsj
  287. </select>
  288. <select id="tjt.slxh.by.qc" resultClass="com.huimv.sj.dataobject.SjRcssj" parameterClass="com.huimv.sj.dataobject.SjRcssj">
  289. SELECT rzcsl, csq1csl, csq2csl, glqcsl, tjsj from sj_rcssj t WHERE LQID = #lqid:INTEGER# order by tjsj asc
  290. </select>
  291. <select id="select_rcssj_by_param" resultClass="com.huimv.sj.dataobject.SjRcssj" parameterClass="java.util.Map">
  292. <![CDATA[
  293. SELECT
  294. rc.id,t.tjsj tjsj,lq.id lqid,rc.rzcsl yrzcsl,t.rzcsl rzcsl,lq.lqmc,zs.zsmc,zs.id zsid,zs.mcid,rz.tsum,
  295. CASE WHEN rc.rzcsl > t2.rzcsl THEN 1 WHEN rc.rzcsl < t2.rzcsl THEN 0 ELSE '' END y2rzcsl,
  296. CASE WHEN t.rzcsl > rc.rzcsl THEN 1 WHEN t.rzcsl < rc.rzcsl THEN 0 ELSE '' END y1rzcsl,
  297. CASE WHEN TIMESTAMPDIFF(DAY, lq.sjljssj, now()) > 0 THEN TIMESTAMPDIFF(DAY, lq.jlsj, lq.sjljssj) ELSE TIMESTAMPDIFF(DAY, lq.jlsj, now()) END rlts
  298. FROM
  299. da_zsda zs,
  300. da_lqda lq
  301. left join sj_rcssj rc on lq.id = rc.lqid AND DATE_FORMAT(rc.tjsj, '%Y-%m-%d') = DATE_FORMAT(DATE_ADD(#tjsj:TIMESTAMP#,INTERVAL -1 DAY),'%Y-%m-%d')
  302. left join sj_rcssj t ON DATE_FORMAT(t.tjsj, '%Y-%m-%d') = DATE_FORMAT(#tjsj:TIMESTAMP#,'%Y-%m-%d') AND t.lqid = lq.id
  303. left join sj_rcssj t2 ON DATE_FORMAT(t2.tjsj, '%Y-%m-%d') = DATE_FORMAT(DATE_ADD(#tjsj:TIMESTAMP#,INTERVAL -2 DAY),'%Y-%m-%d') AND t2.lqid = lq.id
  304. left join (SELECT sum(rzcsl) tsum,lqid FROM sj_rcssj WHERE tjsj < now() GROUP BY lqid) rz ON rz.lqid = lq.id
  305. WHERE
  306. zs.DQLQ = lq.id AND lq.zfbz = 0 AND zs.zfbz = 0 AND zs.MCID = #mcid#
  307. ]]>
  308. <isNotNull prepend="and" property="zsbz" >
  309. zs.zsbz = #zsbz#
  310. </isNotNull>
  311. <isNotEmpty property="page">
  312. limit #page#,6
  313. </isNotEmpty>
  314. </select>
  315. <select id="select_count_rcssj_by_param" resultClass="java.lang.Integer" parameterClass="java.util.Map">
  316. <![CDATA[
  317. SELECT
  318. count(*)
  319. FROM
  320. da_zsda zs,
  321. da_lqda lq
  322. WHERE
  323. zs.DQLQ = lq.id AND lq.zfbz = 0 AND zs.zfbz = 0 AND zs.MCID = #mcid#]]>
  324. <isNotNull prepend="and" property="zsbz" >
  325. zs.zsbz = #zsbz#
  326. </isNotNull>
  327. </select>
  328. <select id="select_sum_rcssj_by_param" resultClass="java.lang.String" parameterClass="java.util.Map">
  329. SELECT sum(rzcsl) FROM sj_rcssj WHERE lqid=#lqid#
  330. </select>
  331. </sqlMap>