123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd" >
- <sqlMap namespace="sj_rcssj" >
- <resultMap id="ibatorgenerated_BaseResultMap" class="com.huimv.sj.dataobject.SjRcssj" >
- <!--
- WARNING - This element is automatically generated by Apache iBATIS ibator, do not modify.
- This element was generated on Thu Jun 19 15:59:45 CST 2014.
- -->
- <result column="ID" property="id" jdbcType="INTEGER" />
- <result column="LQID" property="lqid" jdbcType="INTEGER" />
- <result column="RZCSL" property="rzcsl" jdbcType="DECIMAL" />
- <result column="CSQ1CSL" property="csq1csl" jdbcType="DECIMAL" />
- <result column="CSQ2CSL" property="csq2csl" jdbcType="DECIMAL" />
- <result column="GLQCSL" property="glqcsl" jdbcType="DECIMAL" />
- <result column="TJSJ" property="tjsj" jdbcType="TIMESTAMP" />
- </resultMap>
- <sql id="ibatorgenerated_Example_Where_Clause" >
- <!--
- WARNING - This element is automatically generated by Apache iBATIS ibator, do not modify.
- This element was generated on Thu Jun 19 15:59:45 CST 2014.
- -->
- <iterate property="oredCriteria" conjunction="or" prepend="where" removeFirstPrepend="iterate" >
- <isEqual property="oredCriteria[].valid" compareValue="true" >
- (
- <iterate prepend="and" property="oredCriteria[].criteriaWithoutValue" conjunction="and" >
- $oredCriteria[].criteriaWithoutValue[]$
- </iterate>
- <iterate prepend="and" property="oredCriteria[].criteriaWithSingleValue" conjunction="and" >
- $oredCriteria[].criteriaWithSingleValue[].condition$
- #oredCriteria[].criteriaWithSingleValue[].value#
- </iterate>
- <iterate prepend="and" property="oredCriteria[].criteriaWithListValue" conjunction="and" >
- $oredCriteria[].criteriaWithListValue[].condition$
- <iterate property="oredCriteria[].criteriaWithListValue[].values" open="(" close=")" conjunction="," >
- #oredCriteria[].criteriaWithListValue[].values[]#
- </iterate>
- </iterate>
- <iterate prepend="and" property="oredCriteria[].criteriaWithBetweenValue" conjunction="and" >
- $oredCriteria[].criteriaWithBetweenValue[].condition$
- #oredCriteria[].criteriaWithBetweenValue[].values[0]# and
- #oredCriteria[].criteriaWithBetweenValue[].values[1]#
- </iterate>
- )
- </isEqual>
- </iterate>
- </sql>
- <select id="ibatorgenerated_selectByExample" resultMap="ibatorgenerated_BaseResultMap" parameterClass="com.huimv.sj.dataobject.SjRcssjExample" >
- <!--
- WARNING - This element is automatically generated by Apache iBATIS ibator, do not modify.
- This element was generated on Thu Jun 19 15:59:45 CST 2014.
- -->
- select ID, LQID, RZCSL, CSQ1CSL, CSQ2CSL, GLQCSL, TJSJ
- from sj_rcssj
- <isParameterPresent >
- <include refid="sj_rcssj.ibatorgenerated_Example_Where_Clause" />
- <isNotNull property="orderByClause" >
- order by $orderByClause$
- </isNotNull>
- <isGreaterEqual property="start" compareValue="0" >
- limit $start$ , $limit$
- </isGreaterEqual>
- </isParameterPresent>
- </select>
- <select id="ibatorgenerated_selectByPrimaryKey" resultMap="ibatorgenerated_BaseResultMap" parameterClass="com.huimv.sj.dataobject.SjRcssj" >
- <!--
- WARNING - This element is automatically generated by Apache iBATIS ibator, do not modify.
- This element was generated on Thu Jun 19 15:59:45 CST 2014.
- -->
- select ID, LQID, RZCSL, CSQ1CSL, CSQ2CSL, GLQCSL, TJSJ
- from sj_rcssj
- where ID = #id:INTEGER#
- </select>
- <delete id="ibatorgenerated_deleteByPrimaryKey" parameterClass="com.huimv.sj.dataobject.SjRcssj" >
- <!--
- WARNING - This element is automatically generated by Apache iBATIS ibator, do not modify.
- This element was generated on Thu Jun 19 15:59:45 CST 2014.
- -->
- delete from sj_rcssj
- where ID = #id:INTEGER#
- </delete>
- <delete id="ibatorgenerated_deleteByExample" parameterClass="com.huimv.sj.dataobject.SjRcssjExample" >
- <!--
- WARNING - This element is automatically generated by Apache iBATIS ibator, do not modify.
- This element was generated on Thu Jun 19 15:59:45 CST 2014.
- -->
- delete from sj_rcssj
- <include refid="sj_rcssj.ibatorgenerated_Example_Where_Clause" />
- </delete>
- <insert id="ibatorgenerated_insert" parameterClass="com.huimv.sj.dataobject.SjRcssj" >
- <!--
- WARNING - This element is automatically generated by Apache iBATIS ibator, do not modify.
- This element was generated on Thu Jun 19 15:59:45 CST 2014.
- -->
- insert into sj_rcssj (ID, LQID, RZCSL, CSQ1CSL, CSQ2CSL, GLQCSL, TJSJ)
- values (#id:INTEGER#, #lqid:INTEGER#, #rzcsl:DECIMAL#, #csq1csl:DECIMAL#, #csq2csl:DECIMAL#,
- #glqcsl:DECIMAL#, #tjsj:TIMESTAMP#)
- </insert>
- <insert id="ibatorgenerated_insertSelective" parameterClass="com.huimv.sj.dataobject.SjRcssj" >
- <!--
- WARNING - This element is automatically generated by Apache iBATIS ibator, do not modify.
- This element was generated on Thu Jun 19 15:59:45 CST 2014.
- -->
- insert into sj_rcssj
- <dynamic prepend="(" >
- <isNotNull prepend="," property="id" >
- ID
- </isNotNull>
- <isNotNull prepend="," property="lqid" >
- LQID
- </isNotNull>
- <isNotNull prepend="," property="rzcsl" >
- RZCSL
- </isNotNull>
- <isNotNull prepend="," property="csq1csl" >
- CSQ1CSL
- </isNotNull>
- <isNotNull prepend="," property="csq2csl" >
- CSQ2CSL
- </isNotNull>
- <isNotNull prepend="," property="glqcsl" >
- GLQCSL
- </isNotNull>
- <isNotNull prepend="," property="tjsj" >
- TJSJ
- </isNotNull>
- )
- </dynamic>
- values
- <dynamic prepend="(" >
- <isNotNull prepend="," property="id" >
- #id:INTEGER#
- </isNotNull>
- <isNotNull prepend="," property="lqid" >
- #lqid:INTEGER#
- </isNotNull>
- <isNotNull prepend="," property="rzcsl" >
- #rzcsl:DECIMAL#
- </isNotNull>
- <isNotNull prepend="," property="csq1csl" >
- #csq1csl:DECIMAL#
- </isNotNull>
- <isNotNull prepend="," property="csq2csl" >
- #csq2csl:DECIMAL#
- </isNotNull>
- <isNotNull prepend="," property="glqcsl" >
- #glqcsl:DECIMAL#
- </isNotNull>
- <isNotNull prepend="," property="tjsj" >
- #tjsj:TIMESTAMP#
- </isNotNull>
- )
- </dynamic>
- </insert>
- <select id="ibatorgenerated_countByExample" parameterClass="com.huimv.sj.dataobject.SjRcssjExample" resultClass="java.lang.Integer" >
- <!--
- WARNING - This element is automatically generated by Apache iBATIS ibator, do not modify.
- This element was generated on Thu Jun 19 15:59:45 CST 2014.
- -->
- select count(*) from sj_rcssj
- <include refid="sj_rcssj.ibatorgenerated_Example_Where_Clause" />
- </select>
- <update id="ibatorgenerated_updateByExampleSelective" >
- <!--
- WARNING - This element is automatically generated by Apache iBATIS ibator, do not modify.
- This element was generated on Thu Jun 19 15:59:45 CST 2014.
- -->
- update sj_rcssj
- <dynamic prepend="set" >
- <isNotNull prepend="," property="record.id" >
- ID = #record.id:INTEGER#
- </isNotNull>
- <isNotNull prepend="," property="record.lqid" >
- LQID = #record.lqid:INTEGER#
- </isNotNull>
- <isNotNull prepend="," property="record.rzcsl" >
- RZCSL = #record.rzcsl:DECIMAL#
- </isNotNull>
- <isNotNull prepend="," property="record.csq1csl" >
- CSQ1CSL = #record.csq1csl:DECIMAL#
- </isNotNull>
- <isNotNull prepend="," property="record.csq2csl" >
- CSQ2CSL = #record.csq2csl:DECIMAL#
- </isNotNull>
- <isNotNull prepend="," property="record.glqcsl" >
- GLQCSL = #record.glqcsl:DECIMAL#
- </isNotNull>
- <isNotNull prepend="," property="record.tjsj" >
- TJSJ = #record.tjsj:TIMESTAMP#
- </isNotNull>
- </dynamic>
- <isParameterPresent >
- <include refid="sj_rcssj.ibatorgenerated_Example_Where_Clause" />
- </isParameterPresent>
- </update>
- <update id="ibatorgenerated_updateByExample" >
- <!--
- WARNING - This element is automatically generated by Apache iBATIS ibator, do not modify.
- This element was generated on Thu Jun 19 15:59:45 CST 2014.
- -->
- update sj_rcssj
- set ID = #record.id:INTEGER#,
- LQID = #record.lqid:INTEGER#,
- RZCSL = #record.rzcsl:DECIMAL#,
- CSQ1CSL = #record.csq1csl:DECIMAL#,
- CSQ2CSL = #record.csq2csl:DECIMAL#,
- GLQCSL = #record.glqcsl:DECIMAL#,
- TJSJ = #record.tjsj:TIMESTAMP#
- <isParameterPresent >
- <include refid="sj_rcssj.ibatorgenerated_Example_Where_Clause" />
- </isParameterPresent>
- </update>
- <update id="ibatorgenerated_updateByPrimaryKeySelective" parameterClass="com.huimv.sj.dataobject.SjRcssj" >
- <!--
- WARNING - This element is automatically generated by Apache iBATIS ibator, do not modify.
- This element was generated on Thu Jun 19 15:59:45 CST 2014.
- -->
- update sj_rcssj
- <dynamic prepend="set" >
- <isNotNull prepend="," property="lqid" >
- LQID = #lqid:INTEGER#
- </isNotNull>
- <isNotNull prepend="," property="rzcsl" >
- RZCSL = #rzcsl:DECIMAL#
- </isNotNull>
- <isNotNull prepend="," property="csq1csl" >
- CSQ1CSL = #csq1csl:DECIMAL#
- </isNotNull>
- <isNotNull prepend="," property="csq2csl" >
- CSQ2CSL = #csq2csl:DECIMAL#
- </isNotNull>
- <isNotNull prepend="," property="glqcsl" >
- GLQCSL = #glqcsl:DECIMAL#
- </isNotNull>
- <isNotNull prepend="," property="tjsj" >
- TJSJ = #tjsj:TIMESTAMP#
- </isNotNull>
- </dynamic>
- where ID = #id:INTEGER#
- </update>
- <update id="ibatorgenerated_updateByPrimaryKey" parameterClass="com.huimv.sj.dataobject.SjRcssj" >
- <!--
- WARNING - This element is automatically generated by Apache iBATIS ibator, do not modify.
- This element was generated on Thu Jun 19 15:59:45 CST 2014.
- -->
- update sj_rcssj
- set LQID = #lqid:INTEGER#,
- RZCSL = #rzcsl:DECIMAL#,
- CSQ1CSL = #csq1csl:DECIMAL#,
- CSQ2CSL = #csq2csl:DECIMAL#,
- GLQCSL = #glqcsl:DECIMAL#,
- TJSJ = #tjsj:TIMESTAMP#
- where ID = #id:INTEGER#
- </update>
- <!-- 日采食次数 -->
- <select id="tjt.cscs.by.yt" resultClass="com.huimv.busi.tjt.dto.TjtDTO">
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- </select>
- <select id="tjt.slxh.by.qc" resultClass="com.huimv.sj.dataobject.SjRcssj" parameterClass="com.huimv.sj.dataobject.SjRcssj">
- SELECT rzcsl, csq1csl, csq2csl, glqcsl, tjsj from sj_rcssj t WHERE LQID = #lqid:INTEGER# order by tjsj asc
- </select>
-
- <select id="select_rcssj_by_param" resultClass="com.huimv.sj.dataobject.SjRcssj" parameterClass="java.util.Map">
- <![CDATA[
- SELECT
- 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,
- CASE WHEN rc.rzcsl > t2.rzcsl THEN 1 WHEN rc.rzcsl < t2.rzcsl THEN 0 ELSE '' END y2rzcsl,
- CASE WHEN t.rzcsl > rc.rzcsl THEN 1 WHEN t.rzcsl < rc.rzcsl THEN 0 ELSE '' END y1rzcsl,
- CASE WHEN TIMESTAMPDIFF(DAY, lq.sjljssj, now()) > 0 THEN TIMESTAMPDIFF(DAY, lq.jlsj, lq.sjljssj) ELSE TIMESTAMPDIFF(DAY, lq.jlsj, now()) END rlts
- FROM
- da_zsda zs,
- da_lqda lq
- 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')
- 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
- 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
- left join (SELECT sum(rzcsl) tsum,lqid FROM sj_rcssj WHERE tjsj < now() GROUP BY lqid) rz ON rz.lqid = lq.id
- WHERE
- zs.DQLQ = lq.id AND lq.zfbz = 0 AND zs.zfbz = 0 AND zs.MCID = #mcid#
- ]]>
- <isNotNull prepend="and" property="zsbz" >
- zs.zsbz = #zsbz#
- </isNotNull>
- <isNotEmpty property="page">
- limit #page#,6
- </isNotEmpty>
- </select>
-
- <select id="select_count_rcssj_by_param" resultClass="java.lang.Integer" parameterClass="java.util.Map">
- <![CDATA[
- SELECT
- count(*)
- FROM
- da_zsda zs,
- da_lqda lq
- WHERE
- zs.DQLQ = lq.id AND lq.zfbz = 0 AND zs.zfbz = 0 AND zs.MCID = #mcid#]]>
- <isNotNull prepend="and" property="zsbz" >
- zs.zsbz = #zsbz#
- </isNotNull>
- </select>
-
- <select id="select_sum_rcssj_by_param" resultClass="java.lang.String" parameterClass="java.util.Map">
- SELECT sum(rzcsl) FROM sj_rcssj WHERE lqid=#lqid#
- </select>
-
- </sqlMap>
|