<?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.zhongzheng.modules.base.mapper.CertificateTpMapper">

    <resultMap type="com.zhongzheng.modules.base.domain.CertificateTp" id="CertificateTpResult">
        <result property="tpId" column="tp_id"/>
        <result property="code" column="code"/>
        <result property="title" column="title"/>
        <result property="introduce" column="introduce"/>
        <result property="typeId" column="type_id"/>
        <result property="status" column="status"/>
        <result property="createTime" column="create_time"/>
        <result property="updateTime" column="update_time"/>
        <result property="remark" column="remark"/>
        <result property="keyValue" column="key_value"/>
    </resultMap>

    <resultMap type="com.zhongzheng.modules.base.vo.CertificateTpVo" id="CertificateTpVoResult">
        <result property="tpId" column="tp_id"/>
        <result property="code" column="code"/>
        <result property="title" column="title"/>
        <result property="introduce" column="introduce"/>
        <result property="typeId" column="type_id"/>
        <result property="status" column="status"/>
        <result property="remark" column="remark"/>
        <result property="key" column="key"/>
        <result property="certificateName" column="certificate_name"/>
    </resultMap>

    <select id="selectList" parameterType="com.zhongzheng.modules.base.bo.CertificateTpQueryBo" resultMap="CertificateTpVoResult">
        SELECT
            ct.*,
            c.certificate_name
        FROM
            certificate_tp ct
                LEFT JOIN certificate c ON ct.type_id = c.id
        where 1=1
      <if test="status != null and status.size()!=0 ">
            AND ct.status in
            <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="tpIds != null and tpIds.size()!=0 ">
            AND ct.tp_id in
            <foreach collection="tpIds" item="item" index="index" open="(" close=")" separator=",">
                #{item}
            </foreach>
        </if>
    </select>


</mapper>
