<?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.newfiber.api.pc.dao.RiverManage.RiverChiefDao" > <resultMap id="BaseResultMap" type="com.newfiber.api.pc.model.River.RiverChief" > <id column="Serial" property="serial" jdbcType="BIGINT" /> <result column="Chief_User_No" property="chiefUserNo" jdbcType="VARCHAR" /> <result column="Chief_Grade" property="chiefGrade" jdbcType="INTEGER" /> <result column="Chief_Grade_Zn" property="chiefGradeZn" jdbcType="NVARCHAR" /> <result column="Create_Time" property="createTime" jdbcType="TIMESTAMP" /> <result column="River_No" property="riverNo" jdbcType="VARCHAR" /> </resultMap> <select id="selectRiverChiefList" resultMap="BaseResultMap" parameterType="com.newfiber.api.pc.model.River.RiverChief" > select r.Serial serial,r.Chief_User_No chiefUserNo,r.Chief_Grade chiefGrade,r.Chief_Grade_Zn chiefGradeZn,r.Chief_Duty chiefDuty, DATE_FORMAT(r.Create_Time,'%Y-%m-%d %T') time,r.River_No riverNo, b.River_Name riverName, o.user_name 'chiefUserName' from river_chief r inner join river_info_basis b on b.River_No = r.River_No inner join huludao_main.sys_user_info o on o.User_No = r.Chief_User_No where 1=1 <if test="chiefUserNo != null and chiefUserNo != ''"> and r.Chief_User_No = #{chiefUserNo,jdbcType=VARCHAR} </if> <if test="chiefGrade != null and chiefGrade != ''"> and r.Chief_Grade = #{chiefGrade,jdbcType=INTEGER} </if> <if test="pageNo != null" > order by r.Serial limit #{pageNo} ,#{pageSize} </if> </select> <delete id="deleteRiverChief" parameterType="com.newfiber.api.pc.model.River.RiverChief" > delete from river_chief where River_No = #{riverNo,jdbcType=VARCHAR} </delete> <insert id="addRiverChief" parameterType="com.newfiber.api.pc.model.River.RiverChief" > insert into river_chief <trim prefix="(" suffix=")" suffixOverrides="," > <if test="chiefUserNo != null" > Chief_User_No, </if> <if test="chiefGrade != null" > Chief_Grade, </if> <if test="chiefGradeZn != null" > Chief_Grade_Zn, </if> <if test="chiefDuty != null" > Chief_Duty, </if> <if test="riverNo != null" > River_No, </if> </trim> <trim prefix="values (" suffix=")" suffixOverrides="," > <if test="chiefUserNo != null" > #{chiefUserNo,jdbcType=VARCHAR}, </if> <if test="chiefGrade != null" > #{chiefGrade,jdbcType=INTEGER}, </if> <if test="chiefGradeZn != null" > #{chiefGradeZn,jdbcType=NVARCHAR}, </if> <if test="chiefDuty != null" > #{chiefDuty,jdbcType=NVARCHAR}, </if> <if test="riverNo != null" > #{riverNo,jdbcType=VARCHAR}, </if> </trim> </insert> <select id="countRiverChiefList" parameterType="com.newfiber.api.pc.model.River.RiverChief" resultType="java.lang.Integer" > select count(DISTINCT r.Serial) from river_chief r inner join river_info_basis b on b.River_No = r.River_No inner join huludao_main.sys_user_info o on o.User_No = r.Chief_User_No where 1=1 <if test="chiefUserNo != null and chiefUserNo != ''"> and r.Chief_User_No = #{chiefUserNo,jdbcType=VARCHAR} </if> <if test="chiefGrade != null and chiefGrade != ''"> and r.Chief_Grade = #{chiefGrade,jdbcType=INTEGER} </if> </select> <update id="updateRiverChief" parameterType="com.newfiber.api.pc.model.River.RiverChief" > update river_chief <set > <if test="chiefGrade != null" > Chief_Grade = #{chiefGrade,jdbcType=VARCHAR}, </if> <if test="chiefGradeZn != null" > Chief_Grade_Zn = #{chiefGradeZn,jdbcType=NVARCHAR}, </if> <if test="chiefDuty != null" > Chief_Duty = #{chiefDuty,jdbcType=NVARCHAR}, </if> <if test="chiefUserNo != null" > Chief_User_No = #{chiefUserNo,jdbcType=VARCHAR}, </if> </set> where River_No = #{riverNo,jdbcType=VARCHAR} </update> <select id="countRiverChiefTotal" parameterType="com.newfiber.api.pc.model.River.RiverChief" resultType="java.lang.Integer"> select count(DISTINCT Serial) from river_chief where Chief_Grade = #{chiefGrade,jdbcType=INTEGER} </select> <select id="countRiverChief" parameterType="java.lang.String" resultType="java.lang.Integer"> select count(DISTINCT r.Serial) from river_chief r INNER JOIN huludao_main.sys_user_info s on r.Chief_User_No=s.User_No INNER JOIN huludao_main.sys_user_org o on o.User_No=s.User_No INNER JOIN division_org_manage d on d.Org_No=o.Org_No INNER JOIN administrative_division a on a.Division_No=d.Division_No where a.Division_No=#{divisionNo} </select> <select id="selectGradeByUserNo" parameterType="com.newfiber.api.pc.model.River.RiverChief" resultType="com.newfiber.api.pc.model.River.RiverChief"> select r.Chief_Grade chiefGrade, r.River_No riverNo from river_chief r where r.Chief_User_No = #{chiefUserNo,jdbcType=VARCHAR} </select> <select id="selectRiverNoByListUserNo" parameterType="com.newfiber.api.pc.model.River.RiverChief" resultType="com.newfiber.api.pc.model.River.RiverChief"> select r.River_No riverNo from river_chief r inner join river_info_basis b on b.River_No = r.River_No where 1=1 <if test="list != null and list.size > 0"> and r.Chief_User_No in <foreach collection="list" index="index" item="item" open="(" separator="," close=")"> #{item} </foreach> </if> <if test="riverGrade != null and riverGrade != ''"> and b.River_Grade = #{riverGrade,jdbcType=INTEGER} </if> </select> <select id="selectRiverChiefByRiverNo" resultMap="BaseResultMap" parameterType="com.newfiber.api.pc.model.River.RiverChief"> select r.Serial serial,r.Chief_User_No chiefUserNo,r.Chief_Grade chiefGrade,r.Chief_Grade_Zn chiefGradeZn,r.Chief_Duty chiefDuty from river_chief r where r.River_No = #{riverNo,jdbcType=VARCHAR} </select> <select id="getSubRiverChief" parameterType="String" resultType="String"> select distinct c.Chief_User_No from river_chief c,river_info_basis d where c.River_No = d.River_No and exists( select * from river_chief a,river_info_basis b where a.River_No = b.River_No and Chief_User_No = #{userNo} and b.River_No = d.Parent_River_No ) </select> <select id="getSubRiverChiefObj" parameterType="String" resultType="com.newfiber.api.pc.model.UserManager.SysUserInfo"> select distinct u.User_No userNo,u.user_name userName from river_chief c,river_info_basis d,huludao_main.sys_user_info u where c.River_No = d.River_No and c.Chief_User_No = u.User_No and exists( select * from river_chief a,river_info_basis b where a.River_No = b.River_No and Chief_User_No = #{userNo} and b.River_No = d.Parent_River_No ) </select> <!-- 获取河长信息基础表列表 --> <select id="queryRiverNoByChiefUserNo" resultType="java.lang.String" parameterType="java.lang.String"> select River_No riverNo from river_chief where Chief_User_No = #{chiefUserNo,jdbcType=VARCHAR} </select> </mapper>