src/main/java/com/phms/service/impl/UserRoleServiceImpl.java

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

package com.phms.service.impl;

import com.phms.mapper.UserRoleMapper;
import com.phms.model.ResultMap;
import com.phms.pojo.User;
import com.phms.pojo.UserRole;
import com.phms.pojo.UserRoleExample;
import com.phms.service.UserRoleService;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;

import java.util.Collections;
import java.util.List;

@Service
public class UserRoleServiceImpl implements UserRoleService {

	@Autowired
	private UserRoleMapper userRoleMapper;
	/** logback日志记录 */
	private static final Logger logger = LoggerFactory.getLogger(UserRoleServiceImpl.class);

	/**
	 *      Description: 根据用户id获取权限 <BR>
	 *      Remark: <BR>
	 * @param userId
	 * @return <BR>
	 */
	@Override
	public List<UserRole> getRoleByUserId(String userId) {
		UserRoleExample example = new UserRoleExample();
		example.createCriteria().andUserIdEqualTo(userId);
		try {
			return userRoleMapper.selectByExample(example);
		} catch (Exception e) {
			logger.error("根据用户id获取权限异常", e);
			return Collections.emptyList();
		}
	}

	/**
	 *      Description: 根据权限id删除用户权限表 <BR>
	 *      Remark: <BR>
	 * @param id
	 * @return <BR>
	 */
	@Override
	@Transactional
	public boolean delUserRoleByRoleId(int id) {
		UserRoleExample example = new UserRoleExample();
		example.createCriteria().andRoleIdEqualTo(id);
		try {
			userRoleMapper.deleteByExample(example);
			return true;
后面还有 70 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。