<?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.dictCheckType.dao.impl.DictCheckTypeDaoImpl">

    <resultMap id="get-DictCheckTypeEntity-result" type="com.hzya.frame.grpU8.dictCheckType.entity.DictCheckTypeEntity" >
           <result property="check_type_code" column="check_type_code" jdbcType="VARCHAR"/>
           <result property="check_type_name" column="check_type_name" 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 = "DictCheckTypeEntity_Base_Column_List">
        check_type_code
        ,check_type_name 
        ,org_code 
        ,org_name 
        ,branch_code 
        ,branch_name 
     </sql>
 <!-- 查询 采用==查询 -->
 <select id="entity_list_base" resultMap="get-DictCheckTypeEntity-result" parameterType = "com.hzya.frame.grpU8.dictCheckType.entity.DictCheckTypeEntity">
    select
    <include refid="DictCheckTypeEntity_Base_Column_List" />
    from dict_check_type
    <trim prefix="where" prefixOverrides="and"> 
            <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="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.dictCheckType.entity.DictCheckTypeEntity">
        select  count(1)   from dict_check_type
    <trim prefix="where" prefixOverrides="and"> 
            <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="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-DictCheckTypeEntity-result" parameterType = "com.hzya.frame.grpU8.dictCheckType.entity.DictCheckTypeEntity">
    select
    <include refid="DictCheckTypeEntity_Base_Column_List" />
    from dict_check_type
    <trim prefix="where" prefixOverrides="and"> 
            <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="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="DictCheckTypeentity_list_or" resultMap="get-DictCheckTypeEntity-result" parameterType = "com.hzya.frame.grpU8.dictCheckType.entity.DictCheckTypeEntity">
    select
    <include refid="DictCheckTypeEntity_Base_Column_List" />
    from dict_check_type
    <trim prefix="where" prefixOverrides="and"> 
             <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="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-DictCheckTypeEntityVo-result" type="com.hzya.frame.grpU8.dictCheckType.entity.DictCheckTypeEntityVo" >
        <result property="check_type_code" column="check_type_code" jdbcType="VARCHAR"/>
        <result property="check_type_name" column="check_type_name" 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>
    <!-- 分页查询列表 采用like格式 -->
    <select id="queryData" resultMap="get-DictCheckTypeEntityVo-result" parameterType = "com.hzya.frame.grpU8.dictCheckType.entity.DictCheckTypeEntity">
        select
        <include refid="DictCheckTypeEntity_Base_Column_List" />
        from dict_check_type
        <trim prefix="where" prefixOverrides="and">
            <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="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>

