<?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.datax.service.data.market.dao.ApiMaskDao">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="cn.datax.service.data.market.api.entity.ApiMaskEntity">
        <result column="id" property="id" />
        <result column="status" property="status" />
        <result column="create_by" property="createBy" />
        <result column="create_time" property="createTime" />
        <result column="create_dept" property="createDept" />
        <result column="update_by" property="updateBy" />
        <result column="update_time" property="updateTime" />
        <result column="api_id" property="apiId" />
        <result column="mask_name" property="maskName" />
        <result column="remark" property="remark" />
    </resultMap>

    <resultMap id="ExtendResultMap" type="cn.datax.service.data.market.api.entity.ApiMaskEntity" extends="BaseResultMap">
        <result column="config_json" property="rules" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id,
        status,
        create_by,
        create_time,
        create_dept,
        update_by,
        update_time,
        api_id, mask_name, remark
    </sql>

    <sql id="Extend_Column_List">
        id,
        status,
        create_by,
        create_time,
        create_dept,
        update_by,
        update_time,
        api_id, mask_name, remark, config_json
    </sql>

    <select id="selectById" resultMap="ExtendResultMap">
        SELECT
        <include refid="Extend_Column_List"></include>
        FROM market_api_mask
        WHERE 1=1 AND id = #{id}
    </select>

    <select id="selectPage" resultMap="BaseResultMap">
        SELECT
        <include refid="Base_Column_List"></include>
        FROM market_api_mask
        ${ew.customSqlSegment}
    </select>

</mapper>
