package cn.ey.biz.module.system.dal.mapper.permission;

import cn.ey.biz.framework.mybatis.core.mapper.BaseMapperX;
import cn.ey.biz.module.system.controller.admin.permission.vo.userRole.UserDataRoleExcelVO;
import cn.ey.biz.module.system.dal.dataobject.permission.UserDataRoleDO;
import cn.ey.biz.module.system.dal.dataobject.permission.UserRoleDO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

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

@Mapper
public interface UserDataRoleMapper extends BaseMapperX<UserDataRoleDO> {

    @Select("SELECT COUNT(*) FROM system_user_data_role WHERE update_time > #{maxUpdateTime}")
    Long selectCountByUpdateTimeGt(Date maxUpdateTime);


    List<UserDataRoleExcelVO> getUserDataRoleGpnName();

    default List<UserDataRoleDO> selectListByRoleId(Long roleId) {
        return selectList(new QueryWrapper<UserDataRoleDO>().eq("role_id", roleId));
    }

}
