<?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.dhcc.finance.main.dao.CwGlInitbuildTempMapper">
  <resultMap id="BaseResultMap" type="com.dhcc.finance.main.domain.CwGlInitbuildTemp">
    <result column="PK_GLORGBOOK" jdbcType="VARCHAR" property="pkGlorgbook" />
    <result column="PERIOD" jdbcType="VARCHAR" property="period" />
    <result column="PK_SUBJTYPE" jdbcType="VARCHAR" property="pkSubjtype" />
    <result column="PK_ACCSUBJ" jdbcType="VARCHAR" property="pkAccsubj" />
    <result column="SUBJCODE" jdbcType="VARCHAR" property="subjcode" />
    <result column="SUBJNAME" jdbcType="VARCHAR" property="subjname" />
    <result column="BALANORIENT" jdbcType="VARCHAR" property="balanorient" />
    <result column="PK_CURRTYPE" jdbcType="VARCHAR" property="pkCurrtype" />
    <result column="CHECKTYPE" jdbcType="VARCHAR" property="checktype" />
    <result column="CHECKVALUE" jdbcType="VARCHAR" property="checkvalue" />
    <result column="INITAMOUNT" jdbcType="DECIMAL" property="initamount" />
    <result column="USE_STATE" jdbcType="VARCHAR" property="useState" />
    <result column="CREATE_USER" jdbcType="VARCHAR" property="createUser" />
    <result column="CREATE_TIME" jdbcType="TIMESTAMP" property="createTime" />
    <result column="UPDATE_USER" jdbcType="VARCHAR" property="updateUser" />
    <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" />
    <result column="REMARK" jdbcType="VARCHAR" property="remark" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause">
    <where>
      <foreach collection="example.oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    PK_GLORGBOOK, PERIOD, PK_SUBJTYPE, PK_ACCSUBJ, SUBJCODE, SUBJNAME, BALANORIENT, PK_CURRTYPE, 
    CHECKTYPE, CHECKVALUE, INITAMOUNT, USE_STATE, CREATE_USER, CREATE_TIME, UPDATE_USER, 
    UPDATE_TIME, REMARK
  </sql>
  <select id="selectByExample" parameterType="com.dhcc.finance.main.domain.CwGlInitbuildTempExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from cw_gl_initbuild_temp
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <delete id="deleteByExample" parameterType="com.dhcc.finance.main.domain.CwGlInitbuildTempExample">
    delete from cw_gl_initbuild_temp
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.dhcc.finance.main.domain.CwGlInitbuildTemp">
    insert into cw_gl_initbuild_temp (PK_GLORGBOOK, PERIOD, PK_SUBJTYPE, 
      PK_ACCSUBJ, SUBJCODE, SUBJNAME, 
      BALANORIENT, PK_CURRTYPE, CHECKTYPE, 
      CHECKVALUE, INITAMOUNT, USE_STATE, 
      CREATE_USER, CREATE_TIME, UPDATE_USER, 
      UPDATE_TIME, REMARK)
    values (#{pkGlorgbook,jdbcType=VARCHAR}, #{period,jdbcType=VARCHAR}, #{pkSubjtype,jdbcType=VARCHAR}, 
      #{pkAccsubj,jdbcType=VARCHAR}, #{subjcode,jdbcType=VARCHAR}, #{subjname,jdbcType=VARCHAR}, 
      #{balanorient,jdbcType=VARCHAR}, #{pkCurrtype,jdbcType=VARCHAR}, #{checktype,jdbcType=VARCHAR}, 
      #{checkvalue,jdbcType=VARCHAR}, #{initamount,jdbcType=DECIMAL}, #{useState,jdbcType=VARCHAR}, 
      #{createUser,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateUser,jdbcType=VARCHAR}, 
      #{updateTime,jdbcType=TIMESTAMP}, #{remark,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.dhcc.finance.main.domain.CwGlInitbuildTemp">
    insert into cw_gl_initbuild_temp
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="pkGlorgbook != null">
        PK_GLORGBOOK,
      </if>
      <if test="period != null">
        PERIOD,
      </if>
      <if test="pkSubjtype != null">
        PK_SUBJTYPE,
      </if>
      <if test="pkAccsubj != null">
        PK_ACCSUBJ,
      </if>
      <if test="subjcode != null">
        SUBJCODE,
      </if>
      <if test="subjname != null">
        SUBJNAME,
      </if>
      <if test="balanorient != null">
        BALANORIENT,
      </if>
      <if test="pkCurrtype != null">
        PK_CURRTYPE,
      </if>
      <if test="checktype != null">
        CHECKTYPE,
      </if>
      <if test="checkvalue != null">
        CHECKVALUE,
      </if>
      <if test="initamount != null">
        INITAMOUNT,
      </if>
      <if test="useState != null">
        USE_STATE,
      </if>
      <if test="createUser != null">
        CREATE_USER,
      </if>
      <if test="createTime != null">
        CREATE_TIME,
      </if>
      <if test="updateUser != null">
        UPDATE_USER,
      </if>
      <if test="updateTime != null">
        UPDATE_TIME,
      </if>
      <if test="remark != null">
        REMARK,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="pkGlorgbook != null">
        #{pkGlorgbook,jdbcType=VARCHAR},
      </if>
      <if test="period != null">
        #{period,jdbcType=VARCHAR},
      </if>
      <if test="pkSubjtype != null">
        #{pkSubjtype,jdbcType=VARCHAR},
      </if>
      <if test="pkAccsubj != null">
        #{pkAccsubj,jdbcType=VARCHAR},
      </if>
      <if test="subjcode != null">
        #{subjcode,jdbcType=VARCHAR},
      </if>
      <if test="subjname != null">
        #{subjname,jdbcType=VARCHAR},
      </if>
      <if test="balanorient != null">
        #{balanorient,jdbcType=VARCHAR},
      </if>
      <if test="pkCurrtype != null">
        #{pkCurrtype,jdbcType=VARCHAR},
      </if>
      <if test="checktype != null">
        #{checktype,jdbcType=VARCHAR},
      </if>
      <if test="checkvalue != null">
        #{checkvalue,jdbcType=VARCHAR},
      </if>
      <if test="initamount != null">
        #{initamount,jdbcType=DECIMAL},
      </if>
      <if test="useState != null">
        #{useState,jdbcType=VARCHAR},
      </if>
      <if test="createUser != null">
        #{createUser,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateUser != null">
        #{updateUser,jdbcType=VARCHAR},
      </if>
      <if test="updateTime != null">
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="remark != null">
        #{remark,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.dhcc.finance.main.domain.CwGlInitbuildTempExample" resultType="java.lang.Long">
    select count(*) from cw_gl_initbuild_temp
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update cw_gl_initbuild_temp
    <set>
      <if test="record.pkGlorgbook != null">
        PK_GLORGBOOK = #{record.pkGlorgbook,jdbcType=VARCHAR},
      </if>
      <if test="record.period != null">
        PERIOD = #{record.period,jdbcType=VARCHAR},
      </if>
      <if test="record.pkSubjtype != null">
        PK_SUBJTYPE = #{record.pkSubjtype,jdbcType=VARCHAR},
      </if>
      <if test="record.pkAccsubj != null">
        PK_ACCSUBJ = #{record.pkAccsubj,jdbcType=VARCHAR},
      </if>
      <if test="record.subjcode != null">
        SUBJCODE = #{record.subjcode,jdbcType=VARCHAR},
      </if>
      <if test="record.subjname != null">
        SUBJNAME = #{record.subjname,jdbcType=VARCHAR},
      </if>
      <if test="record.balanorient != null">
        BALANORIENT = #{record.balanorient,jdbcType=VARCHAR},
      </if>
      <if test="record.pkCurrtype != null">
        PK_CURRTYPE = #{record.pkCurrtype,jdbcType=VARCHAR},
      </if>
      <if test="record.checktype != null">
        CHECKTYPE = #{record.checktype,jdbcType=VARCHAR},
      </if>
      <if test="record.checkvalue != null">
        CHECKVALUE = #{record.checkvalue,jdbcType=VARCHAR},
      </if>
      <if test="record.initamount != null">
        INITAMOUNT = #{record.initamount,jdbcType=DECIMAL},
      </if>
      <if test="record.useState != null">
        USE_STATE = #{record.useState,jdbcType=VARCHAR},
      </if>
      <if test="record.createUser != null">
        CREATE_USER = #{record.createUser,jdbcType=VARCHAR},
      </if>
      <if test="record.createTime != null">
        CREATE_TIME = #{record.createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.updateUser != null">
        UPDATE_USER = #{record.updateUser,jdbcType=VARCHAR},
      </if>
      <if test="record.updateTime != null">
        UPDATE_TIME = #{record.updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.remark != null">
        REMARK = #{record.remark,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update cw_gl_initbuild_temp
    set PK_GLORGBOOK = #{record.pkGlorgbook,jdbcType=VARCHAR},
      PERIOD = #{record.period,jdbcType=VARCHAR},
      PK_SUBJTYPE = #{record.pkSubjtype,jdbcType=VARCHAR},
      PK_ACCSUBJ = #{record.pkAccsubj,jdbcType=VARCHAR},
      SUBJCODE = #{record.subjcode,jdbcType=VARCHAR},
      SUBJNAME = #{record.subjname,jdbcType=VARCHAR},
      BALANORIENT = #{record.balanorient,jdbcType=VARCHAR},
      PK_CURRTYPE = #{record.pkCurrtype,jdbcType=VARCHAR},
      CHECKTYPE = #{record.checktype,jdbcType=VARCHAR},
      CHECKVALUE = #{record.checkvalue,jdbcType=VARCHAR},
      INITAMOUNT = #{record.initamount,jdbcType=DECIMAL},
      USE_STATE = #{record.useState,jdbcType=VARCHAR},
      CREATE_USER = #{record.createUser,jdbcType=VARCHAR},
      CREATE_TIME = #{record.createTime,jdbcType=TIMESTAMP},
      UPDATE_USER = #{record.updateUser,jdbcType=VARCHAR},
      UPDATE_TIME = #{record.updateTime,jdbcType=TIMESTAMP},
      REMARK = #{record.remark,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
   <!-- 批量插入 -->
  <insert id="batchInsertCwGlInitbuildTemp" parameterType="java.util.Map">
        insert into cw_gl_initbuild_temp (PK_GLORGBOOK, PERIOD, PK_SUBJTYPE, 
      PK_ACCSUBJ, SUBJCODE, SUBJNAME, 
      BALANORIENT, PK_CURRTYPE, CHECKTYPE, 
      CHECKVALUE, INITAMOUNT, USE_STATE, 
      CREATE_USER, CREATE_TIME, UPDATE_USER, 
      UPDATE_TIME, REMARK)
      values 
        <foreach collection="cwGlInitbuildTempList" item="item" index="index" separator=",">
       (#{cwGlInitbuildTemp.pkGlorgbook,jdbcType=VARCHAR}, 
       #{cwGlInitbuildTemp.period,jdbcType=VARCHAR},
       #{item.pkSubjtype,jdbcType=VARCHAR},
      #{item.pkAccsubj,jdbcType=VARCHAR},
      #{item.subjcode,jdbcType=VARCHAR}, 
      #{item.subjname,jdbcType=VARCHAR},
      #{item.balanorient,jdbcType=VARCHAR}, 
      #{cwGlInitbuildTemp.pkCurrtype,jdbcType=VARCHAR}, 
      #{item.checktype,jdbcType=VARCHAR},
      #{item.checkvalue,jdbcType=VARCHAR},
      #{item.initamount,jdbcType=DECIMAL}, 
      #{cwGlInitbuildTemp.useState,jdbcType=VARCHAR},
      #{cwGlInitbuildTemp.createUser,jdbcType=VARCHAR}, 
      #{cwGlInitbuildTemp.createTime,jdbcType=TIMESTAMP}, 
      #{item.updateUser,jdbcType=VARCHAR},
      #{item.updateTime,jdbcType=TIMESTAMP}, 
      #{item.remark,jdbcType=VARCHAR}
      )
        </foreach>
    </insert>
</mapper>