| | |
| | | |
| | | <!--获取指定时间段内开阀次数超过指定值的农户数量--> |
| | | <select id="getLargeOpenCountClientsCount" resultType="java.lang.Long"> |
| | | SELECT COUNT(*) |
| | | FROM se_client cli |
| | | inner join ( |
| | | SELECT client_id, COUNT(*) AS openCount |
| | | FROM rm_open_close_valve_history |
| | | <where> |
| | | <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != ''"> |
| | | op_dt BETWEEN #{timeStart} AND #{timeStop} |
| | | </if> |
| | | </where> |
| | | group by client_id |
| | | <if test="openCount != null and openCount > 0"> |
| | | having openCount > #{openCount} |
| | | </if> |
| | | ) as his on his.client_id = cli.id |
| | | </select> |
| | | <!-- 2025-07-29 下面SQL查询太慢,废弃 --> |
| | | <select id="_getLargeOpenCountClientsCount" resultType="java.lang.Long"> |
| | | SELECT COUNT(*) AS recordCount |
| | | FROM se_client cli |
| | | <where> |
| | |
| | | <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != ''"> |
| | | AND his.op_dt BETWEEN #{timeStart} AND #{timeStop} |
| | | </if> |
| | | ) > #{openCount} |
| | | ) > #{openCount} |
| | | </where> |
| | | </select> |
| | | |
| | | <!--获取指定时间段内开阀次数超过指定值的农户--> |
| | | <select id="getLargeOpenCountClients" resultType="com.dy.pipIrrGlobal.voSt.VoClient"> |
| | | SELECT cli.id AS clientId, |
| | | cli.name AS clientName, |
| | | cli.clientNum, |
| | | cli.address, |
| | | cli.phone, |
| | | cli.idCard, |
| | | his.openCount |
| | | FROM se_client cli |
| | | inner join ( |
| | | SELECT client_id, COUNT(*) AS openCount |
| | | FROM rm_open_close_valve_history |
| | | <where> |
| | | <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != ''"> |
| | | op_dt BETWEEN #{timeStart} AND #{timeStop} |
| | | </if> |
| | | </where> |
| | | group by client_id |
| | | <if test="openCount != null and openCount > 0"> |
| | | having openCount > #{openCount} |
| | | </if> |
| | | ) as his on his.client_id = cli.id |
| | | ORDER BY cli.id |
| | | <trim prefix="limit "> |
| | | <if test="start != null and count != null"> |
| | | #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} |
| | | </if> |
| | | </trim> |
| | | </select> |
| | | <!-- 2025-07-29 下面SQL查询太慢,废弃 --> |
| | | <select id="_getLargeOpenCountClients" resultType="com.dy.pipIrrGlobal.voSt.VoClient"> |
| | | SELECT cli.id AS clientId, |
| | | cli.name AS clientName, |
| | | cli.clientNum, |
| | |
| | | <if test="timeStart != null and timeStart != '' and timeStop != null"> |
| | | AND his.op_dt BETWEEN #{timeStart} AND #{timeStop} |
| | | </if> |
| | | ) > #{openCount} |
| | | ) > #{openCount} |
| | | </where> |
| | | ORDER BY cli.id |
| | | <trim prefix="limit "> |
| | |
| | | <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != ''"> |
| | | AND his.op_dt BETWEEN #{timeStart} AND #{timeStop} |
| | | </if> |
| | | ) < #{openCount} |
| | | </where> |
| | | </select> |
| | | <!-- 2025-07-29 下面SQL查询太慢,废弃 --> |
| | | <select id="_getSmallOpenCountClientsCount" resultType="java.lang.Long"> |
| | | SELECT COUNT(*) AS recordCount |
| | | FROM se_client cli |
| | | <where> |
| | | (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> |
| | |
| | | SELECT cli.id AS clientId, |
| | | cli.name AS clientName, |
| | | cli.clientNum, |
| | | cli.address, |
| | | cli.phone, |
| | | cli.idCard, |
| | | his.openCount |
| | | FROM se_client cli |
| | | inner join ( |
| | | SELECT client_id, COUNT(*) AS openCount |
| | | FROM rm_open_close_valve_history |
| | | <where> |
| | | <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != ''"> |
| | | op_dt BETWEEN #{timeStart} AND #{timeStop} |
| | | </if> |
| | | </where> |
| | | group by client_id |
| | | <if test="openCount != null and openCount > 0"> |
| | | having openCount < #{openCount} |
| | | </if> |
| | | ) as his on his.client_id = cli.id |
| | | ORDER BY cli.id |
| | | <trim prefix="limit "> |
| | | <if test="start != null and count != null"> |
| | | #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} |
| | | </if> |
| | | </trim> |
| | | </select> |
| | | <!-- 2025-07-29 下面SQL查询太慢,废弃 --> |
| | | <select id="_getSmallOpenCountClients" resultType="com.dy.pipIrrGlobal.voSt.VoClient"> |
| | | SELECT cli.id AS clientId, |
| | | cli.name AS clientName, |
| | | cli.clientNum, |
| | | CONCAT(cli.districtTitle, cli.address) AS address, |
| | | cli.phone, |
| | | cli.idCard, |