<?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="cn.cecep.talroad.mapper.BEnterpriseIrLegalMapper">

    <resultMap type="cn.cecep.talroad.domain.BEnterpriseIrLegal" id="BEnterpriseIrLegalResult">
        <result property="id"    column="id"    />
        <result property="legalType"    column="legal_type"    />
        <result property="legalName"    column="legal_name"    />
        <result property="legalTitle"    column="legal_title"    />
        <result property="legalDetails"    column="legal_details"    />
        <result property="legalFileName"    column="legal_file_name"    />
        <result property="legalFileUrl"    column="legal_file_url"    />
        <result property="legalTime"    column="legal_time"    />
    </resultMap>


    <sql id="selectBEnterpriseIrLegalVo">
        select id, legal_type, legal_name, legal_title, legal_details, legal_file_name, legal_file_url, legal_time from b_enterprise_ir_legal
    </sql>

    <select id="selectBEnterpriseIrLegalList" parameterType="cn.cecep.talroad.domain.BEnterpriseIrLegal" resultMap="BEnterpriseIrLegalResult">
        <include refid="selectBEnterpriseIrLegalVo"/>
        <where>
            <if test="legalType != null  and legalType != ''"> and legal_type = #{legalType}</if>
            <if test="legalName != null  and legalName != ''"> and legal_name like concat('%', #{legalName}, '%')</if>
            <if test="legalTitle != null  and legalTitle != ''"> and legal_title = #{legalTitle}</if>
            <if test="legalDetails != null  and legalDetails != ''"> and legal_details = #{legalDetails}</if>
            <if test="legalFileName != null  and legalFileName != ''"> and legal_file_name like concat('%', #{legalFileName}, '%')</if>
            <if test="legalFileUrl != null  and legalFileUrl != ''"> and legal_file_url = #{legalFileUrl}</if>
            <if test="legalTime != null  and legalTime != ''"> and legal_time = #{legalTime}</if>
        </where>
    </select>

</mapper>
