| New file | 
|  |  |  | 
|---|
|  |  |  | <?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.IrGroupUnitMapper"> | 
|---|
|  |  |  | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoIr.IrGroupUnit"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | <!--@Table ir_group_unit--> | 
|---|
|  |  |  | <id column="id" jdbcType="BIGINT" property="id" /> | 
|---|
|  |  |  | <result column="group_id" jdbcType="BIGINT" property="groupId" /> | 
|---|
|  |  |  | <result column="unit_id" jdbcType="BIGINT" property="unitId" /> | 
|---|
|  |  |  | <result column="operator" jdbcType="BIGINT" property="operator" /> | 
|---|
|  |  |  | <result column="operate_time" jdbcType="TIMESTAMP" property="operateDt" /> | 
|---|
|  |  |  | </resultMap> | 
|---|
|  |  |  | <sql id="Base_Column_List"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | id, group_id, unit_id, `operator`, | 
|---|
|  |  |  | operate_time | 
|---|
|  |  |  | </sql> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!--添加--> | 
|---|
|  |  |  | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrGroupUnit"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | insert into ir_group_unit | 
|---|
|  |  |  | <trim prefix="(" suffix=")" suffixOverrides=","> | 
|---|
|  |  |  | <if test="id != null"> | 
|---|
|  |  |  | id, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="groupId != null"> | 
|---|
|  |  |  | group_id, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="unitId != null"> | 
|---|
|  |  |  | unit_id, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="operator != null"> | 
|---|
|  |  |  | `operator`, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="operateDt != null"> | 
|---|
|  |  |  | operate_time, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | <trim prefix="values (" suffix=")" suffixOverrides=","> | 
|---|
|  |  |  | <if test="id != null"> | 
|---|
|  |  |  | #{id,jdbcType=BIGINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="groupId != null"> | 
|---|
|  |  |  | #{groupId,jdbcType=BIGINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="unitId != null"> | 
|---|
|  |  |  | #{unitId,jdbcType=BIGINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="operator != null"> | 
|---|
|  |  |  | #{operator,jdbcType=BIGINT}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="operateDt != null"> | 
|---|
|  |  |  | #{operateDt,jdbcType=TIMESTAMP}, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | </insert> | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <delete id="deleteByUnitIdGroupId" parameterType="com.dy.pipIrrGlobal.pojoIr.IrGroupUnit"> | 
|---|
|  |  |  | delete from ir_group_unit | 
|---|
|  |  |  | where group_id = #{groupId,jdbcType=BIGINT} and unit_id = #{unitId,jdbcType=BIGINT} | 
|---|
|  |  |  | </delete> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <delete id="deleteByUnitId"> | 
|---|
|  |  |  | delete from ir_group_unit | 
|---|
|  |  |  | where unit_id = #{unitId,jdbcType=BIGINT} | 
|---|
|  |  |  | </delete> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <delete id="deleteByGroupId"> | 
|---|
|  |  |  | 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> | 
|---|