package com.hfkj.dao;

import com.hfkj.entity.BsLklMcc;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.type.JdbcType;

import java.util.List;
import java.util.Map;

/**
 * mapper扩展类
 */
public interface BsLklMccMapperExt {

    @Select("<script>" +
            " select * from bs_lkl_mcc where parent_id is not null " +
            " <if test='param.name != null'>" +
            " and CONCAT(`name`, macc_code) LIKE CONCAT('%',#{param.name},'%') " +
            " </if>" +
            "</script>")
    @Results({
            @Result(column="id", property="id", jdbcType= JdbcType.BIGINT, id=true),
            @Result(column="parent_id", property="parentId", jdbcType=JdbcType.BIGINT),
            @Result(column="parent_name", property="parentName", jdbcType=JdbcType.VARCHAR),
            @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
            @Result(column="macc_code", property="maccCode", jdbcType=JdbcType.VARCHAR),
            @Result(column="desc", property="desc", jdbcType=JdbcType.VARCHAR),
            @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
            @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
            @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
            @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
            @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
            @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
    })
    List<BsLklMcc> getMccList(@Param("param") Map<String, Object> param);
}
