@Select("select role_id AS roleId from user_role where user_id = #{userId}") @ResultType(Long.class) List<Long> selectRoleIdListByUserId(@Param("userId") Long userId);
@Select("select * from users") @ResultType(User.class) void getAllUsers(UserResultHandler resultHandler);
@Select(value = "SELECT s.ID,s.CATEGORY_NAME AS name, s.PARENT_ID,p.CATEGORY_NAME AS parent_name FROM cd_category s LEFT JOIN cd_category p ON p.ID=s.PARENT_ID where FIND_IN_SET(s.id, query_children_category(${id}))") @ResultType(ItemCategoryModel.class) public List<ItemCategoryModel> getItemCategoryTree(@Param(value = "id") Integer id);
@Select("select r.* from sys_roles r left join sys_users_roles ur on ur.role_id = r.id left join sys_users u on u.id=ur.user_id where u.username = #{username}") @ResultType(SysRoles.class) public List<SysRoles> getRoleList(String username);
@Select(value = "") @ResultType(Dictionary.class) public Dictionary getDictionaryList(@Param(value = "keyword") String keyword);
@Select(value = "SELECT s.ID,s.NAME,s.DESCRIPTION, s.PARENT_ID,p.NAME AS parent_name FROM sys_organization s LEFT JOIN sys_organization p ON p.ID=s.PARENT_ID where FIND_IN_SET(s.id, query_children_organization(${id}))") @ResultType(OrganizationModel.class) public List<OrganizationModel> getOrganizationTree(@Param(value = "id") Integer id);
/** * 查询词频统计结果,查询频次开前的N个结果 */ @Select("SELECT `word`,`count` FROM `wordcount` ORDER BY `count` DESC LIMIT #{N}") @ConstructorArgs(value = { @Arg(column = "word", javaType = String.class), @Arg(column = "count", javaType = Integer.class) }) @ResultType(value = WordAndCount.class) public List<WordAndCount> selectWordCountTopN(int N);
@Select("select * from user") @ResultType(User.class) public Page<User> findPage(Pageable pageRequest);
@Select("select * from user where firstName = #{firstName}") @ResultType(User.class) public Page<User> findPageByFirstName(@Param("firstName") String firstName, Pageable pageRequest);
/** * 查询用户所有权限 * @param username * @return */ @Select("select p.* from sys_permissions p left join `sys_roles_permissions` rp on rp.`PERMISSION_ID`=p.`ID` left join sys_roles r on rp.`ROLE_ID`=r.`ID` left join sys_users_roles ur on ur.role_id = r.id left join sys_users u on u.id=ur.user_id where u.username = #{username}") @ResultType(SysPermissions.class) public List<SysPermissions> getPermissionList(String username);
/** * 条件查询 * 自定议显示字段传入 model.params,为空时为所有字段 * 条件传入model.QueryCriteria * @param model * @return */ @SelectProvider(method = "selectByCriteria", type = SqlTemplate.class) @ResultType(value = List.class) List<Map<String, Object>> selectByCriteria(Table model);
/** * 主键查询 * 自定议显示字段传入 model.params,为空时为所有字段 * 主键参数传入 model.conditions,不能为空 * @param model * @return */ @SelectProvider(method = "selectByPrimaryKey", type = SqlTemplate.class) @ResultType(value = Map.class) Map<String, Object> selectByPrimaryKey(Table model);
/** * 条件count * 条件传入model.QueryCriteria * @param model * @return */ @SelectProvider(method = "countByCriteria", type = SqlTemplate.class) @ResultType(value = Integer.class) int countByCriteria(Table model);