<?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.hzya.frame.grpU8.acctVouchInfo.dao.impl.AcctVouchInfoDaoImpl">
    <resultMap id="get-AcctVouchInfoEntity-result" type="com.hzya.frame.grpU8.acctVouchInfo.entity.AcctVouchInfoEntity" >
           <result property="acct_year" column="acct_year" jdbcType="VARCHAR"/>
           <result property="acct_month" column="acct_month" jdbcType="VARCHAR"/>
           <result property="dept_code" column="dept_code" jdbcType="VARCHAR"/>
           <result property="dept_name" column="dept_name" jdbcType="VARCHAR"/>
           <result property="acct_subj_code" column="acct_subj_code" jdbcType="VARCHAR"/>
           <result property="acct_subj_name" column="acct_subj_name" jdbcType="VARCHAR"/>
           <result property="check_type_code" column="check_type_code" jdbcType="VARCHAR"/>
           <result property="check_type_name" column="check_type_name" jdbcType="VARCHAR"/>
           <result property="direction" column="direction" jdbcType="VARCHAR"/>
           <result property="amount" column="amount" jdbcType="NUMERIC"/>
           <result property="fund_source_code" column="fund_source_code" jdbcType="VARCHAR"/>
           <result property="vouch_no" column="vouch_no" jdbcType="VARCHAR"/>
           <result property="summary" column="summary" jdbcType="VARCHAR"/>
           <result property="bookkeeper" column="bookkeeper" jdbcType="VARCHAR"/>
           <result property="org_code" column="org_code" jdbcType="VARCHAR"/>
           <result property="org_name" column="org_name" jdbcType="VARCHAR"/>
           <result property="branch_code" column="branch_code" jdbcType="VARCHAR"/>
           <result property="branch_name" column="branch_name" jdbcType="VARCHAR"/>
        </resultMap>
    <!-- 查询的字段-->
    <sql id = "AcctVouchInfoEntity_Base_Column_List">
        acct_year
        ,acct_month 
        ,dept_code 
        ,dept_name 
        ,acct_subj_code 
        ,acct_subj_name 
        ,check_type_code 
        ,check_type_name 
        ,direction 
        ,amount 
        ,fund_source_code 
        ,vouch_no 
        ,summary 
        ,bookkeeper 
        ,org_code 
        ,org_name 
        ,branch_code 
        ,branch_name 
     </sql>
 <!-- 查询 采用==查询 -->
 <select id="entity_list_base" resultMap="get-AcctVouchInfoEntity-result" parameterType = "com.hzya.frame.grpU8.acctVouchInfo.entity.AcctVouchInfoEntity">
    select
    <include refid="AcctVouchInfoEntity_Base_Column_List" />
    from acct_vouch_info
    <trim prefix="where" prefixOverrides="and"> 
            <if test="acct_year != null and acct_year != ''"> and acct_year = #{acct_year} </if>
            <if test="acct_month != null and acct_month != ''"> and acct_month = #{acct_month} </if>
            <if test="dept_code != null and dept_code != ''"> and dept_code = #{dept_code} </if>
            <if test="dept_name != null and dept_name != ''"> and dept_name = #{dept_name} </if>
            <if test="acct_subj_code != null and acct_subj_code != ''"> and acct_subj_code = #{acct_subj_code} </if>
            <if test="acct_subj_name != null and acct_subj_name != ''"> and acct_subj_name = #{acct_subj_name} </if>
            <if test="check_type_code != null and check_type_code != ''"> and check_type_code = #{check_type_code} </if>
            <if test="check_type_name != null and check_type_name != ''"> and check_type_name = #{check_type_name} </if>
            <if test="direction != null and direction != ''"> and direction = #{direction} </if>
            <if test="amount != null"> and amount = #{amount} </if>
            <if test="fund_source_code != null and fund_source_code != ''"> and fund_source_code = #{fund_source_code} </if>
            <if test="vouch_no != null"> and vouch_no = #{vouch_no} </if>
            <if test="summary != null and summary != ''"> and summary = #{summary} </if>
            <if test="bookkeeper != null and bookkeeper != ''"> and bookkeeper = #{bookkeeper} </if>
            <if test="org_code != null and org_code != ''"> and org_code = #{org_code} </if>
            <if test="org_name != null and org_name != ''"> and org_name = #{org_name} </if>
            <if test="branch_code != null and branch_code != ''"> and branch_code = #{branch_code} </if>
            <if test="branch_name != null and branch_name != ''"> and branch_name = #{branch_name} </if>
    </trim>
</select>
    
<!-- 查询符合条件的数量 -->
<select id="entity_count" resultType="Integer" parameterType = "com.hzya.frame.grpU8.acctVouchInfo.entity.AcctVouchInfoEntity">
        select  count(1)   from acct_vouch_info
    <trim prefix="where" prefixOverrides="and"> 
            <if test="acct_year != null and acct_year != ''"> and acct_year = #{acct_year} </if>
            <if test="acct_month != null and acct_month != ''"> and acct_month = #{acct_month} </if>
            <if test="dept_code != null and dept_code != ''"> and dept_code = #{dept_code} </if>
            <if test="dept_name != null and dept_name != ''"> and dept_name = #{dept_name} </if>
            <if test="acct_subj_code != null and acct_subj_code != ''"> and acct_subj_code = #{acct_subj_code} </if>
            <if test="acct_subj_name != null and acct_subj_name != ''"> and acct_subj_name = #{acct_subj_name} </if>
            <if test="check_type_code != null and check_type_code != ''"> and check_type_code = #{check_type_code} </if>
            <if test="check_type_name != null and check_type_name != ''"> and check_type_name = #{check_type_name} </if>
            <if test="direction != null and direction != ''"> and direction = #{direction} </if>
            <if test="amount != null"> and amount = #{amount} </if>
            <if test="fund_source_code != null and fund_source_code != ''"> and fund_source_code = #{fund_source_code} </if>
            <if test="vouch_no != null"> and vouch_no = #{vouch_no} </if>
            <if test="summary != null and summary != ''"> and summary = #{summary} </if>
            <if test="bookkeeper != null and bookkeeper != ''"> and bookkeeper = #{bookkeeper} </if>
            <if test="org_code != null and org_code != ''"> and org_code = #{org_code} </if>
            <if test="org_name != null and org_name != ''"> and org_name = #{org_name} </if>
            <if test="branch_code != null and branch_code != ''"> and branch_code = #{branch_code} </if>
            <if test="branch_name != null and branch_name != ''"> and branch_name = #{branch_name} </if>
    </trim>
    </select>

    <!-- 分页查询列表 采用like格式 -->
<select id="entity_list_like" resultMap="get-AcctVouchInfoEntity-result" parameterType = "com.hzya.frame.grpU8.acctVouchInfo.entity.AcctVouchInfoEntity">
    select
    <include refid="AcctVouchInfoEntity_Base_Column_List" />
    from acct_vouch_info
    <trim prefix="where" prefixOverrides="and"> 
            <if test="acct_year != null and acct_year != ''"> and acct_year like concat('%',#{acct_year},'%') </if>
            <if test="acct_month != null and acct_month != ''"> and acct_month like concat('%',#{acct_month},'%') </if>
            <if test="dept_code != null and dept_code != ''"> and dept_code like concat('%',#{dept_code},'%') </if>
            <if test="dept_name != null and dept_name != ''"> and dept_name like concat('%',#{dept_name},'%') </if>
            <if test="acct_subj_code != null and acct_subj_code != ''"> and acct_subj_code like concat('%',#{acct_subj_code},'%') </if>
            <if test="acct_subj_name != null and acct_subj_name != ''"> and acct_subj_name like concat('%',#{acct_subj_name},'%') </if>
            <if test="check_type_code != null and check_type_code != ''"> and check_type_code like concat('%',#{check_type_code},'%') </if>
            <if test="check_type_name != null and check_type_name != ''"> and check_type_name like concat('%',#{check_type_name},'%') </if>
            <if test="direction != null and direction != ''"> and direction like concat('%',#{direction},'%') </if>
            <if test="amount != null"> and amount like concat('%',#{amount},'%') </if>
            <if test="fund_source_code != null and fund_source_code != ''"> and fund_source_code like concat('%',#{fund_source_code},'%') </if>
            <if test="vouch_no != null"> and vouch_no like concat('%',#{vouch_no},'%') </if>
            <if test="summary != null and summary != ''"> and summary like concat('%',#{summary},'%') </if>
            <if test="bookkeeper != null and bookkeeper != ''"> and bookkeeper like concat('%',#{bookkeeper},'%') </if>
            <if test="org_code != null and org_code != ''"> and org_code like concat('%',#{org_code},'%') </if>
            <if test="org_name != null and org_name != ''"> and org_name like concat('%',#{org_name},'%') </if>
            <if test="branch_code != null and branch_code != ''"> and branch_code like concat('%',#{branch_code},'%') </if>
            <if test="branch_name != null and branch_name != ''"> and branch_name like concat('%',#{branch_name},'%') </if>
    </trim>
</select>

<!-- 查询列表 字段采用or格式 -->
<select id="AcctVouchInfoentity_list_or" resultMap="get-AcctVouchInfoEntity-result" parameterType = "com.hzya.frame.grpU8.acctVouchInfo.entity.AcctVouchInfoEntity">
    select
    <include refid="AcctVouchInfoEntity_Base_Column_List" />
    from acct_vouch_info
    <trim prefix="where" prefixOverrides="and"> 
             <if test="acct_year != null and acct_year != ''"> or acct_year = #{acct_year} </if>
             <if test="acct_month != null and acct_month != ''"> or acct_month = #{acct_month} </if>
             <if test="dept_code != null and dept_code != ''"> or dept_code = #{dept_code} </if>
             <if test="dept_name != null and dept_name != ''"> or dept_name = #{dept_name} </if>
             <if test="acct_subj_code != null and acct_subj_code != ''"> or acct_subj_code = #{acct_subj_code} </if>
             <if test="acct_subj_name != null and acct_subj_name != ''"> or acct_subj_name = #{acct_subj_name} </if>
             <if test="check_type_code != null and check_type_code != ''"> or check_type_code = #{check_type_code} </if>
             <if test="check_type_name != null and check_type_name != ''"> or check_type_name = #{check_type_name} </if>
             <if test="direction != null and direction != ''"> or direction = #{direction} </if>
             <if test="amount != null"> or amount = #{amount} </if>
             <if test="fund_source_code != null and fund_source_code != ''"> or fund_source_code = #{fund_source_code} </if>
             <if test="vouch_no != null"> or vouch_no = #{vouch_no} </if>
             <if test="summary != null and summary != ''"> or summary = #{summary} </if>
             <if test="bookkeeper != null and bookkeeper != ''"> or bookkeeper = #{bookkeeper} </if>
             <if test="org_code != null and org_code != ''"> or org_code = #{org_code} </if>
             <if test="org_name != null and org_name != ''"> or org_name = #{org_name} </if>
             <if test="branch_code != null and branch_code != ''"> or branch_code = #{branch_code} </if>
             <if test="branch_name != null and branch_name != ''"> or branch_name = #{branch_name} </if>
    </trim>
</select>


    <resultMap id="get-AcctVouchInfoEntityVo-result" type="com.hzya.frame.grpU8.acctVouchInfo.entity.AcctVouchInfoEntityVo" >
        <result property="acct_year" column="acct_year" jdbcType="VARCHAR"/>
        <result property="acct_month" column="acct_month" jdbcType="VARCHAR"/>
        <result property="dept_code" column="dept_code" jdbcType="VARCHAR"/>
        <result property="dept_name" column="dept_name" jdbcType="VARCHAR"/>
        <result property="acct_subj_code" column="acct_subj_code" jdbcType="VARCHAR"/>
        <result property="acct_subj_name" column="acct_subj_name" jdbcType="VARCHAR"/>
        <result property="check_type_code" column="check_type_code" jdbcType="VARCHAR"/>
        <result property="check_type_name" column="check_type_name" jdbcType="VARCHAR"/>
        <result property="direction" column="direction" jdbcType="VARCHAR"/>
        <result property="amount" column="amount" jdbcType="NUMERIC"/>
        <result property="fund_source_code" column="fund_source_code" jdbcType="VARCHAR"/>
        <result property="vouch_no" column="vouch_no" jdbcType="VARCHAR"/>
        <result property="summary" column="summary" jdbcType="VARCHAR"/>
        <result property="bookkeeper" column="bookkeeper" jdbcType="VARCHAR"/>
        <result property="org_code" column="org_code" jdbcType="VARCHAR"/>
        <result property="org_name" column="org_name" jdbcType="VARCHAR"/>
        <result property="branch_code" column="branch_code" jdbcType="VARCHAR"/>
        <result property="branch_name" column="branch_name" jdbcType="VARCHAR"/>
    </resultMap>
    <select id="queryData" resultMap="get-AcctVouchInfoEntityVo-result" parameterType = "com.hzya.frame.grpU8.acctVouchInfo.entity.AcctVouchInfoEntity">
        select
        <include refid="AcctVouchInfoEntity_Base_Column_List" />
        from acct_vouch_info
        <trim prefix="where" prefixOverrides="and">
            <if test="acct_year != null and acct_year != ''"> and acct_year = '${acct_year}' </if>
            <if test="acct_month != null and acct_month != ''"> and acct_month = '${acct_month}' </if>
            <if test="dept_code != null and dept_code != ''"> and dept_code like '%${dept_code}%' </if>
            <if test="dept_name != null and dept_name != ''"> and dept_name like '%${dept_name}%' </if>
            <if test="acct_subj_code != null and acct_subj_code != ''"> and acct_subj_code like '%${acct_subj_code}%' </if>
            <if test="acct_subj_name != null and acct_subj_name != ''"> and acct_subj_name like '%${acct_subj_name}%' </if>
            <if test="check_type_code != null and check_type_code != ''"> and check_type_code like '%${check_type_code}%' </if>
            <if test="check_type_name != null and check_type_name != ''"> and check_type_name like '%${check_type_name}%' </if>
            <if test="direction != null and direction != ''"> and direction like '%${direction}%' </if>
            <if test="amount != null"> and amount like '%${amount}%' </if>
            <if test="fund_source_code != null and fund_source_code != ''"> and fund_source_code like '%${fund_source_code}%' </if>
            <if test="vouch_no != null"> and vouch_no like '%${vouch_no}%' </if>
            <if test="summary != null and summary != ''"> and summary like '%${summary}%' </if>
            <if test="bookkeeper != null and bookkeeper != ''"> and bookkeeper like '%${bookkeeper}%' </if>
            <if test="org_code != null and org_code != ''"> and org_code like '%${org_code}%' </if>
            <if test="org_name != null and org_name != ''"> and org_name like '%${org_name}%' </if>
            <if test="branch_code != null and branch_code != ''"> and branch_code like '%${branch_code}%' </if>
            <if test="branch_name != null and branch_name != ''"> and branch_name like '%${branch_name}%' </if>
        </trim>
    </select>
</mapper>

