package org.jeecg.modules.adweb.common.mapper;

import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.system.entity.SysUser;

import java.util.Date;
import java.util.List;

/**
 * 通用MyBatis mapper工具
 *
 * @author wfansh
 */
public interface CommonMapper {

    /**
     * 获取某表中Date类型字段的最大值
     *
     * @param tableName
     * @param fieldName
     * @param filter
     * @return
     */
    Date getMaxDate(String tableName, String fieldName, String filter);

    @Select("SELECT t1.id id, t1.username userName, t1.realname realName\n" +
            "FROM sys_user t1 Left JOIN sys_user_role t2\n" +
            "ON t1.id = t2.user_id\n" +
            "Left JOIN sys_role t3\n" +
            "ON t3.id = t2.role_id\n" +
            "WHERE t3.role_code = 'adweb_vip' AND t1.del_flag = 0 AND t1.username != ''")
    List<SysUser> getAdwebVip();
}
