package com.main.service.impl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.main.dao.WbTraderMapper;
import com.main.service.WbTraderService;
import com.pojo.WbTrader;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
import java.util.Map;
@Service
public class WbTraderServiceImpl implements WbTraderService {
@Autowired
private WbTraderMapper wbTraderMapper;
@Override
public Page<WbTrader> selectAll(Map map) {
int page = (int) map.get("page");
int size = (int) map.get("size");
PageHelper.startPage((int) page,size);
Example example=new Example(WbTrader.class);
Example.Criteria criteria = example.createCriteria();
//根据id查询
//criteria.andEqualTo("id", 3);
//根据code查询
criteria.andLike("code","%"+map.get("code")+"%");
//name名称模糊查询
criteria.andLike("name","%"+map.get("name")+"%");
return (Page<WbTrader>)wbTraderMapper.selectByExample(example);
}
}
java,springboot分页和多条件查询
最新推荐文章于 2024-07-26 18:24:41 发布