package cn.com.ty.lift.ud.tableDict.mapper;

import cn.com.ty.lift.ud.tableDict.mapper.entity.TableDictDto;
import cn.com.ty.lift.ud.tableDict.mapper.entity.TableDictEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;
import java.util.List;

/**
 * 数据字典表 -Repository
 * 
 * @author Xson
 * @date 2020-05-07
 */
public interface TableDictMapper extends BaseMapper<TableDictEntity> {

    /**
     * 根据表名和字段查询常量
     * 
     * @param request
     */
    @Select("select * from table_dict where table_name = #{request.tableName} and field  = #{request.field}")
    List<TableDictEntity> getConstantByTableAndColumn(@Param("request") TableDictDto request);

    @Select("select val from table_dict where table_name = #{tableName} and field  = #{field} and code = #{code}")
    String findOneByTableAndColumnAndCode(@Param("tableName") String tableName, @Param("field") String field,
        @Param("code") String code);

}
