| | |
| | | <?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> |
| | | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoIr.IrIrrigateGroup"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table ir_irrigate_group--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="group_code" jdbcType="VARCHAR" property="groupCode" /> |
| | | <result column="default_duration" jdbcType="INTEGER" property="defaultDuration" /> |
| | | <result column="remarks" jdbcType="VARCHAR" property="remarks" /> |
| | | <result column="operator" jdbcType="BIGINT" property="operator" /> |
| | | <result column="operate_time" jdbcType="TIMESTAMP" property="operateTime" /> |
| | | <result column="deleted" jdbcType="TINYINT" property="deleted" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, group_code, default_duration, remarks, `operator`, operate_time, deleted |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from ir_irrigate_group |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| | | <!--@mbg.generated--> |
| | | delete from ir_irrigate_group |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIrrigateGroup"> |
| | | <!--@mbg.generated--> |
| | | insert into ir_irrigate_group (id, group_code, default_duration, |
| | | remarks, `operator`, operate_time, |
| | | deleted) |
| | | values (#{id,jdbcType=BIGINT}, #{groupCode,jdbcType=VARCHAR}, #{defaultDuration,jdbcType=INTEGER}, |
| | | #{remarks,jdbcType=VARCHAR}, #{operator,jdbcType=BIGINT}, #{operateTime,jdbcType=TIMESTAMP}, |
| | | #{deleted,jdbcType=TINYINT}) |
| | | </insert> |
| | | <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="groupCode != null"> |
| | | group_code, |
| | | </if> |
| | | <if test="defaultDuration != null"> |
| | | default_duration, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | remarks, |
| | | </if> |
| | | <if test="operator != null"> |
| | | `operator`, |
| | | </if> |
| | | <if test="operateTime != 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="groupCode != null"> |
| | | #{groupCode,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="defaultDuration != null"> |
| | | #{defaultDuration,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | #{remarks,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="operator != null"> |
| | | #{operator,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="operateTime != null"> |
| | | #{operateTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="deleted != null"> |
| | | #{deleted,jdbcType=TINYINT}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIrrigateGroup"> |
| | | <!--@mbg.generated--> |
| | | update ir_irrigate_group |
| | | <set> |
| | | <if test="groupCode != null"> |
| | | group_code = #{groupCode,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="defaultDuration != null"> |
| | | default_duration = #{defaultDuration,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="remarks != null"> |
| | | remarks = #{remarks,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="operator != null"> |
| | | `operator` = #{operator,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="operateTime != null"> |
| | | operate_time = #{operateTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="deleted != null"> |
| | | deleted = #{deleted,jdbcType=TINYINT}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIrrigateGroup"> |
| | | <!--@mbg.generated--> |
| | | update ir_irrigate_group |
| | | set group_code = #{groupCode,jdbcType=VARCHAR}, |
| | | default_duration = #{defaultDuration,jdbcType=INTEGER}, |
| | | remarks = #{remarks,jdbcType=VARCHAR}, |
| | | `operator` = #{operator,jdbcType=BIGINT}, |
| | | operate_time = #{operateTime,jdbcType=TIMESTAMP}, |
| | | deleted = #{deleted,jdbcType=TINYINT} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <!--逻辑删除--> |
| | | <delete id="deleteLogicById" parameterType="java.lang.Long"> |
| | | <!--@mbg.generated--> |
| | | update ir_irrigate_group |
| | | set deleted = 1 |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <!--逻辑删除--> |
| | | <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> |
| | | <!--修改一个轮罐组--> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrIrrigateGroup"> |
| | | update ir_irrigate_group |
| | | <set> |
| | | <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="operateTime != null"> |
| | | operate_time = #{operateTime,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="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> |
| | | <!--分页查轮灌组--> |
| | | <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> |
| | | |
| | | |
| | | <!--根据指定条件获取轮灌组记录数--> |
| | | <select id="getSimpleGroupCount" resultType="java.lang.Long"> |
| | | SELECT COUNT(*) AS recordCount |
| | | FROM ir_irrigate_group grp |
| | | INNER JOIN ir_project_group pg ON pg.group_id = grp.id |
| | | INNER JOIN ir_project pro ON pg.project_id = pro.id |
| | | <where> |
| | | AND grp.deleted = 0 |
| | | |
| | | <if test="projectId != null and projectId != ''"> |
| | | AND pro.id = #{projectId} |
| | | </if> |
| | | |
| | | <if test="groupCode != null and groupCode != ''"> |
| | | AND grp.group_code LIKE CONCAT('%', #{groupCode}, '%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据指定条件获取轮灌组列表--> |
| | | <select id="getSimpleGroups" resultType="com.dy.pipIrrGlobal.voIr.VoGroupSimple"> |
| | | SELECT |
| | | grp.id AS groupId, |
| | | grp.group_code AS groupCode, |
| | | (SELECT COUNT(*) FROM ir_group_intake WHERE group_id = grp.id) AS intakeCount, |
| | | grp.default_duration AS defaultDuration, |
| | | pg.sort |
| | | FROM ir_irrigate_group grp |
| | | INNER JOIN ir_project_group pg ON pg.group_id = grp.id |
| | | INNER JOIN ir_project pro ON pg.project_id = pro.id |
| | | <where> |
| | | AND grp.deleted = 0 |
| | | |
| | | <if test="projectId != null and projectId != ''"> |
| | | AND pro.id = #{projectId} |
| | | </if> |
| | | |
| | | <if test="groupCode != null and groupCode != ''"> |
| | | AND grp.group_code LIKE CONCAT('%', #{groupCode}, '%') |
| | | </if> |
| | | </where> |
| | | ORDER BY pg.sort |
| | | <trim prefix="limit "> |
| | | <if test="start != null and count != null"> |
| | | #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} |
| | | </if> |
| | | </trim> |
| | | </select> |
| | | </mapper> |