|  |  | 
 |  |  |         <!--@Table ir_irrigate_unit--> | 
 |  |  |         <id column="id" jdbcType="BIGINT" property="id" /> | 
 |  |  |         <result column="project_id" jdbcType="BIGINT" property="projectId" /> | 
 |  |  |         <result column="intake_id" jdbcType="BIGINT" property="intakeId" /> | 
 |  |  |         <result column="area" jdbcType="FLOAT" property="area" /> | 
 |  |  |         <result column="remarks" jdbcType="VARCHAR" property="remarks" /> | 
 |  |  |         <result column="operator" jdbcType="BIGINT" property="operator" /> | 
 |  |  | 
 |  |  |     </resultMap> | 
 |  |  |     <sql id="Base_Column_List"> | 
 |  |  |         <!--@mbg.generated--> | 
 |  |  |         id, project_id, area, remarks, `operator`, | 
 |  |  |         id, project_id,intake_id, area, remarks, `operator`, | 
 |  |  |         operate_time, deleted | 
 |  |  |     </sql> | 
 |  |  |  | 
 |  |  | 
 |  |  |             </if> | 
 |  |  |             <if test="projectId != null"> | 
 |  |  |                 project_id, | 
 |  |  |             </if> | 
 |  |  |             <if test="intakeId != null"> | 
 |  |  |                 intake_id, | 
 |  |  |             </if> | 
 |  |  |             <if test="area != null"> | 
 |  |  |                 area, | 
 |  |  | 
 |  |  |             </if> | 
 |  |  |             <if test="projectId != null"> | 
 |  |  |                 #{projectId,jdbcType=BIGINT}, | 
 |  |  |             </if> | 
 |  |  |             <if test="intakeId != null"> | 
 |  |  |                 #{intakeId,jdbcType=BIGINT}, | 
 |  |  |             </if> | 
 |  |  |             <if test="area != null"> | 
 |  |  |                 #{area,jdbcType=FLOAT}, | 
 |  |  | 
 |  |  |             <if test="projectId != null"> | 
 |  |  |                 project_id = #{projectId,jdbcType=BIGINT}, | 
 |  |  |             </if> | 
 |  |  |             <if test="intakeId != null"> | 
 |  |  |                 intake_id = #{intakeId,jdbcType=BIGINT}, | 
 |  |  |             </if> | 
 |  |  |             <if test="area != null"> | 
 |  |  |                 area = #{area,jdbcType=FLOAT}, | 
 |  |  |             </if> | 
 |  |  | 
 |  |  |         select | 
 |  |  |         CAST(pro.id AS char)AS projectId, | 
 |  |  |         pro.project_name  AS  projectName, | 
 |  |  |         CAST(intake.id AS char)AS intakeId, | 
 |  |  |         intake.name  AS  intakeName, | 
 |  |  |         CAST(uni.id AS char)AS id, | 
 |  |  |         CAST(uni.operator AS char)AS operator, | 
 |  |  |         cli.name         AS operatorName, | 
 |  |  |         gru.group_code         AS groupCode, | 
 |  |  |         uni.area, | 
 |  |  |         uni.remarks, | 
 |  |  |         uni.operate_time  AS  operateDt | 
 |  |  |         from ir_irrigate_unit uni | 
 |  |  |         left join pr_intake intake on intake.id = uni.intake_id | 
 |  |  |         left join ir_project pro on pro.id = uni.project_id | 
 |  |  |         left join se_client cli on cli.id = uni.operator | 
 |  |  |         left join ir_group_unit gu on gu.unit_id = uni.id | 
 |  |  |         left join ir_irrigate_group gru on gru.id = gu.group_id | 
 |  |  |         where uni.id = #{id,jdbcType=BIGINT} and uni.deleted = 0 | 
 |  |  |     </select> | 
 |  |  |     <!--分页查灌溉单元--> | 
 |  |  | 
 |  |  |         SELECT | 
 |  |  |         CAST(pro.id AS char)AS projectId, | 
 |  |  |         pro.project_name  AS  projectName, | 
 |  |  |         CAST(intake.id AS char)AS intakeId, | 
 |  |  |         intake.name  AS  intakeName, | 
 |  |  |         CAST(uni.id AS char)AS unitId, | 
 |  |  |         CAST(uni.operator AS char)AS operator, | 
 |  |  |         cli.name         AS operatorName, | 
 |  |  |         gru.group_code         AS groupCode, | 
 |  |  |         uni.area, | 
 |  |  |         uni.remarks, | 
 |  |  |         uni.operate_time  AS  operateDt | 
 |  |  |         FROM ir_irrigate_unit uni | 
 |  |  |         left join pr_intake intake on intake.id = uni.intake_id | 
 |  |  |         left join ir_project pro on pro.id = uni.project_id | 
 |  |  |         left join se_client cli on cli.id = uni.operator | 
 |  |  |         left join ir_group_unit gu on gu.unit_id = uni.id | 
 |  |  |         left join ir_irrigate_group gru on gru.id = gu.group_id | 
 |  |  |         <where> | 
 |  |  |             uni.deleted = 0 | 
 |  |  |             <if test="projectName != null and projectName != ''"> | 
 |  |  |                 AND pro.project_name LIKE CONCAT('%', #{projectName}, '%') | 
 |  |  |             </if> | 
 |  |  | <!--            <if test = "groupCode != null and groupCode != ''">--> | 
 |  |  | <!--                AND pro.project_state = #{groupCode}--> | 
 |  |  | <!--            </if>--> | 
 |  |  |             <if test = "groupCode != null and groupCode != ''"> | 
 |  |  |                 AND gru.group_code = #{groupCode} | 
 |  |  |             </if> | 
 |  |  |         </where> | 
 |  |  |         ORDER BY uni.operate_time DESC | 
 |  |  |         <if test="pageCurr != null and pageSize != null"> | 
 |  |  | 
 |  |  |     <select id="getRecordCount" resultType="java.lang.Long"> | 
 |  |  |         SELECT COUNT(*) AS recordCount | 
 |  |  |         FROM ir_irrigate_unit uni | 
 |  |  |         left join pr_intake intake on intake.id = uni.intake_id | 
 |  |  |         left join ir_project pro on pro.id = uni.project_id | 
 |  |  |         left join se_client cli on cli.id = uni.operator | 
 |  |  |         left join ir_group_unit gu on gu.unit_id = uni.id | 
 |  |  |         left join ir_irrigate_group gru on gru.id = gu.group_id | 
 |  |  |         <where> | 
 |  |  |             uni.deleted = 0 | 
 |  |  |             <if test="projectName != null and projectName != ''"> | 
 |  |  |                 AND pro.project_name LIKE CONCAT('%', #{projectName}, '%') | 
 |  |  |             </if> | 
 |  |  |             <!--            <if test = "groupCode != null and groupCode != ''">--> | 
 |  |  |             <!--                AND pro.project_state = #{groupCode}--> | 
 |  |  |             <!--            </if>--> | 
 |  |  |                         <if test = "groupCode != null and groupCode != ''"> | 
 |  |  |                             AND gru.group_code = #{groupCode} | 
 |  |  |                         </if> | 
 |  |  |         </where> | 
 |  |  |     </select> | 
 |  |  |  | 
 |  |  |     <!--根据灌溉单元ID获取取水口ID--> | 
 |  |  |     <select id="getIntakeIdByUnitId" resultType="java.lang.Long"> | 
 |  |  |         SELECT | 
 |  |  |             intake_id AS intakeId | 
 |  |  |         FROM ir_irrigate_unit | 
 |  |  |         WHERE deleted = 0 AND id = #{unitId} | 
 |  |  |     </select> | 
 |  |  | </mapper> |