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 implements HttpApiService { @Override public HttpApiEntity selectXstHttpTagApi() { return baseDao.selectOne(new QueryWrapper().eq("code","xstHttpTag")); } @Override public HttpApiEntity get(String id) { return baseDao.selectById(id); } @Override public HttpApiEntity getByCode(String code) { return baseDao.selectOne(new QueryWrapper().eq("code", code)); } @Override public PageData page(Map params) { IPage page = baseDao.selectPage( getPage(params, "create_time", false), getWrapper(params) ); return getPageData(page, HttpApiEntity.class); } @Override public List list() { List page = baseDao.selectList(new QueryWrapper<>()); return page; } private QueryWrapper getWrapper(Map params){ String name = (String)params.get("name"); QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank(name), "name", name); return wrapper; } }