| | |
| | | import cn.huge.module.client.api.impl.UtilsClientImpl; |
| | | import cn.huge.module.ctuser.dao.mapper.CtUseroleMapper; |
| | | import cn.huge.module.ctuser.domain.po.CtUserole; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | @Service |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public class CtUseroleService extends ServiceImpl<CtUseroleMapper, CtUserole>{ |
| | | |
| | | @Autowired |
| | | private RedisTemplate<String, Object> redisTemplate; |
| | | |
| | | @Autowired |
| | | private CtUseroleMapper mapper; |
| | |
| | | */ |
| | | public void saveCtUserole(CtUserole ctUserole){ |
| | | try{ |
| | | Date nowDate = DateUtils.getMowDate(); |
| | | Date nowDate = DateUtils.getNowDate(); |
| | | // 判断是否新增 |
| | | if (IdUtils.checkNewId(ctUserole.getId())){ |
| | | ctUserole.setId(utilsClient.getNewTimeId()); |
| | |
| | | } |
| | | } |
| | | |
| | | } |
| | | /** |
| | | * 根据userId查询 |
| | | * @param userId 用户编号 |
| | | * @return |
| | | */ |
| | | public List<CtUserole> listByUserId(String userId){ |
| | | QueryWrapper<CtUserole> ctUseroleQueryWrapper = new QueryWrapper<>(); |
| | | ctUseroleQueryWrapper.eq("user_id", userId); |
| | | List<CtUserole> ctUseroleList = mapper.selectList(ctUseroleQueryWrapper); |
| | | return ctUseroleList; |
| | | } |
| | | |
| | | } |