ProviderServiceImpl.java 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. package cn.com.lzt.provider.service.impl;
  2. import cn.com.lzt.common.util.StringUtil;
  3. import cn.com.lzt.provider.service.ProviderService;
  4. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  5. import com.baomidou.mybatisplus.core.metadata.IPage;
  6. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  7. import com.daju.common.util.DataPage;
  8. import com.daju.mix.dao.entity.TBArchivesProvider;
  9. import com.daju.mix.dao.mapper.TBArchivesProviderMapper;
  10. import com.daju.mix.dao.service.impl.BaseServiceImpl;
  11. import org.springframework.stereotype.Service;
  12. import java.util.Map;
  13. /**
  14. *
  15. * @author :sahib.kio.m
  16. * @date :Created in 2021/7/30 上午11:43
  17. */
  18. @Service
  19. public class ProviderServiceImpl extends BaseServiceImpl<TBArchivesProviderMapper, TBArchivesProvider> implements ProviderService {
  20. public DataPage DefendList(Map<String, String> param) {
  21. DataPage result = new DataPage();
  22. int page = 1;
  23. if(param.containsKey("page")){
  24. page = Integer.valueOf(param.get("page"));
  25. }
  26. int rows = 999;
  27. if(param.containsKey("rows")){
  28. rows = Integer.valueOf(param.get("rows"));
  29. }
  30. String code = param.get("code");
  31. String name = param.get("name");
  32. String linkman = param.get("linkman");
  33. String linkphone = param.get("linkphone");
  34. String type = param.get("type");
  35. QueryWrapper<?> queryWrapper = new QueryWrapper<>();
  36. String selectSql = " SELECT tbap.*" +
  37. "FROM T_b_archives_provider tbap WHERE 1 = 1 ";
  38. if(!StringUtil.isEmpty(code)){
  39. selectSql += "and tbap.code = '" + code + "'";
  40. }
  41. if(!StringUtil.isEmpty(name)){
  42. selectSql += "and tbap.name like '%" + name + "%' ";
  43. }
  44. if(!StringUtil.isEmpty(linkman)){
  45. selectSql += "and tbap.linkman like '%" + linkman + "%' ";
  46. }
  47. if(!StringUtil.isEmpty(linkphone)){
  48. selectSql += "and tbap.linkphone like '%" + linkphone + "%' ";
  49. }
  50. if(!StringUtil.isEmpty(type)){
  51. selectSql += "and tbap.type = '" + type + "' ";
  52. }
  53. IPage<Map<String, Object>> mapPage = getBaseMapper().queryMapPageBySql(new Page<>(page, rows), queryWrapper, selectSql);
  54. result.setList(mapPage.getRecords());
  55. result.setTotalCount((int) mapPage.getTotal());
  56. return result;
  57. }
  58. }