xiaoyong931011
2021-08-04 ea868a98b776b9e89db429a195704a1412ca8905
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
44
45
package com.xzx.gc.user.service;
 
 
import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateUtil;
import com.xzx.gc.common.constant.Constants;
import com.xzx.gc.entity.AccountBindInfo;
import com.xzx.gc.user.mapper.AccountBindInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
 
@Transactional
@Service
public class AccountBindService {
 
    @Autowired
    private AccountBindInfoMapper accountBindInfoMapper;
 
 
    public void add(AccountBindInfo accountBindInfo){
        accountBindInfo.setCreateTime(DateUtil.now());
        accountBindInfo.setDelFlag(Convert.toShort(Constants.DEL_NOT_FLAG));
        accountBindInfoMapper.insertSelective(accountBindInfo);
    }
 
    public void updateById(AccountBindInfo accountBindInfo){
        accountBindInfoMapper.updateByPrimaryKeySelective(accountBindInfo);
    }
 
    /**
     * 根据账号id和类型查询
     * @param accountId
     * @param accountType
     * @return
     */
    public AccountBindInfo findByAccountIdAndType(String accountId,Short accountType){
        AccountBindInfo accountBindInfo=new AccountBindInfo();
        accountBindInfo.setDelFlag(Convert.toShort(Constants.DEL_NOT_FLAG));
        accountBindInfo.setAccountId(accountId);
        accountBindInfo.setAccountType(accountType);
        AccountBindInfo accountBindInfo1 = accountBindInfoMapper.selectOne(accountBindInfo);
        return accountBindInfo1;
    }
}