forked from gzzfw/backEnd/gz-dyh

huangh
2024-10-29 c1a463b9f1c0a7160dbd0ac1c7490eef13861a5e
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtUseroleService.java
@@ -12,13 +12,11 @@
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.PostConstruct;
import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -155,4 +153,28 @@
    public  List<String> listRoleCode(String userId){
        return mapper.listRoleCode(userId);
    }
    /**
     * 根据用户编号物理删除
     * @param userId 用户编号
     */
    public void deleteByUserId(String userId){
        try{
            QueryWrapper<CtUserole> ctUseroleQueryWrapper = new QueryWrapper<>();
            ctUseroleQueryWrapper.eq("user_id", userId);
            mapper.delete(ctUseroleQueryWrapper);
        }catch (Exception e){
            log.error("[CtUseroleService.deleteByUserId]调用失败,异常信息:"+e, e);
            throw new ServiceException("CtUseroleService.deleteByUserId", e);
        }
    }
    /**
     * 根据用户编号获取其角色名称
     * @param userId 用户编号
     * @return List<String>
     */
    public  List<String> listRoleName(String userId){
        return mapper.listRoleName(userId);
    }
}