package com.iailab.module.data.http.service.impl;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.iailab.framework.common.page.PageData;
|
import com.iailab.framework.common.service.impl.BaseServiceImpl;
|
import com.iailab.module.data.http.entity.HttpApiEntity;
|
import com.iailab.module.data.http.entity.HttpApiEntity;
|
import com.iailab.module.data.http.dao.HttpApiDao;
|
import com.iailab.module.data.http.service.HttpApiService;
|
import org.apache.commons.lang3.StringUtils;
|
import org.springframework.stereotype.Service;
|
|
import java.util.List;
|
import java.util.Map;
|
|
@Service
|
public class HttpApiServiceImpl extends BaseServiceImpl<HttpApiDao, HttpApiEntity> implements HttpApiService {
|
@Override
|
public HttpApiEntity selectXstHttpTagApi() {
|
return baseDao.selectOne(new QueryWrapper<HttpApiEntity>().eq("code","xstHttpTag"));
|
}
|
|
@Override
|
public HttpApiEntity get(String id) {
|
return baseDao.selectById(id);
|
}
|
|
|
@Override
|
public HttpApiEntity getByCode(String code) {
|
return baseDao.selectOne(new QueryWrapper<HttpApiEntity>().eq("code", code));
|
}
|
|
@Override
|
public PageData<HttpApiEntity> page(Map<String, Object> params) {
|
IPage<HttpApiEntity> page = baseDao.selectPage(
|
getPage(params, "create_time", false),
|
getWrapper(params)
|
);
|
|
return getPageData(page, HttpApiEntity.class);
|
}
|
|
@Override
|
public List<HttpApiEntity> list() {
|
List<HttpApiEntity> page = baseDao.selectList(new QueryWrapper<>());
|
return page;
|
}
|
|
private QueryWrapper<HttpApiEntity> getWrapper(Map<String, Object> params){
|
String name = (String)params.get("name");
|
QueryWrapper<HttpApiEntity> wrapper = new QueryWrapper<>();
|
wrapper.eq(StringUtils.isNotBlank(name), "name", name);
|
return wrapper;
|
}
|
}
|