| | |
| | | SELECT COUNT(*) AS recordCount |
| | | FROM pr_intake inta |
| | | LEFT JOIN |
| | | (SELECT intake_id FROM rm_on_hour_report_history |
| | | (SELECT intake_id FROM rm_open_close_valve_history |
| | | <where> |
| | | <if test = "idStart != null"> |
| | | id <![CDATA[>=]]> #{idStart} |
| | |
| | | pct.rtuAddr AS rtuAddr |
| | | FROM pr_intake inta |
| | | LEFT JOIN |
| | | (SELECT intake_id FROM rm_on_hour_report_history |
| | | (SELECT intake_id FROM rm_open_close_valve_history |
| | | <where> |
| | | <if test = "idStart != null"> |
| | | id <![CDATA[>=]]> #{idStart} |
| | |
| | | inta.name AS intakeNum, |
| | | blo.name AS blockName |
| | | FROM pr_intake inta |
| | | LEFT JOIN (SELECT intake_id |
| | | INNER JOIN (SELECT intake_id |
| | | FROM rm_open_close_valve_history |
| | | WHERE id <![CDATA[>=]]> #{idStart} AND id <![CDATA[<=]]> #{idEnd} |
| | | ) his ON his.intake_id = inta.id |
| | |
| | | inta.lat AS lat, |
| | | blo.name AS blockName |
| | | FROM pr_intake inta |
| | | LEFT JOIN(SELECT intake_id |
| | | INNER JOIN(SELECT intake_id |
| | | FROM rm_open_close_valve_history |
| | | WHERE id <![CDATA[>=]]> #{idStart} AND id <![CDATA[<=]]> #{idEnd} |
| | | ) his ON his.intake_id = inta.id |
| | |
| | | inta.name AS intakeNum, |
| | | blo.name AS blockName |
| | | FROM pr_intake inta |
| | | LEFT JOIN (SELECT intake_id |
| | | INNER JOIN (SELECT intake_id |
| | | FROM rm_open_close_valve_history |
| | | WHERE id <![CDATA[>=]]> #{idStart} AND id <![CDATA[<=]]> #{idEnd} |
| | | ) his ON his.intake_id = inta.id |
| | |
| | | inta.lat AS lat, |
| | | blo.name AS blockName |
| | | FROM pr_intake inta |
| | | LEFT JOIN(SELECT intake_id |
| | | INNER JOIN(SELECT intake_id |
| | | FROM rm_open_close_valve_history |
| | | WHERE id <![CDATA[>=]]> #{idStart} AND id <![CDATA[<=]]> #{idEnd} |
| | | ) his ON his.intake_id = inta.id |
| | |
| | | SELECT COUNT(*) AS recordCount |
| | | FROM se_client cli |
| | | <where> |
| | | <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != '' and openCount != null"> |
| | | (SELECT COUNT(*) |
| | | FROM rm_open_close_valve_history his |
| | | WHERE his.client_id = cli.id |
| | | AND his.op_dt BETWEEN #{timeStart} AND #{timeStop}) > #{openCount} |
| | | (SELECT COUNT(*) |
| | | FROM rm_open_close_valve_history his |
| | | WHERE his.client_id = cli.id |
| | | <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != ''"> |
| | | AND his.op_dt BETWEEN #{timeStart} AND #{timeStop} |
| | | </if> |
| | | ) > #{openCount} |
| | | </where> |
| | | </select> |
| | | |
| | |
| | | <where> |
| | | his.client_id = cli.id |
| | | <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != ''"> |
| | | AND his.op_dt BETWEEN #{timeStart} AND #{timeStop} |
| | | AND his.op_dt BETWEEN #{timeStart} AND #{timeStop} |
| | | </if> |
| | | </where>) AS openCount |
| | | FROM se_client cli |
| | | <where> |
| | | <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != '' and openCount != null"> |
| | | (SELECT COUNT(*) |
| | | FROM rm_open_close_valve_history his |
| | | WHERE his.client_id = cli.id |
| | | AND his.op_dt BETWEEN #{timeStart} AND #{timeStop}) > #{openCount} |
| | | (SELECT COUNT(*) |
| | | FROM rm_open_close_valve_history his |
| | | WHERE his.client_id = cli.id |
| | | <if test="timeStart != null and timeStart != '' and timeStop != null"> |
| | | AND his.op_dt BETWEEN #{timeStart} AND #{timeStop} |
| | | </if> |
| | | ) > #{openCount} |
| | | </where> |
| | | ORDER BY cli.id |
| | | <trim prefix="limit "> |
| | |
| | | SELECT COUNT(*) AS recordCount |
| | | FROM se_client cli |
| | | <where> |
| | | <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != '' and openCount != null"> |
| | | (SELECT COUNT(*) |
| | | FROM rm_open_close_valve_history his |
| | | WHERE his.client_id = cli.id |
| | | AND his.op_dt BETWEEN #{timeStart} AND #{timeStop}) < #{openCount} |
| | | (SELECT COUNT(*) |
| | | FROM rm_open_close_valve_history his |
| | | WHERE his.client_id = cli.id |
| | | <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != ''"> |
| | | AND his.op_dt BETWEEN #{timeStart} AND #{timeStop} |
| | | </if> |
| | | <if test="openCount != null"> |
| | | ) < #{openCount} |
| | | </if> |
| | | </where> |
| | | </select> |
| | |
| | | </where>) AS openCount |
| | | FROM se_client cli |
| | | <where> |
| | | <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != '' and openCount != null"> |
| | | (SELECT COUNT(*) |
| | | FROM rm_open_close_valve_history his |
| | | WHERE his.client_id = cli.id |
| | | AND his.op_dt BETWEEN #{timeStart} AND #{timeStop}) < #{openCount} |
| | | (SELECT COUNT(*) |
| | | FROM rm_open_close_valve_history his |
| | | WHERE his.client_id = cli.id |
| | | <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != ''"> |
| | | AND his.op_dt BETWEEN #{timeStart} AND #{timeStop} |
| | | </if> |
| | | <if test="openCount != null"> |
| | | < #{openCount} |
| | | </if> |
| | | </where> |
| | | ORDER BY cli.id |
| | |
| | | count(ocvh.id) as times |
| | | from rm_open_close_valve_history ocvh |
| | | inner join se_client_card cc on CAST(cc.cardNum AS CHAR) = ocvh.cl_ic_card_no |
| | | where ocvh.cl_dt <![CDATA[>=]]> #{startDt, jdbcType=BIGINT} |
| | | and ocvh.cl_dt <![CDATA[<=]]> #{endDt, jdbcType=BIGINT} |
| | | where ocvh.cl_dt <![CDATA[>=]]> #{startDt, jdbcType=TIMESTAMP } |
| | | and ocvh.cl_dt <![CDATA[<=]]> #{endDt, jdbcType=TIMESTAMP} |
| | | group by ocvh.client_id, cc.id |
| | | </select> |
| | | <select id="statisticsByClient" resultType="com.dy.pipIrrGlobal.voSt.VoClientConsumeStatistics"> |
| | |
| | | sum(cl_this_time) as duration, |
| | | count(id) as times |
| | | from rm_open_close_valve_history |
| | | where cl_dt <![CDATA[>=]]> #{startDt, jdbcType=BIGINT} |
| | | and cl_dt <![CDATA[<=]]> #{endDt, jdbcType=BIGINT} |
| | | where cl_dt <![CDATA[>=]]> #{startDt, jdbcType=TIMESTAMP} |
| | | and cl_dt <![CDATA[<=]]> #{endDt, jdbcType=TIMESTAMP} |
| | | group by client_id |
| | | </select> |
| | | </mapper> |