|  |  |  | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | <!--@Table pr_flowmeter--> | 
|---|
|  |  |  | <id column="id" jdbcType="BIGINT" property="id" /> | 
|---|
|  |  |  | <result column="monitoringId" jdbcType="BIGINT" property="monitoringId" /> | 
|---|
|  |  |  | <result column="code" jdbcType="VARCHAR" property="code" /> | 
|---|
|  |  |  | <result column="protocol" jdbcType="VARCHAR" property="protocol" /> | 
|---|
|  |  |  | <result column="onlineState" jdbcType="TINYINT" property="onlinestate" /> | 
|---|
|  |  |  | <result column="reportTime" jdbcType="TIMESTAMP" property="reporttime" /> | 
|---|
|  |  |  | <result column="addWays" jdbcType="TINYINT" property="addways" /> | 
|---|
|  |  |  | <result column="onlineState" jdbcType="TINYINT" property="onlineState" /> | 
|---|
|  |  |  | <result column="reportTime" jdbcType="TIMESTAMP" property="reportTime" /> | 
|---|
|  |  |  | <result column="addWays" jdbcType="TINYINT" property="addWays" /> | 
|---|
|  |  |  | <result column="operator" jdbcType="BIGINT" property="operator" /> | 
|---|
|  |  |  | <result column="operateDt" jdbcType="TIMESTAMP" property="operatedt" /> | 
|---|
|  |  |  | <result column="operateDt" jdbcType="TIMESTAMP" property="operateDt" /> | 
|---|
|  |  |  | <result column="remarks" jdbcType="VARCHAR" property="remarks" /> | 
|---|
|  |  |  | <result column="deleted" jdbcType="TINYINT" property="deleted" /> | 
|---|
|  |  |  | </resultMap> | 
|---|
|  |  |  | <sql id="Base_Column_List"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | id, code, protocol, onlineState, reportTime, addWays, `operator`, operateDt, remarks, | 
|---|
|  |  |  | id, monitoringId, code, protocol, onlineState, reportTime, addWays, `operator`, operateDt, remarks, | 
|---|
|  |  |  | deleted | 
|---|
|  |  |  | </sql> | 
|---|
|  |  |  | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> | 
|---|
|  |  |  | 
|---|
|  |  |  | `operator`, operateDt, remarks, | 
|---|
|  |  |  | deleted) | 
|---|
|  |  |  | values (#{id,jdbcType=BIGINT}, #{code,jdbcType=VARCHAR}, #{protocol,jdbcType=VARCHAR}, | 
|---|
|  |  |  | #{onlinestate,jdbcType=TINYINT}, #{reporttime,jdbcType=TIMESTAMP}, #{addways,jdbcType=TINYINT}, | 
|---|
|  |  |  | #{operator,jdbcType=BIGINT}, #{operatedt,jdbcType=TIMESTAMP}, #{remarks,jdbcType=VARCHAR}, | 
|---|
|  |  |  | #{onlineState,jdbcType=TINYINT}, #{reportTime,jdbcType=TIMESTAMP}, #{addWays,jdbcType=TINYINT}, | 
|---|
|  |  |  | #{operator,jdbcType=BIGINT}, #{operateDt,jdbcType=TIMESTAMP}, #{remarks,jdbcType=VARCHAR}, | 
|---|
|  |  |  | #{deleted,jdbcType=TINYINT}) | 
|---|
|  |  |  | </insert> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | <if test="protocol != null"> | 
|---|
|  |  |  | protocol, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="onlinestate != null"> | 
|---|
|  |  |  | <if test="onlineState != null"> | 
|---|
|  |  |  | onlineState, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="reporttime != null"> | 
|---|
|  |  |  | <if test="reportTime != null"> | 
|---|
|  |  |  | reportTime, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="addways != null"> | 
|---|
|  |  |  | <if test="addWays != null"> | 
|---|
|  |  |  | addWays, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="operator != null"> | 
|---|
|  |  |  | `operator`, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="operatedt != null"> | 
|---|
|  |  |  | <if test="operateDt != null"> | 
|---|
|  |  |  | operateDt, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="remarks != null"> | 
|---|
|  |  |  | 
|---|
|  |  |  | <if test="protocol != null"> | 
|---|
|  |  |  | #{protocol,jdbcType=VARCHAR}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="onlinestate != null"> | 
|---|
|  |  |  | #{onlinestate,jdbcType=TINYINT}, | 
|---|
|  |  |  | <if test="onlineState != null"> | 
|---|
|  |  |  | #{onlineState,jdbcType=TINYINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="reporttime != null"> | 
|---|
|  |  |  | #{reporttime,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | <if test="reportTime != null"> | 
|---|
|  |  |  | #{reportTime,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="addways != null"> | 
|---|
|  |  |  | #{addways,jdbcType=TINYINT}, | 
|---|
|  |  |  | <if test="addWays != null"> | 
|---|
|  |  |  | #{addWays,jdbcType=TINYINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="operator != null"> | 
|---|
|  |  |  | #{operator,jdbcType=BIGINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="operatedt != null"> | 
|---|
|  |  |  | #{operatedt,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | <if test="operateDt != null"> | 
|---|
|  |  |  | #{operateDt,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="remarks != null"> | 
|---|
|  |  |  | #{remarks,jdbcType=VARCHAR}, | 
|---|
|  |  |  | 
|---|
|  |  |  | <if test="protocol != null"> | 
|---|
|  |  |  | protocol = #{protocol,jdbcType=VARCHAR}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="onlinestate != null"> | 
|---|
|  |  |  | onlineState = #{onlinestate,jdbcType=TINYINT}, | 
|---|
|  |  |  | <if test="onlineState != null"> | 
|---|
|  |  |  | onlineState = #{onlineState,jdbcType=TINYINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="reporttime != null"> | 
|---|
|  |  |  | reportTime = #{reporttime,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | <if test="reportTime != null"> | 
|---|
|  |  |  | reportTime = #{reportTime,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="addways != null"> | 
|---|
|  |  |  | addWays = #{addways,jdbcType=TINYINT}, | 
|---|
|  |  |  | <if test="addWays != null"> | 
|---|
|  |  |  | addWays = #{addWays,jdbcType=TINYINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="operator != null"> | 
|---|
|  |  |  | `operator` = #{operator,jdbcType=BIGINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="operatedt != null"> | 
|---|
|  |  |  | operateDt = #{operatedt,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | <if test="operateDt != null"> | 
|---|
|  |  |  | operateDt = #{operateDt,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="remarks != null"> | 
|---|
|  |  |  | remarks = #{remarks,jdbcType=VARCHAR}, | 
|---|
|  |  |  | 
|---|
|  |  |  | update pr_flowmeter | 
|---|
|  |  |  | set code = #{code,jdbcType=VARCHAR}, | 
|---|
|  |  |  | protocol = #{protocol,jdbcType=VARCHAR}, | 
|---|
|  |  |  | onlineState = #{onlinestate,jdbcType=TINYINT}, | 
|---|
|  |  |  | reportTime = #{reporttime,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | addWays = #{addways,jdbcType=TINYINT}, | 
|---|
|  |  |  | onlineState = #{onlineState,jdbcType=TINYINT}, | 
|---|
|  |  |  | reportTime = #{reportTime,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | addWays = #{addWays,jdbcType=TINYINT}, | 
|---|
|  |  |  | `operator` = #{operator,jdbcType=BIGINT}, | 
|---|
|  |  |  | operateDt = #{operatedt,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | operateDt = #{operateDt,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | remarks = #{remarks,jdbcType=VARCHAR}, | 
|---|
|  |  |  | deleted = #{deleted,jdbcType=TINYINT} | 
|---|
|  |  |  | where id = #{id,jdbcType=BIGINT} | 
|---|
|  |  |  | 
|---|
|  |  |  | SELECT COUNT(*) AS recordCountOfFlowmeter FROM pr_flowmeter WHERE deleted = 0 AND id = ${flowmeterId} | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!--根据流量计编号 或者 在线状态 获取未删除的流量计数量 --> | 
|---|
|  |  |  | <!--根据流量计编号 或者 在线状态 获取未删除的绑定的流量计数量 --> | 
|---|
|  |  |  | <select id="getRecordCountOfFlowMeterByOthers" resultType="_integer"> | 
|---|
|  |  |  | SELECT COUNT(*) AS recordCountOfFlowmeter FROM pr_flowmeter | 
|---|
|  |  |  | SELECT COUNT(*) AS recordCountOfFlowmeter | 
|---|
|  |  |  | from pr_flowmeter pfm | 
|---|
|  |  |  | Left join pr_flow_monitoring pfmt on pfmt.id = pfm.monitoringId | 
|---|
|  |  |  | <where> | 
|---|
|  |  |  | deleted = 0 AND | 
|---|
|  |  |  | <if test="code != null"> | 
|---|
|  |  |  | code = #{code,jdbcType=VARCHAR}, | 
|---|
|  |  |  | pfm.deleted = 0 AND pfmt.deleted = 0 | 
|---|
|  |  |  | <if test = "code != null and code !=''"> | 
|---|
|  |  |  | AND pfm.code like CONCAT('%',#{code},'%') | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="onlineState != null "> | 
|---|
|  |  |  | onlineState = #{onlineState,jdbcType=TINYINT} | 
|---|
|  |  |  | AND pfm.onlineState = #{onlineState} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </where> | 
|---|
|  |  |  | </where> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!--根据流量计编号 或者 在线状态 获取未删除的流量计记录 --> | 
|---|
|  |  |  | <!--根据流量计编号 或者 在线状态 获取未删除的绑定的流量计记录 --> | 
|---|
|  |  |  | <select id="getFlowMeters" resultType="com.dy.pipIrrGlobal.voPr.VoFlowMeter"> | 
|---|
|  |  |  | select (@i:=@i+1)                                           AS id, | 
|---|
|  |  |  | select CAST(pfm.id AS char)                                 AS id, | 
|---|
|  |  |  | pfm.code                                                  AS code, | 
|---|
|  |  |  | pfm.onlineState                                           AS onlineState, | 
|---|
|  |  |  | pfmt.`name`                                               AS `name`, | 
|---|
|  |  |  | pfm.operateDt                                             AS operateDt | 
|---|
|  |  |  | from pr_flowmeter pfm | 
|---|
|  |  |  | inner join pr_monitoring_flowmeter pmofl on pmofl.flowmeterId = pfm.id | 
|---|
|  |  |  | inner join pr_flow_monitoring pfmt on pfmt.id = pmofl.monitoringId, | 
|---|
|  |  |  | (SELECT @i:=0) AS itable | 
|---|
|  |  |  | Left join pr_flow_monitoring pfmt on pfmt.id = pfm.monitoringId | 
|---|
|  |  |  | <where> | 
|---|
|  |  |  | pfm.deleted = 0 AND pfmt.deleted = 0 AND pmofl.operateType = 1 | 
|---|
|  |  |  | <if test="code != null"> | 
|---|
|  |  |  | AND code = #{code,jdbcType=VARCHAR} | 
|---|
|  |  |  | pfm.deleted = 0 AND pfmt.deleted = 0 | 
|---|
|  |  |  | <if test = "code != null and code !=''"> | 
|---|
|  |  |  | AND pfm.code like CONCAT('%',#{code},'%') | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="onlineState != null "> | 
|---|
|  |  |  | AND onlineState = #{onlineState,jdbcType=TINYINT} | 
|---|
|  |  |  | AND pfm.onlineState = #{onlineState} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </where> | 
|---|
|  |  |  | ORDER BY pfm.operateDt DESC | 
|---|
|  |  |  | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="selectAll" resultMap="BaseResultMap"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | select | 
|---|
|  |  |  | <include refid="Base_Column_List"/> | 
|---|
|  |  |  | from pr_flowmeter pfm | 
|---|
|  |  |  | where deleted != 1 | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | <update id="flowmeterAddMonId"> | 
|---|
|  |  |  | update pr_flowmeter | 
|---|
|  |  |  | set monitoringId = #{monitoringId,jdbcType=BIGINT}, | 
|---|
|  |  |  | `operator` = #{operator,jdbcType=BIGINT}, | 
|---|
|  |  |  | operateDt = #{operateDt,jdbcType=TIMESTAMP} | 
|---|
|  |  |  | where id = #{id,jdbcType=BIGINT} | 
|---|
|  |  |  | </update> | 
|---|
|  |  |  | </mapper> | 
|---|