|  |  |  | 
|---|
|  |  |  | operateDt, | 
|---|
|  |  |  | deleted | 
|---|
|  |  |  | </sql> | 
|---|
|  |  |  | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> | 
|---|
|  |  |  | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultType="com.dy.pipIrrGlobal.voPr.VoAllIntake"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | select | 
|---|
|  |  |  | <include refid="Base_Column_List"/> | 
|---|
|  |  |  | from pr_intake | 
|---|
|  |  |  | where id = #{id,jdbcType=BIGINT} | 
|---|
|  |  |  | and deleted = 0 | 
|---|
|  |  |  | ge.id, | 
|---|
|  |  |  | ge.countyId, | 
|---|
|  |  |  | ge.townId, | 
|---|
|  |  |  | ge.villageId, | 
|---|
|  |  |  | ge.divideId, | 
|---|
|  |  |  | ge.blockId, | 
|---|
|  |  |  | ge.`name`, | 
|---|
|  |  |  | ge.lng, | 
|---|
|  |  |  | ge.lat, | 
|---|
|  |  |  | ge.remarks, | 
|---|
|  |  |  | ge.`operator`, | 
|---|
|  |  |  | ge.operateDt, | 
|---|
|  |  |  | blo.`name`                                          AS blockName, | 
|---|
|  |  |  | CONCAT(country.`name`, town.`name`, village.`name`)              AS address, | 
|---|
|  |  |  | con.id AS controllerId, | 
|---|
|  |  |  | con.rtuAddr, | 
|---|
|  |  |  | con.protocol | 
|---|
|  |  |  | FROM pr_intake ge | 
|---|
|  |  |  | LEFT JOIN pr_divide divi ON ge.divideId = divi.id | 
|---|
|  |  |  | LEFT JOIN ba_block blo ON divi.blockId = blo.id | 
|---|
|  |  |  | LEFT JOIN ba_district country ON ge.countyId = country.id | 
|---|
|  |  |  | LEFT JOIN ba_district town ON ge.townId = town.id | 
|---|
|  |  |  | LEFT JOIN ba_district village ON ge.villageId = village.id | 
|---|
|  |  |  | LEFT JOIN pr_controller con ON con.intakeId = ge.id | 
|---|
|  |  |  | where ge.id = #{id,jdbcType=BIGINT} | 
|---|
|  |  |  | AND ge.deleted = 0 | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <delete id="deleteLogicById" parameterType="java.lang.Long"> | 
|---|
|  |  |  | 
|---|
|  |  |  | AND bindNumTb.num = #{bindNumber} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </where> | 
|---|
|  |  |  | ORDER BY ge.operateDt DESC | 
|---|
|  |  |  | ORDER BY ge.divideId DESC, ge.id DESC | 
|---|
|  |  |  | <trim prefix="limit "> | 
|---|
|  |  |  | <if test="start != null and count != null"> | 
|---|
|  |  |  | #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} | 
|---|
|  |  |  | 
|---|
|  |  |  | FROM pr_intake | 
|---|
|  |  |  | WHERE deleted = 0 | 
|---|
|  |  |  | AND id = #{intakeId} | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!--根据村ID获取全部地址--> | 
|---|
|  |  |  | <select id="getNameById" resultType="java.lang.String"> | 
|---|
|  |  |  | select name | 
|---|
|  |  |  | from pr_intake | 
|---|
|  |  |  | where id = #{intakeId, jdbcType=BIGINT} | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!--根据村ID获取全部地址--> | 
|---|
|  |  |  | 
|---|
|  |  |  | SELECT | 
|---|
|  |  |  | inta.id                     AS intakeId, | 
|---|
|  |  |  | con.rtuAddr, | 
|---|
|  |  |  | inta.name                   AS intakeNum, | 
|---|
|  |  |  | con.protocol, | 
|---|
|  |  |  | con.protocol_version       AS protocolVersion, | 
|---|
|  |  |  | inta.name                  AS intakeNum, | 
|---|
|  |  |  | inta.lng, | 
|---|
|  |  |  | inta.lat, | 
|---|
|  |  |  | IFNULL(hou.instant_amount, 0) AS instantAmount, | 
|---|
|  |  |  | IFNULL(hou.total_amount, 0) AS totalAmount, | 
|---|
|  |  |  | <if test="onLineMap != null and onLineMap !='' and isOnLine != null"> | 
|---|
|  |  |  | rtus.isOnLine, | 
|---|
|  |  |  | 
|---|
|  |  |  | WHERE id != #{id} | 
|---|
|  |  |  | and `name` = #{intakeName} | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | <!--app修改取水口经纬度--> | 
|---|
|  |  |  | <update id="updateByPrimaryKeySelective1" parameterType="com.dy.pipIrrGlobal.voPr.IntakeUpdateLngLat"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | update pr_intake | 
|---|
|  |  |  | <set> | 
|---|
|  |  |  | <if test="lng != null"> | 
|---|
|  |  |  | lng = #{lng,jdbcType=DOUBLE}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="lat != null"> | 
|---|
|  |  |  | lat = #{lat,jdbcType=DOUBLE}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="operator != null"> | 
|---|
|  |  |  | `operator` = #{operator,jdbcType=BIGINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="operateDt != null"> | 
|---|
|  |  |  | operateDt = #{operateDt,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </set> | 
|---|
|  |  |  | where id = #{id,jdbcType=BIGINT} | 
|---|
|  |  |  | </update> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!--获取未绑定到轮灌组的取水口列表--> | 
|---|
|  |  |  | <select id="getFreeIntakes" resultType="com.dy.pipIrrGlobal.voPr.VoIntakeSimple"> | 
|---|
|  |  |  | SELECT | 
|---|
|  |  |  | id AS intakeId, | 
|---|
|  |  |  | name AS intakeName | 
|---|
|  |  |  | FROM pr_intake inta | 
|---|
|  |  |  | <where> | 
|---|
|  |  |  | AND inta.deleted = 0 | 
|---|
|  |  |  | AND NOT EXISTS (SELECT 1 FROM ir_group_intake gi WHERE gi.intake_id = inta.id) | 
|---|
|  |  |  | <if test="intakeName != null and intakeName != ''"> | 
|---|
|  |  |  | AND LOWER(inta.name) LIKE CONCAT('%', #{intakeName}, '%') | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </where> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!--获取未绑定虚拟卡的取水口列表,给取水口绑虚拟卡使用--> | 
|---|
|  |  |  | <select id="getNotLinkVcIntakes" resultType="com.dy.pipIrrGlobal.voPr.VoIntakeSimple"> | 
|---|
|  |  |  | SELECT | 
|---|
|  |  |  | id AS intakeId, | 
|---|
|  |  |  | name AS intakeName | 
|---|
|  |  |  | FROM pr_intake inta | 
|---|
|  |  |  | WHERE NOT EXISTS ( | 
|---|
|  |  |  | SELECT 1 | 
|---|
|  |  |  | FROM pr_intake_vc iv | 
|---|
|  |  |  | WHERE iv.intake_id = inta.id | 
|---|
|  |  |  | ) AND inta.deleted = 0 | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!-- 为wechat,根据指定取水口名称模糊(后端)查询水口记录数 --> | 
|---|
|  |  |  | <select id="getSomeIntakesCount4Wx" parameterType="java.util.Map" resultType="java.lang.Long"> | 
|---|
|  |  |  | SELECT COUNT(*) AS recordCount | 
|---|
|  |  |  | FROM pr_intake tb | 
|---|
|  |  |  | <where> | 
|---|
|  |  |  | tb.deleted = 0 | 
|---|
|  |  |  | <if test="intakeNum != null and intakeNum != ''"> | 
|---|
|  |  |  | AND tb.name LIKE CONCAT('%', #{intakeNum}) | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </where> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!-- 为wechat,根据指定取水口名称模糊(后端)查询水口记录 --> | 
|---|
|  |  |  | <select id="getSomeIntakes4Wx" parameterType="java.util.Map" resultType="com.dy.pipIrrGlobal.voPr.VoOnLineIntake"> | 
|---|
|  |  |  | SELECT | 
|---|
|  |  |  | inta.id AS intakeId, | 
|---|
|  |  |  | con.rtuAddr, | 
|---|
|  |  |  | inta.name AS intakeNum | 
|---|
|  |  |  | FROM pr_intake inta | 
|---|
|  |  |  | INNER JOIN pr_controller con ON con.intakeId = inta.id | 
|---|
|  |  |  | <where> | 
|---|
|  |  |  | inta.deleted = 0 | 
|---|
|  |  |  | <if test="intakeNum != null and intakeNum != ''"> | 
|---|
|  |  |  | AND inta.name LIKE CONCAT('%', #{intakeNum}) | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </where> | 
|---|
|  |  |  | ORDER BY inta.id DESC | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </mapper> | 
|---|