嗨森逛服务
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
hai-server/hai-service/src/main/java/com/hai/service/impl/BsRechargeCodeServiceImpl.java

68 lines
2.1 KiB

package com.hai.service.impl;
import com.hai.dao.BsRechargeCodeMapper;
import com.hai.entity.BsRechargeCode;
import com.hai.entity.BsRechargeCodeExample;
import com.hai.service.BsRechargeCodeService;
import org.apache.commons.collections4.MapUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@Service("bsRechargeCodeService")
public class BsRechargeCodeServiceImpl implements BsRechargeCodeService {
@Resource
private BsRechargeCodeMapper rechargeCodeMapper;
@Override
public void insertRechargeCode(BsRechargeCode rechargeCode) {
rechargeCodeMapper.insert(rechargeCode);
}
@Override
public void updateRechargeCode(BsRechargeCode rechargeCode) {
rechargeCodeMapper.updateByPrimaryKeySelective(rechargeCode);
}
@Override
public List<BsRechargeCode> getListRechargeCode(Map<String, Object> map) {
BsRechargeCodeExample example = new BsRechargeCodeExample();
BsRechargeCodeExample.Criteria criteria = example.createCriteria();
return rechargeCodeMapper.selectByExample(example);
}
@Override
public BsRechargeCode findByMap(Map<String, Object> map) {
BsRechargeCodeExample example = new BsRechargeCodeExample();
BsRechargeCodeExample.Criteria criteria = example.createCriteria();
if (MapUtils.getInteger(map, "type") != null) {
criteria.andTypeEqualTo(MapUtils.getInteger(map, "type"));
}
if (MapUtils.getString(map, "sourceId") != null) {
criteria.andSourceIdEqualTo(MapUtils.getString(map, "sourceId"));
}
if (MapUtils.getInteger(map, "rechargePlatform") != null) {
criteria.andRechargePlatformEqualTo(MapUtils.getInteger(map, "rechargePlatform"));
}
List<BsRechargeCode> list = rechargeCodeMapper.selectByExample(example);
if (list.size() > 0) {
return list.get(0);
}
return null;
}
@Override
public BsRechargeCode findById(Long id) {
return rechargeCodeMapper.selectByPrimaryKey(id);
}
}