|  |  |  | 
|---|
|  |  |  | set command_result = #{commandResult}, failure_factors = #{failureFactors} | 
|---|
|  |  |  | where command_id = #{commandId} | 
|---|
|  |  |  | </update> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!--根据主键修改命令ID--> | 
|---|
|  |  |  | <update id="updateCommandId"> | 
|---|
|  |  |  | update ir_intake_operate | 
|---|
|  |  |  | set command_id = #{commandId} | 
|---|
|  |  |  | where id = #{id} | 
|---|
|  |  |  | </update> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!--根据计划ID获取待终止的取水口ID(已发布开发命令,无论是否成功)--> | 
|---|
|  |  |  | <select id="getToTerminateIntakeIds" resultType="java.lang.Long"> | 
|---|
|  |  |  | SELECT | 
|---|
|  |  |  | intake_id AS intakeId | 
|---|
|  |  |  | FROM ir_intake_operate | 
|---|
|  |  |  | WHERE operate_type = 1 AND plan_id = #{planId} | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!--根据计划ID获取待终止的命令ID--> | 
|---|
|  |  |  | <select id="getTerminateCommandIds" resultType="java.lang.Long"> | 
|---|
|  |  |  | SELECT command_id AS commandId FROM ir_intake_operate WHERE operate_type = 1 AND plan_id = #{planId} | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!--根据计划ID获取待终止的取水口列表(开阀成功的)--> | 
|---|
|  |  |  | <select id="getToTerminateIntakes" resultType="com.dy.pipIrrGlobal.voIr.VoToTerminateIntakes"> | 
|---|
|  |  |  | SELECT | 
|---|
|  |  |  | command_id AS commandId, | 
|---|
|  |  |  | intake_id AS intakeId, | 
|---|
|  |  |  | start_time AS startTime | 
|---|
|  |  |  | FROM ir_intake_operate | 
|---|
|  |  |  | WHERE operate_type = 1 AND command_result = 1 AND plan_id = #{planId} | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!--根据计划ID及管轮组ID获取取水口发布发布结果--> | 
|---|
|  |  |  | <select id="getIntakeResult" resultType="com.dy.pipIrrGlobal.voIr.VoIntakeResult"> | 
|---|
|  |  |  | SELECT | 
|---|
|  |  |  | IF(io.command_result = 1, 0, 1) AS code, | 
|---|
|  |  |  | (SELECT name FROM pr_intake WHERE id = io.intake_id) AS intakeName, | 
|---|
|  |  |  | io.failure_factors AS result | 
|---|
|  |  |  | FROM ir_intake_operate io | 
|---|
|  |  |  | inner JOIN ir_group_intake gi ON gi.intake_id = io.intake_id | 
|---|
|  |  |  | WHERE io.plan_id = #{planId} AND gi.group_id = #{groupId} AND operate_type = 1; | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!--根据计划ID获取取水口命令发布失败数量,灌溉计划详情页使用--> | 
|---|
|  |  |  | <select id="getFailureCount" resultType="java.lang.Integer"> | 
|---|
|  |  |  | SELECT | 
|---|
|  |  |  | COUNT(1) AS failureCount | 
|---|
|  |  |  | FROM ir_intake_operate | 
|---|
|  |  |  | WHERE operate_type = 1 AND command_result != 1 AND plan_id = #{planId} | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | </mapper> | 
|---|