| | |
| | | <!--@mbg.generated--> |
| | | <!--@Table ir_irrigate_plan--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="project_id" jdbcType="BIGINT" property="projectId" /> |
| | | <result column="plan_name" jdbcType="VARCHAR" property="planName" /> |
| | | <result column="startup_mode" jdbcType="TINYINT" property="startupMode" /> |
| | | <result column="plan_start_time" jdbcType="TIMESTAMP" property="planStartTime" /> |
| | |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, plan_name, startup_mode, plan_start_time, plan_stop_time, duration, |
| | | id, project_id, plan_name, startup_mode, plan_start_time, plan_stop_time, duration, |
| | | plan_state, executing_state, deleted |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | |
| | | </delete> |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIrrigatePlan"> |
| | | <!--@mbg.generated--> |
| | | insert into ir_irrigate_plan (id, plan_name, |
| | | insert into ir_irrigate_plan (id, project_id, plan_name, |
| | | startup_mode, plan_start_time, plan_stop_time, |
| | | duration, plan_state, executing_state, |
| | | deleted) |
| | | values (#{id,jdbcType=BIGINT}, #{planName,jdbcType=VARCHAR}, |
| | | values (#{id,jdbcType=BIGINT}, #{projectId,jdbcType=BIGINT}, #{planName,jdbcType=VARCHAR}, |
| | | #{startupMode,jdbcType=TINYINT}, #{planStartTime,jdbcType=TIMESTAMP}, #{planStopTime,jdbcType=TIMESTAMP}, |
| | | #{duration,jdbcType=INTEGER}, #{planState,jdbcType=TINYINT}, #{executingState,jdbcType=TINYINT}, |
| | | #{deleted,jdbcType=BIGINT}) |
| | |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | id, |
| | | </if> |
| | | <if test="projectId != null"> |
| | | project_id, |
| | | </if> |
| | | <if test="planName != null"> |
| | | plan_name, |
| | |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="projectId != null"> |
| | | #{projectId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="planName != null"> |
| | | #{planName,jdbcType=VARCHAR}, |
| | |
| | | <!--@mbg.generated--> |
| | | update ir_irrigate_plan |
| | | <set> |
| | | <if test="projectId != null"> |
| | | project_id = #{projectId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="planName != null"> |
| | | plan_name = #{planName,jdbcType=VARCHAR}, |
| | | </if> |
| | |
| | | <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIrrigatePlan"> |
| | | <!--@mbg.generated--> |
| | | update ir_irrigate_plan |
| | | set plan_name = #{planName,jdbcType=VARCHAR}, |
| | | set project_id = #{projectId,jdbcType=BIGINT}, |
| | | plan_name = #{planName,jdbcType=VARCHAR}, |
| | | startup_mode = #{startupMode,jdbcType=TINYINT}, |
| | | plan_start_time = #{planStartTime,jdbcType=TIMESTAMP}, |
| | | plan_stop_time = #{planStopTime,jdbcType=TIMESTAMP}, |
| | |
| | | <!--获取未完成的计划列表,小程序计划列表页使用--> |
| | | <select id="getNotCompletePlans" resultType="com.dy.pipIrrGlobal.voIr.VoPlans"> |
| | | SELECT |
| | | id AS planId, |
| | | plan_name AS planName, |
| | | startup_mode AS startupMode, |
| | | plan_start_time AS planStartTime, |
| | | plan_stop_time AS planStopTime, |
| | | duration, |
| | | IF(plan_state = 1,'草稿', |
| | | IF(NOW() < plan_start_time, '未执行', |
| | | IF(NOW() >= plan_start_time AND NOW() < plan_stop_time, '执行中', '已完成') |
| | | pro.project_name AS projectName, |
| | | plan.id AS planId, |
| | | plan.plan_name AS planName, |
| | | plan.startup_mode AS startupMode, |
| | | plan.plan_start_time AS planStartTime, |
| | | plan.plan_stop_time AS planStopTime, |
| | | plan.duration, |
| | | IF(plan.plan_state = 1, 1, |
| | | IF(NOW() < plan.plan_start_time, 2, |
| | | IF(NOW() >= plan.plan_start_time AND NOW() < plan.plan_stop_time, 3, 4) |
| | | ) |
| | | ) AS planState |
| | | FROM ir_irrigate_plan plan |
| | | WHERE deleted = 0 AND (plan_state = 1 OR NOW() < plan_stop_time) |
| | | ORDER BY plan_state DESC |
| | | INNER JOIN ir_project pro ON pro.id = plan.project_id |
| | | WHERE plan.deleted = 0 AND (plan.plan_state = 1 OR NOW() < plan.plan_stop_time) |
| | | ORDER BY plan.plan_state DESC |
| | | </select> |
| | | |
| | | <!--获取已完成的计划列表,小程序计划列表页使用--> |
| | | <select id="getCompletedPlans" resultType="com.dy.pipIrrGlobal.voIr.VoPlans"> |
| | | SELECT |
| | | id AS planId, |
| | | plan_name AS planName, |
| | | startup_mode AS startupMode, |
| | | plan_start_time AS planStartTime, |
| | | plan_stop_time AS planStopTime, |
| | | duration, |
| | | IF(plan_state = 1,'草稿', |
| | | IF(NOW() < plan_start_time, '未执行', |
| | | IF(NOW() >= plan_start_time AND NOW() < plan_stop_time, '执行中', '已完成') |
| | | pro.project_name AS projectName, |
| | | plan.id AS planId, |
| | | plan.plan_name AS planName, |
| | | plan.startup_mode AS startupMode, |
| | | plan.plan_start_time AS planStartTime, |
| | | plan.plan_stop_time AS planStopTime, |
| | | plan.duration, |
| | | IF(plan.plan_state = 1, 1, |
| | | IF(NOW() < plan.plan_start_time, 2, |
| | | IF(NOW() >= plan.plan_start_time AND NOW() < plan.plan_stop_time, 3, 4) |
| | | ) |
| | | ) AS planState |
| | | FROM ir_irrigate_plan plan |
| | | WHERE deleted = 0 AND (plan_state = 2 AND NOW() >= plan_stop_time) |
| | | ORDER BY plan_state DESC |
| | | INNER JOIN ir_project pro ON pro.id = plan.project_id |
| | | WHERE plan.deleted = 0 AND (plan.plan_state = 2 AND NOW() >= plan.plan_stop_time) |
| | | ORDER BY plan.plan_state DESC |
| | | </select> |
| | | |
| | | </mapper> |