|  |  |  | 
|---|
|  |  |  | <result column="unit_id" jdbcType="BIGINT" property="unitId" /> | 
|---|
|  |  |  | <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, group_id, unit_id, `operator`, | 
|---|
|  |  |  | operate_time, deleted | 
|---|
|  |  |  | operate_time | 
|---|
|  |  |  | </sql> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!--添加--> | 
|---|
|  |  |  | 
|---|
|  |  |  | <if test="operateDt != null"> | 
|---|
|  |  |  | operate_time, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="deleted != null"> | 
|---|
|  |  |  | deleted, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | <trim prefix="values (" suffix=")" suffixOverrides=","> | 
|---|
|  |  |  | <if test="id != null"> | 
|---|
|  |  |  | 
|---|
|  |  |  | <if test="operateDt != null"> | 
|---|
|  |  |  | #{operateDt,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="deleted != null"> | 
|---|
|  |  |  | #{deleted,jdbcType=TINYINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | </insert> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!--逻辑删除--> | 
|---|
|  |  |  | <delete id="deleteLogicById" parameterType="java.lang.Long"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | update ir_group_unit | 
|---|
|  |  |  | set deleted = 1 | 
|---|
|  |  |  | where id = #{id,jdbcType=BIGINT} | 
|---|
|  |  |  | </delete> | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <delete id="deleteByUnitIdGroupId" parameterType="com.dy.pipIrrGlobal.pojoIr.IrGroupUnit"> | 
|---|
|  |  |  | update ir_group_unit | 
|---|
|  |  |  | set deleted = 1,operator = #{operator,jdbcType=BIGINT},operate_time = #{operateDt,jdbcType=TIMESTAMP} | 
|---|
|  |  |  | delete from ir_group_unit | 
|---|
|  |  |  | where group_id = #{groupId,jdbcType=BIGINT} and unit_id = #{unitId,jdbcType=BIGINT} | 
|---|
|  |  |  | </delete> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <delete id="deleteByUnitId"> | 
|---|
|  |  |  | update ir_group_unit | 
|---|
|  |  |  | set deleted = 1 | 
|---|
|  |  |  | delete from ir_group_unit | 
|---|
|  |  |  | where unit_id = #{unitId,jdbcType=BIGINT} | 
|---|
|  |  |  | </delete> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <delete id="deleteByGroupId"> | 
|---|
|  |  |  | update ir_group_unit | 
|---|
|  |  |  | set deleted = 1 | 
|---|
|  |  |  | delete from ir_group_unit | 
|---|
|  |  |  | where group_id = #{groupId,jdbcType=BIGINT} | 
|---|
|  |  |  | </delete> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!--    //查一个轮灌组绑定的灌溉单元id--> | 
|---|
|  |  |  | <select id="getGroupBindUnits" parameterType="Long" resultType="java.lang.Long"> | 
|---|
|  |  |  | SELECT unit_id AS unitId FROM `ir_group_unit`WHERE group_id = #{groupId,jdbcType=BIGINT} | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="getNotBindUnits" resultType="java.lang.Long"> | 
|---|
|  |  |  | SELECT id FROM ir_irrigate_unit  WHERE id NOT IN (SELECT unit_id  FROM ir_group_unit) | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | </mapper> | 
|---|