package cn.com.lzt.provider.service.impl; import cn.com.lzt.common.util.StringUtil; import cn.com.lzt.provider.service.ProviderService; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.daju.common.util.DataPage; import com.daju.mix.dao.entity.TBArchivesProvider; import com.daju.mix.dao.mapper.TBArchivesProviderMapper; import com.daju.mix.dao.service.impl.BaseServiceImpl; import org.springframework.stereotype.Service; import java.util.Map; /** * * @author :sahib.kio.m * @date :Created in 2021/7/30 上午11:43 */ @Service public class ProviderServiceImpl extends BaseServiceImpl implements ProviderService { public DataPage DefendList(Map param) { DataPage result = new DataPage(); int page = 1; if(param.containsKey("page")){ page = Integer.valueOf(param.get("page")); } int rows = 999; if(param.containsKey("rows")){ rows = Integer.valueOf(param.get("rows")); } String code = param.get("code"); String name = param.get("name"); String linkman = param.get("linkman"); String linkphone = param.get("linkphone"); String type = param.get("type"); QueryWrapper queryWrapper = new QueryWrapper<>(); String selectSql = " SELECT tbap.*" + "FROM T_b_archives_provider tbap WHERE 1 = 1 "; if(!StringUtil.isEmpty(code)){ selectSql += "and tbap.code = '" + code + "'"; } if(!StringUtil.isEmpty(name)){ selectSql += "and tbap.name like '%" + name + "%' "; } if(!StringUtil.isEmpty(linkman)){ selectSql += "and tbap.linkman like '%" + linkman + "%' "; } if(!StringUtil.isEmpty(linkphone)){ selectSql += "and tbap.linkphone like '%" + linkphone + "%' "; } if(!StringUtil.isEmpty(type)){ selectSql += "and tbap.type = '" + type + "' "; } IPage> mapPage = getBaseMapper().queryMapPageBySql(new Page<>(page, rows), queryWrapper, selectSql); result.setList(mapPage.getRecords()); result.setTotalCount((int) mapPage.getTotal()); return result; } }