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;
|
}
|
}
|