xiaoyong931011
2021-07-15 2f2006691270d2788e32ca3eeae5a3b2faed0fc1
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
36
37
38
package com.xzx.gc.user.service;
 
 
import com.xzx.gc.common.constant.Constants;
import com.xzx.gc.entity.SysItemUser;
import com.xzx.gc.user.mapper.SysItemUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example;
 
import java.util.List;
 
@Service
@Transactional
public class SysItemUserService {
 
 
    @Autowired
    private SysItemUserMapper sysItemUserMapper;
 
 
    public List<SysItemUser> findByUserId(String userId){
        SysItemUser sysItemUser=new SysItemUser();
        sysItemUser.setUserId(userId);
        sysItemUser.setDelFlag(Constants.DEL_NOT_FLAG);
        return sysItemUserMapper.select(sysItemUser);
    }
 
    public void deleteByUserId(String userId){
        Example example=new Example(SysItemUser.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("userId",userId);
        SysItemUser sysItemUser=new SysItemUser();
        sysItemUser.setDelFlag(Constants.DEL_FLAG);
        sysItemUserMapper.updateByExampleSelective(sysItemUser,example);
    }
}