嗨森逛服务
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/ApiIpAddressServiceImpl.java

64 lines
1.8 KiB

package com.hai.service.impl;
import com.hai.dao.ApiIpAddressMapper;
import com.hai.entity.ApiIpAddress;
import com.hai.entity.ApiIpAddressExample;
import com.hai.service.ApiIpAddressService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@Service("apiIpAddressService")
public class ApiIpAddressServiceImpl implements ApiIpAddressService {
@Resource
private ApiIpAddressMapper apiIpAddressMapper;
@Override
public void insertApiIpAddress(ApiIpAddress apiIpAddress) {
apiIpAddressMapper.insert(apiIpAddress);
}
@Override
public void updateApiIpAddress(ApiIpAddress apiIpAddress) {
apiIpAddressMapper.updateByPrimaryKey(apiIpAddress);
}
@Override
public ApiIpAddress findById(Long id) {
return apiIpAddressMapper.selectByPrimaryKey(id);
}
@Override
public ApiIpAddress findByMchId(String mchId) {
ApiIpAddressExample example = new ApiIpAddressExample();
ApiIpAddressExample.Criteria criteria = example.createCriteria();
criteria.andMchIdEqualTo(mchId);
List<ApiIpAddress> list = apiIpAddressMapper.selectByExample(example);
if (list.size() > 0) {
return list.get(0);
}
return null;
}
@Override
public List<ApiIpAddress> getApiIpAddressByList(Map<String, Object> map) {
return null;
}
@Override
public Boolean validationIpAddressLegal(String mchId, String ipAddress) {
ApiIpAddressExample example = new ApiIpAddressExample();
example.createCriteria().andMchIdEqualTo(mchId).andIpAddressLike("%" + ipAddress + "%");
List<ApiIpAddress> list = apiIpAddressMapper.selectByExample(example);
return list.size()>0;
}
}