<?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.CwHsOutcwZqxxMapper">
   <resultMap id="BaseResultMap" type="com.dhcc.finance.main.domain.CwHsOutcwZqxx">
    <id column="L_ZQNM" jdbcType="INTEGER" property="lZqnm" />
    <result column="VC_ZQDM" jdbcType="VARCHAR" property="vcZqdm" />
    <result column="VC_ZQJC" jdbcType="VARCHAR" property="vcZqjc" />
    <result column="L_SCLB" jdbcType="INTEGER" property="lSclb" />
    <result column="L_ZQLB" jdbcType="INTEGER" property="lZqlb" />
    <result column="L_IMPORT_FLAG" jdbcType="INTEGER" property="lImportFlag" />
    <result column="VC_IMPORT_DESCRIBE" jdbcType="VARCHAR" property="vcImportDescribe" />
    <result column="L_FLAG" jdbcType="INTEGER" property="lFlag" />
    <result column="VC_YYZQLB" jdbcType="VARCHAR" property="vcYyzqlb" />
    <result column="VC_YYSCLB" jdbcType="VARCHAR" property="vcYysclb" />
    <result column="DR" jdbcType="INTEGER" property="dr" />
    <result column="TS" jdbcType="VARCHAR" property="ts" />
    <result column="L_ZQLBMX2" jdbcType="INTEGER" property="lZqlbmx2" />
    <result column="L_ZQLBMX1" jdbcType="INTEGER" property="lZqlbmx1" />
  </resultMap>
    <resultMap id="BaseResultMap1" type="com.dhcc.finance.main.model.CwHsOutcwZqxxWeb">
    <id column="VC_ZQDM" jdbcType="VARCHAR" property="vcZqdm" />
    <result column="VC_ZQJC" jdbcType="VARCHAR" property="vcZqjc" />
  </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">
    L_ZQNM, VC_ZQDM, VC_ZQJC, L_SCLB, L_ZQLB, L_IMPORT_FLAG, VC_IMPORT_DESCRIBE, L_FLAG, 
    VC_YYZQLB, VC_YYSCLB, DR, TS, L_ZQLBMX2, L_ZQLBMX1
  </sql>
  <select id="selectByExample" parameterType="com.dhcc.finance.main.domain.CwHsOutcwZqxxExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from cw_hs_outcw_zqxx
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from cw_hs_outcw_zqxx
    where L_ZQNM = #{lZqnm,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from cw_hs_outcw_zqxx
    where L_ZQNM = #{lZqnm,jdbcType=INTEGER}
  </delete>
  <delete id="deleteByExample" parameterType="com.dhcc.finance.main.domain.CwHsOutcwZqxxExample">
    delete from cw_hs_outcw_zqxx
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.dhcc.finance.main.domain.CwHsOutcwZqxx">
    insert into cw_hs_outcw_zqxx (L_ZQNM, VC_ZQDM, VC_ZQJC, 
      L_SCLB, L_ZQLB, L_IMPORT_FLAG, 
      VC_IMPORT_DESCRIBE, L_FLAG, VC_YYZQLB, 
      VC_YYSCLB, DR, TS, L_ZQLBMX2, 
      L_ZQLBMX1)
    values (#{lZqnm,jdbcType=INTEGER}, #{vcZqdm,jdbcType=VARCHAR}, #{vcZqjc,jdbcType=VARCHAR}, 
      #{lSclb,jdbcType=INTEGER}, #{lZqlb,jdbcType=INTEGER}, #{lImportFlag,jdbcType=INTEGER}, 
      #{vcImportDescribe,jdbcType=VARCHAR}, #{lFlag,jdbcType=INTEGER}, #{vcYyzqlb,jdbcType=VARCHAR}, 
      #{vcYysclb,jdbcType=VARCHAR}, #{dr,jdbcType=INTEGER}, #{ts,jdbcType=VARCHAR}, #{lZqlbmx2,jdbcType=INTEGER}, 
      #{lZqlbmx1,jdbcType=INTEGER})
  </insert>
  <insert id="insertSelective" parameterType="com.dhcc.finance.main.domain.CwHsOutcwZqxx">
    insert into cw_hs_outcw_zqxx
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="lZqnm != null">
        L_ZQNM,
      </if>
      <if test="vcZqdm != null">
        VC_ZQDM,
      </if>
      <if test="vcZqjc != null">
        VC_ZQJC,
      </if>
      <if test="lSclb != null">
        L_SCLB,
      </if>
      <if test="lZqlb != null">
        L_ZQLB,
      </if>
      <if test="lImportFlag != null">
        L_IMPORT_FLAG,
      </if>
      <if test="vcImportDescribe != null">
        VC_IMPORT_DESCRIBE,
      </if>
      <if test="lFlag != null">
        L_FLAG,
      </if>
      <if test="vcYyzqlb != null">
        VC_YYZQLB,
      </if>
      <if test="vcYysclb != null">
        VC_YYSCLB,
      </if>
      <if test="dr != null">
        DR,
      </if>
      <if test="ts != null">
        TS,
      </if>
      <if test="lZqlbmx2 != null">
        L_ZQLBMX2,
      </if>
      <if test="lZqlbmx1 != null">
        L_ZQLBMX1,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="lZqnm != null">
        #{lZqnm,jdbcType=INTEGER},
      </if>
      <if test="vcZqdm != null">
        #{vcZqdm,jdbcType=VARCHAR},
      </if>
      <if test="vcZqjc != null">
        #{vcZqjc,jdbcType=VARCHAR},
      </if>
      <if test="lSclb != null">
        #{lSclb,jdbcType=INTEGER},
      </if>
      <if test="lZqlb != null">
        #{lZqlb,jdbcType=INTEGER},
      </if>
      <if test="lImportFlag != null">
        #{lImportFlag,jdbcType=INTEGER},
      </if>
      <if test="vcImportDescribe != null">
        #{vcImportDescribe,jdbcType=VARCHAR},
      </if>
      <if test="lFlag != null">
        #{lFlag,jdbcType=INTEGER},
      </if>
      <if test="vcYyzqlb != null">
        #{vcYyzqlb,jdbcType=VARCHAR},
      </if>
      <if test="vcYysclb != null">
        #{vcYysclb,jdbcType=VARCHAR},
      </if>
      <if test="dr != null">
        #{dr,jdbcType=INTEGER},
      </if>
      <if test="ts != null">
        #{ts,jdbcType=VARCHAR},
      </if>
      <if test="lZqlbmx2 != null">
        #{lZqlbmx2,jdbcType=INTEGER},
      </if>
      <if test="lZqlbmx1 != null">
        #{lZqlbmx1,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.dhcc.finance.main.domain.CwHsOutcwZqxxExample" resultType="java.lang.Long">
    select count(*) from cw_hs_outcw_zqxx
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update cw_hs_outcw_zqxx
    <set>
      <if test="record.lZqnm != null">
        L_ZQNM = #{record.lZqnm,jdbcType=INTEGER},
      </if>
      <if test="record.vcZqdm != null">
        VC_ZQDM = #{record.vcZqdm,jdbcType=VARCHAR},
      </if>
      <if test="record.vcZqjc != null">
        VC_ZQJC = #{record.vcZqjc,jdbcType=VARCHAR},
      </if>
      <if test="record.lSclb != null">
        L_SCLB = #{record.lSclb,jdbcType=INTEGER},
      </if>
      <if test="record.lZqlb != null">
        L_ZQLB = #{record.lZqlb,jdbcType=INTEGER},
      </if>
      <if test="record.lImportFlag != null">
        L_IMPORT_FLAG = #{record.lImportFlag,jdbcType=INTEGER},
      </if>
      <if test="record.vcImportDescribe != null">
        VC_IMPORT_DESCRIBE = #{record.vcImportDescribe,jdbcType=VARCHAR},
      </if>
      <if test="record.lFlag != null">
        L_FLAG = #{record.lFlag,jdbcType=INTEGER},
      </if>
      <if test="record.vcYyzqlb != null">
        VC_YYZQLB = #{record.vcYyzqlb,jdbcType=VARCHAR},
      </if>
      <if test="record.vcYysclb != null">
        VC_YYSCLB = #{record.vcYysclb,jdbcType=VARCHAR},
      </if>
      <if test="record.dr != null">
        DR = #{record.dr,jdbcType=INTEGER},
      </if>
      <if test="record.ts != null">
        TS = #{record.ts,jdbcType=VARCHAR},
      </if>
      <if test="record.lZqlbmx2 != null">
        L_ZQLBMX2 = #{record.lZqlbmx2,jdbcType=INTEGER},
      </if>
      <if test="record.lZqlbmx1 != null">
        L_ZQLBMX1 = #{record.lZqlbmx1,jdbcType=INTEGER},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update cw_hs_outcw_zqxx
    set L_ZQNM = #{record.lZqnm,jdbcType=INTEGER},
      VC_ZQDM = #{record.vcZqdm,jdbcType=VARCHAR},
      VC_ZQJC = #{record.vcZqjc,jdbcType=VARCHAR},
      L_SCLB = #{record.lSclb,jdbcType=INTEGER},
      L_ZQLB = #{record.lZqlb,jdbcType=INTEGER},
      L_IMPORT_FLAG = #{record.lImportFlag,jdbcType=INTEGER},
      VC_IMPORT_DESCRIBE = #{record.vcImportDescribe,jdbcType=VARCHAR},
      L_FLAG = #{record.lFlag,jdbcType=INTEGER},
      VC_YYZQLB = #{record.vcYyzqlb,jdbcType=VARCHAR},
      VC_YYSCLB = #{record.vcYysclb,jdbcType=VARCHAR},
      DR = #{record.dr,jdbcType=INTEGER},
      TS = #{record.ts,jdbcType=VARCHAR},
      L_ZQLBMX2 = #{record.lZqlbmx2,jdbcType=INTEGER},
      L_ZQLBMX1 = #{record.lZqlbmx1,jdbcType=INTEGER}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.dhcc.finance.main.domain.CwHsOutcwZqxx">
    update cw_hs_outcw_zqxx
    <set>
      <if test="vcZqdm != null">
        VC_ZQDM = #{vcZqdm,jdbcType=VARCHAR},
      </if>
      <if test="vcZqjc != null">
        VC_ZQJC = #{vcZqjc,jdbcType=VARCHAR},
      </if>
      <if test="lSclb != null">
        L_SCLB = #{lSclb,jdbcType=INTEGER},
      </if>
      <if test="lZqlb != null">
        L_ZQLB = #{lZqlb,jdbcType=INTEGER},
      </if>
      <if test="lImportFlag != null">
        L_IMPORT_FLAG = #{lImportFlag,jdbcType=INTEGER},
      </if>
      <if test="vcImportDescribe != null">
        VC_IMPORT_DESCRIBE = #{vcImportDescribe,jdbcType=VARCHAR},
      </if>
      <if test="lFlag != null">
        L_FLAG = #{lFlag,jdbcType=INTEGER},
      </if>
      <if test="vcYyzqlb != null">
        VC_YYZQLB = #{vcYyzqlb,jdbcType=VARCHAR},
      </if>
      <if test="vcYysclb != null">
        VC_YYSCLB = #{vcYysclb,jdbcType=VARCHAR},
      </if>
      <if test="dr != null">
        DR = #{dr,jdbcType=INTEGER},
      </if>
      <if test="ts != null">
        TS = #{ts,jdbcType=VARCHAR},
      </if>
      <if test="lZqlbmx2 != null">
        L_ZQLBMX2 = #{lZqlbmx2,jdbcType=INTEGER},
      </if>
      <if test="lZqlbmx1 != null">
        L_ZQLBMX1 = #{lZqlbmx1,jdbcType=INTEGER},
      </if>
    </set>
    where L_ZQNM = #{lZqnm,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.dhcc.finance.main.domain.CwHsOutcwZqxx">
    update cw_hs_outcw_zqxx
    set VC_ZQDM = #{vcZqdm,jdbcType=VARCHAR},
      VC_ZQJC = #{vcZqjc,jdbcType=VARCHAR},
      L_SCLB = #{lSclb,jdbcType=INTEGER},
      L_ZQLB = #{lZqlb,jdbcType=INTEGER},
      L_IMPORT_FLAG = #{lImportFlag,jdbcType=INTEGER},
      VC_IMPORT_DESCRIBE = #{vcImportDescribe,jdbcType=VARCHAR},
      L_FLAG = #{lFlag,jdbcType=INTEGER},
      VC_YYZQLB = #{vcYyzqlb,jdbcType=VARCHAR},
      VC_YYSCLB = #{vcYysclb,jdbcType=VARCHAR},
      DR = #{dr,jdbcType=INTEGER},
      TS = #{ts,jdbcType=VARCHAR},
      L_ZQLBMX2 = #{lZqlbmx2,jdbcType=INTEGER},
      L_ZQLBMX1 = #{lZqlbmx1,jdbcType=INTEGER}
    where L_ZQNM = #{lZqnm,jdbcType=INTEGER}
  </update>
  <!--批量新增  -->
    <insert id="insertBeatch" parameterType="java.util.List">
    insert into cw_hs_outcw_zqxx (L_ZQNM, VC_ZQDM, VC_ZQJC, 
      L_SCLB, L_ZQLB, L_IMPORT_FLAG, 
      VC_IMPORT_DESCRIBE, L_FLAG, VC_YYZQLB, 
      VC_YYSCLB, DR, TS, L_ZQLBMX2, 
      L_ZQLBMX1)
    values 
    <foreach collection="list" item="item" index="index" separator=",">
    (#{item.lZqnm,jdbcType=INTEGER}, #{item.vcZqdm,jdbcType=VARCHAR}, #{item.vcZqjc,jdbcType=VARCHAR}, 
      #{item.lSclb,jdbcType=INTEGER}, #{item.lZqlb,jdbcType=INTEGER}, #{item.lImportFlag,jdbcType=INTEGER}, 
      #{item.vcImportDescribe,jdbcType=VARCHAR}, #{item.lFlag,jdbcType=INTEGER}, #{item.vcYyzqlb,jdbcType=VARCHAR}, 
      #{item.vcYysclb,jdbcType=VARCHAR}, #{item.dr,jdbcType=INTEGER}, #{item.ts,jdbcType=VARCHAR}, #{item.lZqlbmx2,jdbcType=INTEGER}, 
      #{item.lZqlbmx1,jdbcType=INTEGER})
       </foreach>
  </insert>
  <select id="selectCwHsOutcwZqxxForJC" resultMap="BaseResultMap1">
     select  L_ZQNM VC_ZQDM,concat(VC_ZQDM,'_',VC_ZQJC) VC_ZQJC from cw_hs_outcw_zqxx
  </select>
    <!--删除数据  -->
  <delete id="deleteCwHsOutcwZqxx" >
     truncate table cw_hs_outcw_zqxx
  </delete>
    
  <select id="selectZqnmInfo" resultType="java.lang.String">
   	SELECT GROUP_CONCAT( DISTINCT a.L_ZQNM) as zqnm   from cw_hs_outcw_vouchers a left join cw_hs_outcw_zqxx b 
   	on a.L_ZQNM = b.L_ZQNM WHERE b.L_ZQNM is null and a.L_ZQNM is not null and a.L_ZQNM != 0
  </select>
</mapper>