<?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.RiverPolicyDao" > <resultMap id="BaseResultMap" type="com.newfiber.api.pc.model.River.RiverPolicy" > <id column="Serial" property="serial" jdbcType="BIGINT" /> <result column="Policy_No" property="policyNo" jdbcType="VARCHAR" /> <result column="Policy_Content" property="policyContent" jdbcType="NVARCHAR" /> <result column="Publish_Time" property="publishTime" jdbcType="TIMESTAMP" /> <result column="River_No" property="riverNo" jdbcType="VARCHAR" /> <result column="Create_User_No" property="createUserNo" jdbcType="VARCHAR"/> </resultMap> <select id="selectRiverPolicyList" resultType="com.newfiber.api.pc.model.River.RiverPolicy" parameterType="com.newfiber.api.pc.model.River.RiverPolicy" > select r.Serial serial,r.Policy_No policyNo,r.Policy_Content policyContent,DATE_FORMAT(r.Publish_Time,'%Y-%m-%d %T') time,r.River_No riverNo, r.Create_User_No createUserNo,b.River_Name riverName,r.File_No fileNo,r.Offical_File_No officalFileNo, o.user_name createUserName from river_policy 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.Create_User_No where 1=1 <if test="policyNo != null and policyNo != ''"> and r.Policy_No = #{policyNo,jdbcType=VARCHAR} </if> <if test="riverNo != null and riverNo != ''"> and r.River_No = #{riverNo,jdbcType=VARCHAR} </if> <if test="pageNo != null" > order by r.Serial limit #{pageNo} , #{pageSize} </if> </select> <delete id="deleteRiverPolicy" parameterType="java.util.List" > delete from river_policy where Policy_No in <foreach collection="policyNo" index="index" item="item" open="(" separator="," close=")"> #{item} </foreach> </delete> <insert id="addRiverPolicy" parameterType="com.newfiber.api.pc.model.River.RiverPolicy" > insert into river_policy <trim prefix="(" suffix=")" suffixOverrides="," > <if test="policyContent != null" > Policy_Content, </if> <if test="riverNo != null" > River_No, </if> <if test="createUserNo != null" > Create_User_No, </if> <if test="policyNo != null" > Policy_No, </if> <if test="fileNo != null" > File_No, </if> <if test="officalFileNo != null" > Offical_File_No, </if> </trim> <trim prefix="values (" suffix=")" suffixOverrides="," > <if test="policyContent != null" > #{policyContent,jdbcType=NVARCHAR}, </if> <if test="riverNo != null" > #{riverNo,jdbcType=VARCHAR}, </if> <if test="createUserNo != null" > #{createUserNo,jdbcType=VARCHAR}, </if> <if test="policyNo != null" > #{policyNo,jdbcType=VARCHAR}, </if> <if test="fileNo != null" > #{fileNo,jdbcType=VARCHAR}, </if> <if test="officalFileNo != null" > #{officalFileNo,jdbcType=VARCHAR}, </if> </trim> </insert> <select id="countRiverPolicyList" parameterType="com.newfiber.api.pc.model.River.RiverPolicy" resultType="java.lang.Integer" > select count(DISTINCT r.Serial) from river_policy 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.Create_User_No where 1=1 <if test="policyNo != null and policyNo != ''"> and r.Policy_No = #{policyNo,jdbcType=VARCHAR} </if> <if test="riverNo != null and riverNo != ''"> and r.River_No = #{riverNo,jdbcType=VARCHAR} </if> </select> <update id="updateRiverPolicy" parameterType="com.newfiber.api.pc.model.River.RiverPolicy" > update river_policy <set > <if test="policyContent != null" > Policy_Content = #{policyContent,jdbcType=NVARCHAR}, </if> <if test="fileNo != null" > File_No = #{fileNo,jdbcType=VARCHAR}, </if> <if test="officalFileNo != null" > Offical_File_No = #{officalFileNo,jdbcType=VARCHAR}, </if> </set> where Policy_No = #{policyNo,jdbcType=VARCHAR} </update> <select id="selectRiverPolicyNos" resultType="com.newfiber.api.pc.model.River.RiverPolicy" parameterType="com.newfiber.api.pc.model.River.RiverPolicy"> select r.Policy_No policyNo from river_policy r inner join river_info_basis b on b.River_No = r.River_No inner join river_chief c on c.River_No = r.River_No where c.Chief_User_No = #{chiefUserNo,jdbcType=VARCHAR} </select> <select id="selectRiverPolicyNoByPolicyNos" resultType="com.newfiber.api.pc.model.River.RiverPolicy" parameterType="com.newfiber.api.pc.model.River.RiverPolicy"> select r.Serial serial,r.Policy_No policyNo,r.Policy_Content policyContent,DATE_FORMAT(r.Publish_Time,'%Y-%m-%d %T') time,r.River_No riverNo, r.Create_User_No createUserNo,b.River_Name riverName,r.File_No fileNo,r.Offical_File_No officalFileNo, o.user_name 'createUserName' from river_policy 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.Create_User_No where 1=1 <if test="list != null and list.size > 0"> and r.Policy_No in <foreach collection="list" index="index" item="item" open="(" separator="," close=")"> #{item} </foreach> </if> <if test="pageNo != null" > order by r.Serial limit #{pageNo},#{pageSize} </if> </select> <select id="selectPolicyByRiverNo" resultMap="BaseResultMap" parameterType="com.newfiber.api.pc.model.River.RiverPolicy"> select policy_No from river_policy where River_No = #{riverNo,jdbcType=VARCHAR} </select> </mapper>