xin
2025-07-19 85cbffb288da43d152b2744f01615ad81861b27f
oying-system/src/main/java/com/oying/modules/system/service/impl/UserServiceImpl.java
@@ -20,6 +20,7 @@
import com.oying.exception.EntityExistException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
@@ -128,8 +129,10 @@
        // 清除缓存
        delCaches(user.getId(), user.getUsername());
        // 更新用户角色
        userRoleMapper.deleteByUserId(resources.getId());
        userRoleMapper.insertData(resources.getId(), resources.getRoles());
        if (!ObjectUtils.isEmpty(resources.getRoles())) {
            userRoleMapper.deleteByUserId(resources.getId());
            userRoleMapper.insertData(resources.getId(), resources.getRoles());
        }
    }
    @Override