<?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.OfficialManageDao" > <resultMap id="BaseResultMap" type="com.newfiber.api.pc.model.River.OfficialManage" > <id column="Serial" property="serial" jdbcType="BIGINT" /> <result column="Official_Name" property="officialName" jdbcType="NVARCHAR" /> <result column="River_No" property="riverNo" jdbcType="VARCHAR" /> <result column="Official_Type" property="officialType" jdbcType="INTEGER" /> <result column="Official_Content" property="officialContent" jdbcType="NVARCHAR" /> <result column="Official_File_No" property="officialFileNo" jdbcType="VARCHAR" /> <result column="Official_Secrecy" property="officialSecrecy" jdbcType="INTEGER" /> <result column="Create_User_No" property="createUserNo" jdbcType="VARCHAR" /> <result column="Update_User_No" property="updateUserNo" jdbcType="VARCHAR" /> <result column="Create_Time" property="createTime" jdbcType="TIMESTAMP" /> <result column="Update_Time" property="updateTime" jdbcType="TIMESTAMP" /> <result column="Browse_Number" property="browseNumber" jdbcType="INTEGER" /> </resultMap> <select id="selectOfficialManageList" resultType="com.newfiber.api.pc.model.River.OfficialManage" parameterType="com.newfiber.api.pc.model.River.OfficialManage" > select r.Serial serial,r.Official_Name officialName,r.River_No riverNo,r.Official_Type officialType,r.Official_Content officialContent, r.Official_Secrecy officialSecrecy,r.Official_File_No officialFileNo, r.Create_User_No createUserNo,r.Update_User_No updateUserNo,r.Browse_Number browseNumber, DATE_FORMAT(r.Create_Time,'%Y-%m-%d %T') time,DATE_FORMAT(r.Update_Time,'%Y-%m-%d %T') updateDateTime, i.River_Name riverName,f.Official_Type_Zn officialTypeZn,o.user_name 'createUserName',k.user_name 'updateUserName' from official_manage r inner join huludao_main.sys_user_info o on o.User_No = r.Create_User_No left join huludao_main.sys_user_info k on k.User_No = r.Update_User_No inner join river_info_basis i on i.River_No = r.River_No inner join official_classification f on f.Official_Type= r.Official_Type where 1=1 <if test="officialName != null and officialName != ''"> and r.Official_Name like '%${officialName}%' </if> <if test="officialType != null and officialType != -1"> and r.Official_Type = #{officialType,jdbcType=INTEGER} </if> <if test="createUserNo != null and createUserNo != ''"> and r.Create_User_No = #{createUserNo,jdbcType=INTEGER} </if> <if test="startTime != null"> and r.Create_Time between #{startTime} and #{endTime} </if> <if test="serial != null and serial != ''"> and r.Serial = #{serial,jdbcType=INTEGER} </if> <if test="sort != null"> ORDER BY ${sort} <if test="order != null"> ${order} </if> </if> <if test="sort == null"> ORDER BY r.Create_Time DESC </if> <if test="pageNo != null" > limit #{pageNo},#{pageSize} </if> </select> <delete id="deleteOfficialManage" parameterType="com.newfiber.api.pc.model.River.OfficialManage" > delete from official_manage where Serial = #{serial,jdbcType=INTEGER} </delete> <insert id="addOfficialManage" parameterType="com.newfiber.api.pc.model.River.OfficialManage" > insert into official_manage <trim prefix="(" suffix=")" suffixOverrides="," > <if test="officialName != null" > Official_Name, </if> <if test="riverNo != null" > River_No, </if> <if test="officialType != null" > Official_Type, </if> <if test="officialContent != null" > Official_Content, </if> <if test="officialFileNo != null" > Official_File_No, </if> <if test="officialSecrecy != null" > Official_Secrecy, </if> <if test="createUserNo != null" > Create_User_No, </if> <if test="browseNumber != null" > Browse_Number, </if> </trim> <trim prefix="values (" suffix=")" suffixOverrides="," > <if test="officialName != null" > #{officialName,jdbcType=NVARCHAR}, </if> <if test="riverNo != null" > #{riverNo,jdbcType=VARCHAR}, </if> <if test="officialType != null" > #{officialType,jdbcType=INTEGER}, </if> <if test="officialContent != null" > #{officialContent,jdbcType=NVARCHAR}, </if> <if test="officialFileNo != null" > #{officialFileNo,jdbcType=VARCHAR}, </if> <if test="officialSecrecy != null" > #{officialSecrecy,jdbcType=INTEGER}, </if> <if test="createUserNo != null" > #{createUserNo,jdbcType=VARCHAR}, </if> <if test="browseNumber != null" > #{browseNumber,jdbcType=INTEGER}, </if> </trim> </insert> <select id="countOfficialManage" parameterType="com.newfiber.api.pc.model.River.OfficialManage" resultType="java.lang.Integer" > select count(DISTINCT r.Serial) from official_manage r where 1=1 <if test="officialName != null and officialName != ''"> and r.Official_Name like '%${officialName}%' </if> <if test="officialType != null"> and r.Official_Type = #{officialType,jdbcType=INTEGER} </if> <if test="createUserNo != null and createUserNo != ''"> and r.Create_User_No = #{createUserNo,jdbcType=INTEGER} </if> <if test="startTime != null"> and r.Create_Time between #{startTime} and #{endTime} </if> </select> <update id="updateOfficialManage" parameterType="com.newfiber.api.pc.model.River.OfficialManage" > update official_manage <set > <if test="officialName != null" > Official_Name = #{officialName,jdbcType=NVARCHAR}, </if> <if test="officialType != null" > Official_Type = #{officialType,jdbcType=INTEGER}, </if> <if test="officialContent != null" > Official_Content = #{officialContent,jdbcType=NVARCHAR}, </if> <if test="officialFileNo != null" > Official_File_No = #{officialFileNo,jdbcType=VARCHAR}, </if> <if test="officialSecrecy != null" > Official_Secrecy = #{officialSecrecy,jdbcType=INTEGER}, </if> <if test="updateUserNo != null" > Update_User_No = #{updateUserNo,jdbcType=VARCHAR}, </if> <if test="updateTime != null" > Update_Time = #{updateTime,jdbcType=TIMESTAMP}, </if> </set> where Serial = #{serial,jdbcType=INTEGER} </update> <update id="updateOfficialManageByNumber" parameterType="com.newfiber.api.pc.model.River.OfficialManage" > update official_manage <set > <if test="browseNumber != null" > Browse_Number = #{browseNumber,jdbcType=INTEGER}, </if> </set> where Serial = #{serial,jdbcType=INTEGER} </update> <select id="selectOfficialManageByNumber" resultType="com.newfiber.api.pc.model.River.OfficialManage" parameterType="com.newfiber.api.pc.model.River.OfficialManage"> select Browse_Number browseNumber from official_manage where Serial = #{serial,jdbcType=INTEGER} </select> <select id="selectNextOfficialManage" resultType="com.newfiber.api.pc.model.River.OfficialManage" parameterType="com.newfiber.api.pc.model.River.OfficialManage"> select DISTINCT m.Serial serial,m.Official_File_No officialFileNo,b.River_Name riverName,m.Browse_Number browseNumber,m.Serial serial, i.user_name 'createUserName' from official_manage m inner join huludao_main.sys_user_info i on i.User_No = m.Create_User_No inner join river_info_basis b on b.River_No = m.River_No where 1=1 <if test="listString != null and listString.size > 0"> and m.Create_User_No in <foreach collection="listString" index="index" item="item" open="(" separator="," close=")"> #{item} </foreach> </if> <if test="startTime != null"> and m.Create_Time between #{startTime} and #{endTime} </if> <if test="riverGrade != null"> and b.River_Grade = #{riverGrade,jdbcType=INTEGER} </if> <if test="pageNo != null" > order by m.Serial limit #{pageNo},#{pageSize} </if> </select> <select id="selectNextOfficialManageCount" parameterType="com.newfiber.api.pc.model.River.OfficialManage" resultType="java.lang.Integer"> select count(DISTINCT m.Serial) from official_manage m inner join huludao_main.sys_user_info i on i.User_No = m.Create_User_No inner join river_info_basis b on b.River_No = m.River_No where 1=1 <if test="listString != null and listString.size > 0"> and m.Create_User_No in <foreach collection="listString" index="index" item="item" open="(" separator="," close=")"> #{item} </foreach> </if> <if test="startTime != null"> and m.Create_Time between #{startTime} and #{endTime} </if> <if test="riverGrade != null"> and b.River_Grade = #{riverGrade,jdbcType=INTEGER} </if> </select> </mapper>