| <?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.IrIrrigateGroupMapper"> | 
|     <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoIr.IrIrrigateGroup"> | 
|         <!--@mbg.generated--> | 
|         <!--@Table ir_irrigate_group--> | 
|         <id column="id" jdbcType="BIGINT" property="id" /> | 
|         <result column="project_id" jdbcType="BIGINT" property="projectId" /> | 
|         <result column="group_code" jdbcType="VARCHAR" property="groupCode" /> | 
|         <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, project_id, group_code, remarks, `operator`, | 
|         operate_time, deleted | 
|     </sql> | 
|     <!--添加--> | 
|     <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIrrigateGroup"> | 
|         <!--@mbg.generated--> | 
|         insert into ir_irrigate_group | 
|         <trim prefix="(" suffix=")" suffixOverrides=","> | 
|             <if test="id != null"> | 
|                 id, | 
|             </if> | 
|             <if test="projectId != null"> | 
|                 project_id, | 
|             </if> | 
|             <if test="groupCode != null"> | 
|                 group_code, | 
|             </if> | 
|             <if test="remarks != null"> | 
|                 remarks, | 
|             </if> | 
|             <if test="operator != null"> | 
|                 `operator`, | 
|             </if> | 
|             <if test="operateDt != null"> | 
|                 operate_time, | 
|             </if> | 
|             <if test="deleted != null"> | 
|                 deleted, | 
|             </if> | 
|         </trim> | 
|         <trim prefix="values (" suffix=")" suffixOverrides=","> | 
|             <if test="id != null"> | 
|                 #{id,jdbcType=BIGINT}, | 
|             </if> | 
|             <if test="projectId != null"> | 
|                 #{projectId,jdbcType=BIGINT}, | 
|             </if> | 
|             <if test="groupCode != null"> | 
|                 #{groupCode,jdbcType=VARCHAR}, | 
|             </if> | 
|             <if test="remarks != null"> | 
|                 #{remarks,jdbcType=VARCHAR}, | 
|             </if> | 
|             <if test="operator != null"> | 
|                 #{operator,jdbcType=BIGINT}, | 
|             </if> | 
|             <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_irrigate_group | 
|         set deleted = 1 | 
|         where id = #{id,jdbcType=BIGINT} | 
|     </delete> | 
|   | 
|     <!--修改一个轮罐组--> | 
|     <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIrrigateGroup"> | 
|         update ir_irrigate_group | 
|         <set> | 
|             <if test="projectId != null"> | 
|                 project_id = #{projectId,jdbcType=BIGINT}, | 
|             </if> | 
|             <if test="groupCode != null"> | 
|                 group_code = #{groupCode,jdbcType=VARCHAR}, | 
|             </if> | 
|             <if test="remarks != null"> | 
|                 remarks = #{remarks,jdbcType=VARCHAR}, | 
|             </if> | 
|             <if test="operator != null"> | 
|                 operator = #{operator,jdbcType=BIGINT}, | 
|             </if> | 
|             <if test="operateDt != null"> | 
|                 operate_time = #{operateDt,jdbcType=TIMESTAMP}, | 
|             </if> | 
|             <if test="deleted != null"> | 
|                 deleted = #{deleted,jdbcType=TINYINT}, | 
|             </if> | 
|         </set> | 
|         where id = #{id,jdbcType=BIGINT} | 
|     </update> | 
|   | 
|     <!--查一个轮罐组--> | 
|     <select id="selectById" resultType="com.dy.pipIrrGlobal.voIr.VoGroupOne"> | 
|         select | 
|         CAST(pro.id AS char)AS projectId, | 
|         pro.project_name  AS  projectName, | 
|         CAST(gro.id AS char)AS id, | 
|         CAST(gro.operator AS char)AS operator, | 
|         cli.name         AS operatorName, | 
|         gro.group_code   AS groupCode, | 
|         COUNT(gu.group_id)   AS itemCount, | 
|         gro.remarks, | 
|         gro.operate_time  AS  operateDt | 
|         from ir_irrigate_group gro | 
|         left join ir_project pro on pro.id = gro.project_id | 
|         left join se_client cli on cli.id = gro.operator | 
|         left join ir_group_unit gu on gu.group_id = gro.id | 
|         where gro.id = #{id,jdbcType=BIGINT} and gro.deleted = 0  and pro.deleted != 1 | 
|     </select> | 
|   | 
|     <!--分页查轮灌组--> | 
|     <select id="getIrrigateGroups" resultType="com.dy.pipIrrGlobal.voIr.VoGroup"> | 
|         SELECT | 
|         CAST(pro.id AS char)AS projectId, | 
|         pro.project_name  AS  projectName, | 
|         CAST(gro.id AS char)AS id, | 
|         CAST(gro.operator AS char)AS operator, | 
|         cli.name         AS operatorName, | 
|         gro.group_code   AS groupCode, | 
|         COUNT(gu.group_id)   AS itemCount, | 
|         gro.remarks, | 
|         gro.operate_time  AS  operateDt | 
|         from ir_irrigate_group gro | 
|         left join ir_project pro on pro.id = gro.project_id | 
|         left join se_client cli on cli.id = gro.operator | 
|         left join ir_group_unit gu on gu.group_id = gro.id | 
|         <where> | 
|              gro.deleted = 0  and pro.deleted != 1 | 
|             <if test="projectName != null and projectName != ''"> | 
|                 AND pro.project_name LIKE CONCAT('%', #{projectName}, '%') | 
|             </if> | 
|         <if test="groupCode != null and groupCode != ''"> | 
|             AND gro.group_code = #{groupCode} | 
|         </if> | 
|         </where> | 
|         GROUP BY gro.id | 
|         ORDER BY gro.operate_time DESC | 
|         <if test="pageCurr != null and pageSize != null"> | 
|             LIMIT ${(pageCurr-1)*pageSize}, ${pageSize} | 
|         </if> | 
|     </select> | 
|     <!--分页查轮灌组记录数--> | 
|     <select id="getRecordCount" resultType="java.lang.Long"> | 
|      SELECT COUNT(*) FROM( | 
|         SELECT COUNT(*),gro.id AS recordCount | 
|         from ir_irrigate_group gro | 
|         left join ir_project pro on pro.id = gro.project_id | 
|         left join se_client cli on cli.id = gro.operator | 
|         left join ir_group_unit gu on gu.group_id = gro.id | 
|         <where> | 
|              gro.deleted = 0  and pro.deleted != 1 | 
|             <if test="projectName != null and projectName != ''"> | 
|                 AND pro.project_name LIKE CONCAT('%', #{projectName}, '%') | 
|             </if> | 
|             <if test="groupCode != null and groupCode != ''"> | 
|                 AND gro.group_code = #{groupCode} | 
|             </if> | 
|         </where> | 
|         GROUP BY gro.id | 
|         ) a | 
|     </select> | 
| </mapper> |