|  |  |  | 
|---|
|  |  |  | <result column="intake_id" jdbcType="BIGINT" property="intakeId"/> | 
|---|
|  |  |  | <result column="dt" jdbcType="DATE" property="dt"/> | 
|---|
|  |  |  | <result column="amount" jdbcType="DOUBLE" property="amount"/> | 
|---|
|  |  |  | <result column="money" jdbcType="DOUBLE" property="money" /> | 
|---|
|  |  |  | <result column="times" jdbcType="INTEGER" property="times" /> | 
|---|
|  |  |  | <result column="dt_last" jdbcType="TIMESTAMP" property="dtLast"/> | 
|---|
|  |  |  | <result column="rtu_addr_last" jdbcType="VARCHAR" property="rtuAddrLast"/> | 
|---|
|  |  |  | <result column="controller_id_last" jdbcType="BIGINT" property="controllerIdLast"/> | 
|---|
|  |  |  | 
|---|
|  |  |  | id, | 
|---|
|  |  |  | intake_id, | 
|---|
|  |  |  | dt, | 
|---|
|  |  |  | amount, | 
|---|
|  |  |  | amount, money, times, | 
|---|
|  |  |  | dt_last, | 
|---|
|  |  |  | rtu_addr_last, | 
|---|
|  |  |  | controller_id_last, | 
|---|
|  |  |  | 
|---|
|  |  |  | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoRm.RmIntakeAmountDay"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | insert into rm_intake_amount_day (id, intake_id, dt, | 
|---|
|  |  |  | amount, dt_last, | 
|---|
|  |  |  | amount, money, times, dt_last, | 
|---|
|  |  |  | rtu_addr_last, controller_id_last, total_amount_last, | 
|---|
|  |  |  | rtu_dt_last) | 
|---|
|  |  |  | values (#{id,jdbcType=BIGINT}, #{intakeId,jdbcType=BIGINT}, #{dt,jdbcType=DATE}, | 
|---|
|  |  |  | #{amount,jdbcType=DOUBLE}, #{dtLast,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | #{amount,jdbcType=DOUBLE}, #{money,jdbcType=DOUBLE}, #{times,jdbcType=INTEGER}, #{dtLast,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | #{rtuAddrLast,jdbcType=VARCHAR}, #{controllerIdLast,jdbcType=BIGINT}, #{totalAmountLast,jdbcType=FLOAT}, | 
|---|
|  |  |  | #{rtuDtLast,jdbcType=TIMESTAMP}) | 
|---|
|  |  |  | </insert> | 
|---|
|  |  |  | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="amount != null"> | 
|---|
|  |  |  | amount, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="money != null"> | 
|---|
|  |  |  | money, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="times != null"> | 
|---|
|  |  |  | times, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="dtLast != null"> | 
|---|
|  |  |  | dt_last, | 
|---|
|  |  |  | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="amount != null"> | 
|---|
|  |  |  | #{amount,jdbcType=DOUBLE}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="money != null"> | 
|---|
|  |  |  | #{money,jdbcType=DOUBLE}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="times != null"> | 
|---|
|  |  |  | #{times,jdbcType=INTEGER}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="dtLast != null"> | 
|---|
|  |  |  | #{dtLast,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | 
|---|
|  |  |  | <if test="amount != null"> | 
|---|
|  |  |  | amount = #{amount,jdbcType=DOUBLE}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="money != null"> | 
|---|
|  |  |  | money = #{money,jdbcType=DOUBLE}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="times != null"> | 
|---|
|  |  |  | times = #{times,jdbcType=INTEGER}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="dtLast != null"> | 
|---|
|  |  |  | dt_last = #{dtLast,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | 
|---|
|  |  |  | set intake_id          = #{intakeId,jdbcType=BIGINT}, | 
|---|
|  |  |  | dt                 = #{dt,jdbcType=DATE}, | 
|---|
|  |  |  | amount             = #{amount,jdbcType=DOUBLE}, | 
|---|
|  |  |  | money              = #{money,jdbcType=DOUBLE}, | 
|---|
|  |  |  | times              = #{times,jdbcType=INTEGER}, | 
|---|
|  |  |  | dt_last            = #{dtLast,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | rtu_addr_last      = #{rtuAddrLast,jdbcType=VARCHAR}, | 
|---|
|  |  |  | controller_id_last = #{controllerIdLast,jdbcType=BIGINT}, | 
|---|
|  |  |  | 
|---|
|  |  |  | pint.name                             as intakeName, | 
|---|
|  |  |  | riad.dt                               as dt, | 
|---|
|  |  |  | riad.amount                           as amount, | 
|---|
|  |  |  | riad.money                            as money, | 
|---|
|  |  |  | riad.times                            as times, | 
|---|
|  |  |  | riad.dt_last                          as dtLast, | 
|---|
|  |  |  | riad.rtu_addr_last                    as rtuAddrLast, | 
|---|
|  |  |  | CAST(riad.controller_id_last AS char) AS controllerIdLast, | 
|---|
|  |  |  | 
|---|
|  |  |  | ) as tb31 on tb31.intakeId = inta.intakeId | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!--指定时间段用水量超过指定值的取水口数量--> | 
|---|
|  |  |  | <select id="getUseWaterGtValueIntakesCount" resultType="java.lang.Long"> | 
|---|
|  |  |  | select | 
|---|
|  |  |  | count(*) | 
|---|
|  |  |  | from ( | 
|---|
|  |  |  | SELECT | 
|---|
|  |  |  | SUM(riad.amount) AS value | 
|---|
|  |  |  | FROM | 
|---|
|  |  |  | pr_intake inta | 
|---|
|  |  |  | INNER JOIN ba_block blo ON blo.id = inta.blockId | 
|---|
|  |  |  | INNER JOIN rm_intake_amount_day riad ON riad.intake_id = inta.id | 
|---|
|  |  |  | WHERE inta.deleted = 0 and riad.dt >= #{timeStart} AND riad.dt <= #{timeStop} | 
|---|
|  |  |  | GROUP BY inta.id | 
|---|
|  |  |  | HAVING value > #{value} | 
|---|
|  |  |  | ) c | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | <!--指定时间段用水量超过指定值的取水口--> | 
|---|
|  |  |  | <select id="getUseWaterGtValueIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoIntakeAccumulateAmount"> | 
|---|
|  |  |  | SELECT | 
|---|
|  |  |  | inta.id AS intakeId, | 
|---|
|  |  |  | inta.NAME AS intakeNum, | 
|---|
|  |  |  | inta.lng  AS lng, | 
|---|
|  |  |  | inta.lat  AS lat, | 
|---|
|  |  |  | blo.NAME AS blockName , | 
|---|
|  |  |  | SUM(riad.amount) AS value | 
|---|
|  |  |  | FROM | 
|---|
|  |  |  | pr_intake inta | 
|---|
|  |  |  | INNER JOIN ba_block blo ON blo.id = inta.blockId | 
|---|
|  |  |  | INNER JOIN rm_intake_amount_day riad ON riad.intake_id = inta.id | 
|---|
|  |  |  | WHERE inta.deleted = 0 and riad.dt >= #{timeStart} AND riad.dt <= #{timeStop} | 
|---|
|  |  |  | GROUP BY inta.id | 
|---|
|  |  |  | HAVING value > #{value} | 
|---|
|  |  |  | ORDER BY inta.id | 
|---|
|  |  |  | <trim prefix="limit " > | 
|---|
|  |  |  | <if test="start != null and count != null"> | 
|---|
|  |  |  | #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | <!--指定时间段内消费金额超过指定值的取水口的数量--> | 
|---|
|  |  |  | <select id="getExpenseGtValueIntakesCount" resultType="java.lang.Long"> | 
|---|
|  |  |  | select | 
|---|
|  |  |  | count(*) | 
|---|
|  |  |  | from ( | 
|---|
|  |  |  | SELECT | 
|---|
|  |  |  | SUM(riad.money) AS value | 
|---|
|  |  |  | FROM | 
|---|
|  |  |  | pr_intake inta | 
|---|
|  |  |  | INNER JOIN ba_block blo ON blo.id = inta.blockId | 
|---|
|  |  |  | INNER JOIN rm_intake_amount_day riad ON riad.intake_id = inta.id | 
|---|
|  |  |  | WHERE inta.deleted = 0 and riad.dt >= #{timeStart} AND riad.dt <= #{timeStop} | 
|---|
|  |  |  | GROUP BY inta.id | 
|---|
|  |  |  | HAVING value > #{value} | 
|---|
|  |  |  | ) c | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | <!--指定时间段内消费金额超过指定值的取水口--> | 
|---|
|  |  |  | <select id="getExpenseGtValueIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoIntakeAccumulateAmount"> | 
|---|
|  |  |  | SELECT | 
|---|
|  |  |  | inta.id AS intakeId, | 
|---|
|  |  |  | inta.NAME AS intakeNum, | 
|---|
|  |  |  | inta.lng  AS lng, | 
|---|
|  |  |  | inta.lat  AS lat, | 
|---|
|  |  |  | blo.NAME AS blockName , | 
|---|
|  |  |  | SUM(riad.money) AS value | 
|---|
|  |  |  | FROM | 
|---|
|  |  |  | pr_intake inta | 
|---|
|  |  |  | INNER JOIN ba_block blo ON blo.id = inta.blockId | 
|---|
|  |  |  | INNER JOIN rm_intake_amount_day riad ON riad.intake_id = inta.id | 
|---|
|  |  |  | WHERE inta.deleted = 0 and riad.dt >= #{timeStart} AND riad.dt <= #{timeStop} | 
|---|
|  |  |  | GROUP BY inta.id | 
|---|
|  |  |  | HAVING value > #{value} | 
|---|
|  |  |  | ORDER BY inta.id | 
|---|
|  |  |  | <trim prefix="limit " > | 
|---|
|  |  |  | <if test="start != null and count != null"> | 
|---|
|  |  |  | #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | <!--指定时间段内取水次数超过指定值的取水口的数量--> | 
|---|
|  |  |  | <select id="getUseWaterTimesGtValueIntakesCount" resultType="java.lang.Long"> | 
|---|
|  |  |  | select | 
|---|
|  |  |  | count(*) | 
|---|
|  |  |  | from ( | 
|---|
|  |  |  | SELECT | 
|---|
|  |  |  | SUM(riad.times) AS valueInt | 
|---|
|  |  |  | FROM | 
|---|
|  |  |  | pr_intake inta | 
|---|
|  |  |  | INNER JOIN ba_block blo ON blo.id = inta.blockId | 
|---|
|  |  |  | INNER JOIN rm_intake_amount_day riad ON riad.intake_id = inta.id | 
|---|
|  |  |  | WHERE inta.deleted = 0 and riad.dt >= #{timeStart} AND riad.dt <= #{timeStop} | 
|---|
|  |  |  | GROUP BY inta.id | 
|---|
|  |  |  | HAVING valueInt > #{value} | 
|---|
|  |  |  | ) c | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | <!--指定时间段内取水次数超过指定值的取水口--> | 
|---|
|  |  |  | <select id="getUseWaterTimesGtValueIntakes" resultType="com.dy.pipIrrGlobal.voSt.VoIntakeAccumulateAmount"> | 
|---|
|  |  |  | SELECT | 
|---|
|  |  |  | inta.id AS intakeId, | 
|---|
|  |  |  | inta.NAME AS intakeNum, | 
|---|
|  |  |  | inta.lng  AS lng, | 
|---|
|  |  |  | inta.lat  AS lat, | 
|---|
|  |  |  | blo.NAME AS blockName , | 
|---|
|  |  |  | SUM(riad.times) AS valueInt | 
|---|
|  |  |  | FROM | 
|---|
|  |  |  | pr_intake inta | 
|---|
|  |  |  | INNER JOIN ba_block blo ON blo.id = inta.blockId | 
|---|
|  |  |  | INNER JOIN rm_intake_amount_day riad ON riad.intake_id = inta.id | 
|---|
|  |  |  | WHERE inta.deleted = 0 and riad.dt >= #{timeStart} AND riad.dt <= #{timeStop} | 
|---|
|  |  |  | GROUP BY inta.id | 
|---|
|  |  |  | HAVING valueInt > #{value} | 
|---|
|  |  |  | ORDER BY inta.id | 
|---|
|  |  |  | <trim prefix="limit " > | 
|---|
|  |  |  | <if test="start != null and count != null"> | 
|---|
|  |  |  | #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | </mapper> | 
|---|