xiaoyong931011
2021-11-10 fc1773400e95b39a7acd97074dd41a3fe9c302d4
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
39
40
41
42
43
package com.xzx.gc.pay.service;
 
 
import cn.hutool.core.convert.Convert;
import com.xzx.gc.common.constant.Constants;
import com.xzx.gc.entity.AccountBindInfo;
import com.xzx.gc.entity.AccountInfo;
import com.xzx.gc.pay.mapper.AccountBindInfoMapper;
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;
 
@Transactional
@Service
public class AccountBindService {
 
    @Autowired
    private AccountBindInfoMapper accountBindInfoMapper;
 
    @Autowired
    private AccountService accountService;
 
 
    /**
     * 根据账号id和类型查询
     * @return
     */
    public  List<AccountBindInfo>  findByUserId(String userId){
        Example example=new Example(AccountBindInfo.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("delFlag",Convert.toShort(Constants.DEL_NOT_FLAG));
        AccountInfo byUserId = accountService.findByUserIdForbidden(userId);
        if(byUserId!=null) {
            criteria.andEqualTo("accountId", byUserId.getAccountId());
        }
        example.orderBy("createTime").desc();
        List<AccountBindInfo> accountBindInfo1 = accountBindInfoMapper.selectByExample(example);
        return accountBindInfo1;
    }
}