<?xml version="1.0" encoding="UTF-8"?> 
 | 
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> 
 | 
<mapper namespace="com.dy.pipIrrGlobal.daoIr.IrIrrigateSchedulingMapper"> 
 | 
    <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoIr.IrIrrigateScheduling"> 
 | 
        <!--@mbg.generated--> 
 | 
        <!--@Table ir_irrigate_scheduling--> 
 | 
        <id column="id" jdbcType="BIGINT" property="id" /> 
 | 
        <result column="crop_id" jdbcType="BIGINT" property="cropId" /> 
 | 
        <result column="growth_period" jdbcType="VARCHAR" property="growthPeriod" /> 
 | 
        <result column="irrigate_cycle" jdbcType="INTEGER" property="irrigateCycle" /> 
 | 
        <result column="duration" jdbcType="INTEGER" property="duration" /> 
 | 
        <result column="remarks" jdbcType="VARCHAR" property="remarks" /> 
 | 
        <result column="operator" jdbcType="BIGINT" property="operator" /> 
 | 
        <result column="operate_time" jdbcType="TIMESTAMP" property="operateDt" /> 
 | 
        <result column="deleted" jdbcType="TINYINT" property="deleted" /> 
 | 
    </resultMap> 
 | 
    <sql id="Base_Column_List"> 
 | 
        <!--@mbg.generated--> 
 | 
        id, crop_id,growth_period,irrigate_cycle,duration, remarks,operator,operate_time, deleted 
 | 
    </sql> 
 | 
    <!--添加--> 
 | 
    <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIrrigateScheduling"> 
 | 
        insert into ir_irrigate_scheduling 
 | 
        <trim prefix="(" suffix=")" suffixOverrides=","> 
 | 
            <if test="id != null"> 
 | 
                id, 
 | 
            </if> 
 | 
            <if test="cropId != null"> 
 | 
                crop_id, 
 | 
            </if> 
 | 
            <if test="growthPeriod != null"> 
 | 
                growth_period, 
 | 
            </if> 
 | 
            <if test="irrigateCycle != null"> 
 | 
                irrigate_cycle, 
 | 
            </if> 
 | 
            <if test="duration != null"> 
 | 
                duration, 
 | 
            </if> 
 | 
            <if test="operator != null"> 
 | 
                operator, 
 | 
            </if> 
 | 
            <if test="operateDt != null"> 
 | 
                operate_time, 
 | 
            </if> 
 | 
            <if test="remarks != null"> 
 | 
                remarks, 
 | 
            </if> 
 | 
            <if test="deleted != null"> 
 | 
                deleted, 
 | 
            </if> 
 | 
        </trim> 
 | 
        <trim prefix="values (" suffix=")" suffixOverrides=","> 
 | 
            <if test="id != null"> 
 | 
                #{id,jdbcType=BIGINT}, 
 | 
            </if> 
 | 
            <if test="cropId != null"> 
 | 
                #{cropId,jdbcType=BIGINT}, 
 | 
            </if> 
 | 
            <if test="growthPeriod != null"> 
 | 
                #{growthPeriod,jdbcType=VARCHAR}, 
 | 
            </if> 
 | 
            <if test="irrigateCycle != null"> 
 | 
                #{irrigateCycle,jdbcType=INTEGER}, 
 | 
            </if> 
 | 
            <if test="duration != null"> 
 | 
                #{duration,jdbcType=INTEGER}, 
 | 
            </if> 
 | 
            <if test="operator != null"> 
 | 
                #{operator,jdbcType=BIGINT}, 
 | 
            </if> 
 | 
            <if test="operateDt != null"> 
 | 
                #{operateDt,jdbcType=TIMESTAMP}, 
 | 
            </if> 
 | 
            <if test="remarks != null"> 
 | 
                #{remarks,jdbcType=VARCHAR}, 
 | 
            </if> 
 | 
            <if test="deleted != null"> 
 | 
                #{deleted,jdbcType=TINYINT}, 
 | 
            </if> 
 | 
        </trim> 
 | 
    </insert> 
 | 
    <!--逻辑删除--> 
 | 
    <delete id="deleteLogicById" parameterType="java.lang.Long"> 
 | 
        <!--@mbg.generated--> 
 | 
        update ir_irrigate_scheduling 
 | 
        set deleted = 1 
 | 
        where id = #{id,jdbcType=BIGINT} 
 | 
    </delete> 
 | 
  
 | 
    <!--修改信息--> 
 | 
    <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIrrigateScheduling"> 
 | 
        update ir_irrigate_scheduling 
 | 
        <set> 
 | 
            <if test="cropId != null"> 
 | 
                crop_id = #{cropId,jdbcType=BIGINT}, 
 | 
            </if> 
 | 
            <if test="growthPeriod != null"> 
 | 
                growth_period = #{growthPeriod,jdbcType=VARCHAR}, 
 | 
            </if> 
 | 
            <if test="irrigateCycle != null"> 
 | 
                irrigate_cycle = #{irrigateCycle,jdbcType=INTEGER}, 
 | 
            </if> 
 | 
            <if test="duration != null"> 
 | 
                duration = #{duration,jdbcType=INTEGER}, 
 | 
            </if> 
 | 
            <if test="operator != null"> 
 | 
                operator = #{operator,jdbcType=BIGINT}, 
 | 
            </if> 
 | 
            <if test="operateDt != null"> 
 | 
                operate_time = #{operateDt,jdbcType=TIMESTAMP}, 
 | 
            </if> 
 | 
            <if test="remarks != null"> 
 | 
                remarks = #{remarks,jdbcType=VARCHAR}, 
 | 
            </if> 
 | 
            <if test="deleted != null"> 
 | 
                deleted = #{deleted,jdbcType=TINYINT}, 
 | 
            </if> 
 | 
        </set> 
 | 
        where id = #{id,jdbcType=BIGINT} 
 | 
    </update> 
 | 
  
 | 
    <select id="getRecordCount" resultType="java.lang.Long"> 
 | 
        SELECT COUNT(*) AS recordCount 
 | 
        from ir_irrigate_scheduling sch 
 | 
        left join ir_crop cro on cro.id = sch.crop_id 
 | 
        <where> 
 | 
            sch.deleted = 0 
 | 
            <if test="cropName != null and cropName != ''"> 
 | 
                AND cro.crop_name LIKE CONCAT('%', #{cropName}, '%') 
 | 
            </if> 
 | 
        </where> 
 | 
    </select> 
 | 
  
 | 
    <select id="getSchedulings" resultType="com.dy.pipIrrGlobal.voIr.VoScheduling"> 
 | 
        SELECT 
 | 
        CAST(sch.id AS char)AS id, 
 | 
        cro.crop_name  AS  cropName, 
 | 
        sch.growth_period AS growthPeriod, 
 | 
        sch.irrigate_cycle AS irrigateCycle, 
 | 
        sch.remarks  AS remarks, 
 | 
        sch.duration AS duration 
 | 
        from ir_irrigate_scheduling sch 
 | 
        left join ir_crop cro on cro.id = sch.crop_id 
 | 
        <where> 
 | 
            sch.deleted = 0 
 | 
            <if test="cropName != null and cropName != ''"> 
 | 
                AND cro.crop_name LIKE CONCAT('%', #{cropName}, '%') 
 | 
            </if> 
 | 
        </where> 
 | 
        <if test="pageCurr != null and pageSize != null"> 
 | 
            LIMIT ${(pageCurr-1)*pageSize}, ${pageSize} 
 | 
        </if> 
 | 
    </select> 
 | 
  
 | 
    <select id="selectById" resultType="com.dy.pipIrrGlobal.voIr.VoSchedulingOne"> 
 | 
        select 
 | 
        CAST(sch.id AS char)AS id, 
 | 
        CAST(cro.id AS char)AS cropId, 
 | 
        cro.crop_name  AS  cropName, 
 | 
        sch.growth_period AS growthPeriod, 
 | 
        sch.irrigate_cycle AS irrigateCycle, 
 | 
        sch.duration AS duration, 
 | 
        sch.remarks  AS remarks, 
 | 
        CAST(sch.operator AS char)AS operator, 
 | 
        cli.name         AS operatorName, 
 | 
        sch.operate_time  AS operateDt 
 | 
        from ir_irrigate_scheduling sch 
 | 
        left join ir_crop cro on cro.id = sch.crop_id 
 | 
        left join se_client cli on cli.id = sch.operator 
 | 
        where sch.id = #{id,jdbcType=BIGINT} and sch.deleted = 0 
 | 
    </select> 
 | 
</mapper> 
 |