|  |  |  | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | <!--@Table rm_work_report_history--> | 
|---|
|  |  |  | <id column="id" jdbcType="BIGINT" property="id" /> | 
|---|
|  |  |  | <result column="client_id" jdbcType="BIGINT" property="clientId" /> | 
|---|
|  |  |  | <result column="client_name" jdbcType="VARCHAR" property="clientName" /> | 
|---|
|  |  |  | <result column="controller_id" jdbcType="BIGINT" property="controllerId" /> | 
|---|
|  |  |  | <result column="intake_id" jdbcType="BIGINT" property="intakeId" /> | 
|---|
|  |  |  | <result column="rtu_addr" jdbcType="VARCHAR" property="rtuAddr" /> | 
|---|
|  |  |  | 
|---|
|  |  |  | </resultMap> | 
|---|
|  |  |  | <sql id="Base_Column_List"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | id, controller_id, intake_id, rtu_addr, dt, rtu_dt, order_no, ic_card_addr, ic_card_no, | 
|---|
|  |  |  | id, client_id, client_name, | 
|---|
|  |  |  | controller_id, intake_id, rtu_addr, dt, rtu_dt, order_no, ic_card_addr, ic_card_no, | 
|---|
|  |  |  | water_level, water_press, water_instant, water_total, ele_total, money_remain, water_remain, | 
|---|
|  |  |  | this_ele, this_water, this_money, this_duration, water_price, ele_price, a_volt, | 
|---|
|  |  |  | b_volt, c_volt, a_current, b_current, c_current, battery_volt, water_meter_trans_volt, | 
|---|
|  |  |  | 
|---|
|  |  |  | </delete> | 
|---|
|  |  |  | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoRm.RmWorkReportHistory"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | insert into rm_work_report_history (id, controller_id, intake_id, | 
|---|
|  |  |  | insert into rm_work_report_history (id, client_id, client_name, | 
|---|
|  |  |  | controller_id, intake_id, | 
|---|
|  |  |  | rtu_addr, dt, rtu_dt, | 
|---|
|  |  |  | order_no, ic_card_addr, ic_card_no, | 
|---|
|  |  |  | water_level, water_press, water_instant, | 
|---|
|  |  |  | 
|---|
|  |  |  | a_current, b_current, c_current, | 
|---|
|  |  |  | battery_volt, water_meter_trans_volt, water_meter_work_volt | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | values (#{id,jdbcType=BIGINT}, #{controllerId,jdbcType=BIGINT}, #{intakeId,jdbcType=BIGINT}, | 
|---|
|  |  |  | values (#{id,jdbcType=BIGINT}, #{clientId,jdbcType=BIGINT}, #{clientName,jdbcType=VARCHAR}, | 
|---|
|  |  |  | #{controllerId,jdbcType=BIGINT}, #{intakeId,jdbcType=BIGINT}, | 
|---|
|  |  |  | #{rtuAddr,jdbcType=VARCHAR}, #{dt,jdbcType=TIMESTAMP}, #{rtuDt,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | #{orderNo,jdbcType=VARCHAR}, #{icCardAddr,jdbcType=VARCHAR}, #{icCardNo,jdbcType=VARCHAR}, | 
|---|
|  |  |  | #{waterLevel,jdbcType=FLOAT}, #{waterPress,jdbcType=FLOAT}, #{waterInstant,jdbcType=FLOAT}, | 
|---|
|  |  |  | 
|---|
|  |  |  | <trim prefix="(" suffix=")" suffixOverrides=","> | 
|---|
|  |  |  | <if test="id != null"> | 
|---|
|  |  |  | id, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="clientId != null"> | 
|---|
|  |  |  | client_id, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="clientName != null"> | 
|---|
|  |  |  | client_name, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="controllerId != null"> | 
|---|
|  |  |  | controller_id, | 
|---|
|  |  |  | 
|---|
|  |  |  | <trim prefix="values (" suffix=")" suffixOverrides=","> | 
|---|
|  |  |  | <if test="id != null"> | 
|---|
|  |  |  | #{id,jdbcType=BIGINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="clientId != null"> | 
|---|
|  |  |  | #{clientId,jdbcType=BIGINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="clientName != null"> | 
|---|
|  |  |  | #{clientName,jdbcType=VARCHAR}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="controllerId != null"> | 
|---|
|  |  |  | #{controllerId,jdbcType=BIGINT}, | 
|---|
|  |  |  | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | update rm_work_report_history | 
|---|
|  |  |  | <set> | 
|---|
|  |  |  | <if test="clientId != null"> | 
|---|
|  |  |  | client_id = #{clientId,jdbcType=BIGINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="clientName != null"> | 
|---|
|  |  |  | client_name = #{clientName,jdbcType=VARCHAR}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="controllerId != null"> | 
|---|
|  |  |  | controller_id = #{controllerId,jdbcType=BIGINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | 
|---|
|  |  |  | <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoRm.RmWorkReportHistory"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | update rm_work_report_history | 
|---|
|  |  |  | set controller_id = #{controllerId,jdbcType=BIGINT}, | 
|---|
|  |  |  | set client_id = #{clientId,jdbcType=BIGINT}, | 
|---|
|  |  |  | client_name = #{clientName,jdbcType=VARCHAR}, | 
|---|
|  |  |  | controller_id = #{controllerId,jdbcType=BIGINT}, | 
|---|
|  |  |  | intake_id = #{intakeId,jdbcType=BIGINT}, | 
|---|
|  |  |  | rtu_addr = #{rtuAddr,jdbcType=VARCHAR}, | 
|---|
|  |  |  | dt = #{dt,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | 
|---|
|  |  |  | water_meter_work_volt = #{waterMeterWorkVolt,jdbcType=FLOAT} | 
|---|
|  |  |  | where id = #{id,jdbcType=BIGINT} | 
|---|
|  |  |  | </update> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!--根据指定条件获取工作报历史记录数量--> | 
|---|
|  |  |  | <select id="getWorkReportsCount_history" resultType="java.lang.Long"> | 
|---|
|  |  |  | SELECT | 
|---|
|  |  |  | COUNT(*) AS recordCount | 
|---|
|  |  |  | FROM rm_work_report_history wo | 
|---|
|  |  |  | INNER JOIN pr_intake inta ON inta.id = wo.intake_id | 
|---|
|  |  |  | <where> | 
|---|
|  |  |  | <if test="intakeId != null and intakeId >0"> | 
|---|
|  |  |  | AND wo.intake_id = #{intakeId} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test = "intakeNum != null and intakeNum !=''"> | 
|---|
|  |  |  | AND inta.name LIKE CONCAT('%',#{intakeNum},'%') | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test = "rtuAddr != null and rtuAddr !=''"> | 
|---|
|  |  |  | AND wo.rtu_addr LIKE CONCAT('%',#{rtuAddr},'%') | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test = "timeStart != null and timeStop != null"> | 
|---|
|  |  |  | AND wo.dt BETWEEN #{timeStart} AND #{timeStop} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </where> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!--根据指定条件获取工作报历史记录--> | 
|---|
|  |  |  | <select id="getWorkReports_history" resultType="com.dy.pipIrrGlobal.voRm.VoWork"> | 
|---|
|  |  |  | SELECT | 
|---|
|  |  |  | wo.intake_id AS intakeId, | 
|---|
|  |  |  | inta.name AS intakeNum, | 
|---|
|  |  |  | wo.rtu_addr AS rtuAddr, | 
|---|
|  |  |  | wo.client_name AS clientName, | 
|---|
|  |  |  | wo.client_name  AS clientName, | 
|---|
|  |  |  | cl.address  AS clientAddr, | 
|---|
|  |  |  | wo.ic_card_no AS icNum, | 
|---|
|  |  |  | wo.ic_card_addr AS icAddr, | 
|---|
|  |  |  | wo.dt AS receiveTime, | 
|---|
|  |  |  | wo.order_no AS orderNo, | 
|---|
|  |  |  | wo.water_level AS waterLevel, | 
|---|
|  |  |  | wo.water_press AS waterPress, | 
|---|
|  |  |  | wo.water_instant AS waterInstant, | 
|---|
|  |  |  | wo.water_total AS waterTotal, | 
|---|
|  |  |  | wo.ele_total AS eleTotal, | 
|---|
|  |  |  | wo.money_remain AS moneyRemain, | 
|---|
|  |  |  | wo.water_remain AS waterRemain, | 
|---|
|  |  |  | wo.this_ele AS thisEle, | 
|---|
|  |  |  | wo.this_water AS thisWater, | 
|---|
|  |  |  | wo.this_money AS thisMoney, | 
|---|
|  |  |  | wo.this_duration AS thisDuration, | 
|---|
|  |  |  | wo.water_price AS waterPrice, | 
|---|
|  |  |  | wo.ele_price AS elePrice, | 
|---|
|  |  |  | wo.a_volt AS aVolt, | 
|---|
|  |  |  | wo.b_volt AS bVolt, | 
|---|
|  |  |  | wo.c_volt AS cVolt, | 
|---|
|  |  |  | wo.a_current AS aCurrent, | 
|---|
|  |  |  | wo.b_current AS bCurrent, | 
|---|
|  |  |  | wo.c_current AS cCurrent, | 
|---|
|  |  |  | wo.battery_volt AS batteryVolt, | 
|---|
|  |  |  | wo.water_meter_trans_volt AS waterMeterTransVolt, | 
|---|
|  |  |  | wo.water_meter_work_volt AS waterMeterWorkVolt | 
|---|
|  |  |  | FROM rm_work_report_history wo | 
|---|
|  |  |  | INNER JOIN pr_intake inta ON inta.id = wo.intake_id | 
|---|
|  |  |  | LEFT JOIN se_client cl on wo.client_id = cl.id | 
|---|
|  |  |  | <where> | 
|---|
|  |  |  | <if test="intakeId != null and intakeId >0"> | 
|---|
|  |  |  | AND wo.intake_id = #{intakeId} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test = "intakeNum != null and intakeNum !=''"> | 
|---|
|  |  |  | AND inta.name LIKE CONCAT('%',#{intakeNum},'%') | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test = "rtuAddr != null and rtuAddr !=''"> | 
|---|
|  |  |  | AND wo.rtu_addr LIKE CONCAT('%',#{rtuAddr},'%') | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test = "timeStart != null and timeStop != null"> | 
|---|
|  |  |  | AND wo.dt BETWEEN #{timeStart} AND #{timeStop} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </where> | 
|---|
|  |  |  | ORDER BY wo.dt DESC | 
|---|
|  |  |  | <trim prefix="limit " > | 
|---|
|  |  |  | <if test="start != null and count != null"> | 
|---|
|  |  |  | #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | </mapper> | 
|---|