Newer
Older
huludao / src / main / resources / mapper / RiverManage / OfficialFileDao.xml
<?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.OfficialFileDao" >
  <resultMap id="BaseResultMap" type="com.newfiber.api.pc.model.River.OfficialFile" >
    <id column="Serial" jdbcType="BIGINT" property="serial" />
    <result column="Official_File_No" jdbcType="VARCHAR" property="officialFileNo" />
    <result column="Official_Name" jdbcType="VARCHAR" property="officialName" />
    <result column="Official_File_Address" jdbcType="VARCHAR" property="officialFileAddress" />
    <result column="Create_User_No" jdbcType="VARCHAR" property="createUserNo" />
    <result column="Create_Time" jdbcType="TIMESTAMP" property="createTime" />
  </resultMap>

  <sql id="Base_Column_List">
    Serial, Official_File_No, Official_Name, Official_File_Address, Create_User_No, Create_Time
  </sql>

  <select id="selectOfficialFileList" resultMap="BaseResultMap" parameterType="com.newfiber.api.pc.model.River.OfficialFile" >
    select
    <include refid="Base_Column_List" />
    from official_file r
    where 1=1
    and r.Official_File_No = #{officialFileNo,jdbcType=VARCHAR}
  </select>

  <delete id="deleteOfficialFile" parameterType="java.util.List" >
    delete from official_file
    where Official_File_No in
    <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
      #{item}
    </foreach>
  </delete>

  <insert id="addOfficialFile" parameterType="com.newfiber.api.pc.model.River.OfficialFile" >
    insert into official_file
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="officialFileNo != null" >
        Official_File_No,
      </if>
      <if test="officialFileName != null" >
        Official_Name,
      </if>
      <if test="officialFileAddress != null" >
        Official_File_Address,
      </if>
      <if test="createUserNo != null" >
        Create_User_No,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="officialFileNo != null" >
        #{officialFileNo,jdbcType=VARCHAR},
      </if>
      <if test="officialFileName != null" >
        #{officialFileName,jdbcType=NVARCHAR},
      </if>
      <if test="officialFileAddress != null" >
        #{officialFileAddress,jdbcType=NVARCHAR},
      </if>
      <if test="createUserNo != null" >
        #{createUserNo,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>

  <select id="countOfficialFile" parameterType="com.newfiber.api.pc.model.River.OfficialFile" resultType="java.lang.Integer" >
    select count(DISTINCT r.Serial)
      from official_file r
      where 1=1
      <if test="officialFileNo != null" >
        and r.Official_File_No = #{officialFileNo,jdbcType=VARCHAR}
      </if>
  </select>

  <update id="updateOfficialFile" parameterType="com.newfiber.api.pc.model.River.OfficialFile" >
    update official_file
    <set >
      <if test="officialName != null" >
        Official_Name = #{officialName,jdbcType=NVARCHAR},
      </if>
      <if test="officialFileAddress != null" >
        Official_Address = #{officialFileAddress,jdbcType=NVARCHAR},
      </if>
      <if test="createUserNo != null" >
        Create_User_No = #{createUserNo,jdbcType=VARCHAR},
      </if>
    </set>
    where Official_File_No = #{officialFileNo,jdbcType=VARCHAR}
  </update>

  <insert id="insertSelective" useGeneratedKeys="true" keyProperty="serial"  parameterType="com.newfiber.api.pc.model.River.OfficialFile">
    insert into official_file
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="serial != null">
        Serial,
      </if>
      <if test="officialFileNo != null">
        Official_File_No,
      </if>
      <if test="officialName != null">
        Official_Name,
      </if>
      <if test="officialFileAddress != null">
        Official_File_Address,
      </if>
      <if test="createUserNo != null">
        Create_User_No,
      </if>
      <if test="createTime != null">
        Create_Time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="serial != null">
        #{serial,jdbcType=BIGINT},
      </if>
      <if test="officialFileNo != null">
        #{officialFileNo,jdbcType=VARCHAR},
      </if>
      <if test="officialName != null">
        #{officialName,jdbcType=VARCHAR},
      </if>
      <if test="officialFileAddress != null">
        #{officialFileAddress,jdbcType=VARCHAR},
      </if>
      <if test="createUserNo != null">
        #{createUserNo,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>

  <update id="updateSelective" parameterType="com.newfiber.api.pc.model.River.OfficialFile">
    update official_file
    <set>
      <if test="officialFileNo != null">
        Official_File_No = #{officialFileNo,jdbcType=VARCHAR},
      </if>
      <if test="officialName != null">
        Official_Name = #{officialName,jdbcType=VARCHAR},
      </if>
      <if test="officialFileAddress != null">
        Official_File_Address = #{officialFileAddress,jdbcType=VARCHAR},
      </if>
      <if test="createUserNo != null">
        Create_User_No = #{createUserNo,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        Create_Time = #{createTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where Serial = #{serial,jdbcType=BIGINT}
  </update>

</mapper>