package com.nokia.dao; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.nokia.pojo.UserEntity; import com.nokia.vo.FlowRoleVo; import com.nokia.vo.FlowUserVo; import org.apache.ibatis.annotations.*; import java.util.List; @Mapper public interface UserDao extends BaseMapper { /** * 支持username模糊查询 */ @Select("select distinct r.role_id, r.role_name from sqmdb_rpt.acl_user u, sqmdb_rpt.acl_role r, sqmdb_rpt.acl_user_role ur where u.user_id = ur.user_id and r.role_id = ur.role_id and u.user_name like concat('%',#{username},'%')") List findRoleList(String username); /** * 查询全部 */ @Select("select role_id, role_name from sqmdb_rpt.acl_role") List findRoleList2(); /** * 查询全部用户(流程所需),未分页 */ @Results({ @Result(column = "org_id", property = "org.orgId"), @Result(column = "org_name", property = "org.orgName"), }) @Select("select a.user_id as user_id, a.login_name as login_id, a.user_name as user_name, a.phone as mobile, a.email as email," + " a.city_id as org_id, c.city_name_zh as org_name, a.district" + " from sqmdb_rpt.acl_user a, sqmdb_rpt.acl_city c" + " where a.city_id = c.city_id") List findToPage(); /** * 查询登录用户信息 */ // @Select("select user_id as user_id,login_name as login_id,user_name as // user_name ,phone as mobile,email as email, city_id as org_id from // sqmdb_rpt.acl_user where login_name=#{loginId} ") // @Results({ // @Result(column = "city_id", property = "org", one = @One(select = // "com.nokia.dao.CityDao.findOrgByCityId")) // }) @Results({ @Result(column = "org_id", property = "org.orgId"), @Result(column = "org_name", property = "org.orgName"), }) @Select("select a.user_id as user_id, a.login_name as login_id, a.user_name as user_name, a.phone as mobile, a.email as email," + " a.city_id as org_id, c.city_name_zh as org_name, a.district" + " from sqmdb_rpt.acl_user a, sqmdb_rpt.acl_city c" + " where a.city_id = c.city_id and login_name=#{loginId}") FlowUserVo getFlowUserVoByLoginId(String loginId); /** * 根据用户ID获取用户接口 */ @Results({ @Result(column = "org_id", property = "org.orgId"), @Result(column = "org_name", property = "org.orgName"), }) @Select("select a.user_id as user_id, a.login_name as login_id, a.user_name as user_name, a.phone as mobile, a.email as email," + " a.city_id as org_id, c.city_name_zh as org_name, a.district" + " from sqmdb_rpt.acl_user a, sqmdb_rpt.acl_city c" + " where a.city_id = c.city_id and user_id=#{userId}") FlowUserVo getFlowUserVoByUserId(Integer userId); @Select("select r.role_id from sqmdb_rpt.acl_role r, sqmdb_rpt.acl_user_role ur where r.role_id = ur.role_id and ur.user_id=#{userId}") List findRoleIdByUserId(Integer userId); @Select("select u.user_id from sqmdb_rpt.acl_user u, sqmdb_rpt.acl_user_role ur where u.user_id = ur.user_id and ur.role_id=#{roleId}") List findUserIdByRoleId(Integer roleId); /** * */ @Results({ @Result(column = "org_id", property = "org.orgId"), @Result(column = "org_name", property = "org.orgName"), }) @Select("") List findAuthorizedUser(String loginId, Integer roleId, String userName); @Select("select * from sqmdb_rpt.acl_user where login_name=#{loginName} ") @Results({ @Result(column = "city_id", property = "cityId"), @Result(column = "city_id", property = "city", one = @One(select = "com.nokia.dao.CityDao.findByCityId")) }) UserEntity getByLoinName(String loginName); }