feige
2024-08-22 5e2ebcceae4bc34b46370f2c10110cd72e7f4fba
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package com.ruoyi.service.impl;
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.domain.SysUserRole1;
import com.ruoyi.mapper.ZfRegisterMapper;
import com.ruoyi.service.ZfRegisterService;
import org.springframework.stereotype.Service;
 
/**
 * @Version 1.0
 * @Author Jin_quan Ou
 * @Date 2023-03-13 0:07
 */
@Service
public class ZfRegisterServiceImpl extends ServiceImpl<ZfRegisterMapper, SysUserRole1> implements ZfRegisterService {
 
    @Override
    public void setRoleToUser(Long userId, Long roleId) {
        SysUserRole1 sysUserRole = new SysUserRole1();
        sysUserRole.setUserId(userId);
        sysUserRole.setRoleId(roleId);
        boolean save = save(sysUserRole);
        System.out.println(save);
    }
 
    @Override
    public SysUserRole1 selectUserRole(Long userId) {
        LambdaQueryWrapper<SysUserRole1> lqw = new LambdaQueryWrapper<>();
        lqw.eq(SysUserRole1::getUserId,userId);
        SysUserRole1 sys = getOne(lqw);
        System.out.println(sys);
        return  sys;
    }
}