<?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.pangu.application.mapper.ApiDictMapper">

    <resultMap id="ApiDictResult" type="com.pangu.application.domain.entity.ApiDict">
        <id property="apiId" column="api_id"/>
        <result property="apiCode" column="api_code"/>
        <result property="apiName" column="api_name"/>
        <result property="apiPath" column="api_path"/>
        <result property="apiMethod" column="api_method"/>
        <result property="apiDesc" column="api_desc"/>
        <result property="orderNum" column="order_num"/>
        <result property="status" column="status"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
    </resultMap>

    <select id="selectByCodes" resultMap="ApiDictResult">
        SELECT api_id, api_code, api_name, api_path, api_method, api_desc, order_num, status,
               create_by, create_time, update_by, update_time
        FROM pg_api_dict
        WHERE status = '0'
        <if test="codes != null and codes.size() > 0">
            AND api_code IN
            <foreach collection="codes" item="code" open="(" separator="," close=")">
                #{code}
            </foreach>
        </if>
        ORDER BY order_num
    </select>
</mapper>
