feat: 意见分页查询
This commit is contained in:
+25
-4
@@ -4,7 +4,9 @@ package com.adc.da.slrs.sarStandIdea.controller;
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.http.Result;
|
||||
import com.adc.da.slrs.sarStandIdea.entity.SeByoDto;
|
||||
import com.adc.da.slrs.sarStandIdea.service.ISarPublicIdeaService;
|
||||
import com.adc.da.slrs.sarStandIdea.service.Impl.SarPublicIdeaServiceImpl;
|
||||
import com.adc.da.sys.util.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -13,6 +15,10 @@ import com.adc.da.slrs.sarStandIdea.entity.SarPublicIdea;
|
||||
import io.swagger.annotations.Api;
|
||||
import com.adc.da.base.web.BaseController;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
@@ -27,13 +33,28 @@ import com.adc.da.base.web.BaseController;
|
||||
public class SarPublicIdeaController extends BaseController<SarPublicIdea> {
|
||||
|
||||
@Autowired
|
||||
private SarPublicIdeaServiceImpl sarPublicIdeaService;
|
||||
private ISarPublicIdeaService sarPublicIdeaService;
|
||||
|
||||
@ApiOperation(value = "分页查询")
|
||||
@GetMapping("/SelectAllPage")
|
||||
public ResponseMessage selectAllPage(@RequestParam(defaultValue="1")Integer page,@RequestParam(defaultValue="10")Integer size){
|
||||
IPage<SarPublicIdea> publicList =sarPublicIdeaService.selectAllP(page,size);
|
||||
return Result.success(publicList);
|
||||
public ResponseMessage selectAllPage(@RequestParam(defaultValue="1")Integer page,@RequestParam(defaultValue="10")Integer size,String categorg, String cname,
|
||||
String start, String end){
|
||||
Date startdate = null;
|
||||
Date enddate = null;
|
||||
SimpleDateFormat formater = new SimpleDateFormat();
|
||||
formater.applyPattern("yyyy-MM-dd");
|
||||
try {
|
||||
if (start!=null){
|
||||
startdate = formater.parse(start);
|
||||
}
|
||||
if (end!=null){
|
||||
enddate=formater.parse(DateUtil.addOneDay(end));
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
IPage<SarPublicIdea> Publiclist =sarPublicIdeaService.selectAllP(page,size,categorg,cname,startdate,enddate);
|
||||
return Result.success(Publiclist);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "动态查询")
|
||||
|
||||
+3
-1
@@ -7,6 +7,8 @@ import com.adc.da.slrs.sarStandIdea.entity.SeByoDto;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
@@ -18,6 +20,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
public interface ISarPublicIdeaService extends IService<SarPublicIdea> {
|
||||
|
||||
String add(SarPublicIdea sarPublicIdea);
|
||||
IPage<SarPublicIdea> selectAllP(Integer page, Integer size);
|
||||
IPage<SarPublicIdea> selectAllP(Integer page, Integer size, String categorg, String cname, Date startdate, Date enddate);
|
||||
IPage<SarPublicIdea> selectAllDynamic(SeByoDto seByoDto);
|
||||
}
|
||||
|
||||
+11
-4
@@ -12,11 +12,13 @@ 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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -43,10 +45,15 @@ public class SarPublicIdeaServiceImpl extends ServiceImpl<SarPublicIdeaDao, SarP
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<SarPublicIdea> selectAllP(Integer p, Integer size) {
|
||||
QueryWrapper<SarPublicIdea> wrapper = new QueryWrapper<>();
|
||||
Page<SarPublicIdea> page = new Page<>(p, size);
|
||||
IPage<SarPublicIdea> userIPage = sarPublicIdeaDao.selectPage(page, wrapper);
|
||||
public IPage<SarPublicIdea> selectAllP(Integer p, Integer size, String categorg, String cname, Date start, Date end) {
|
||||
QueryWrapper<SarPublicIdea> list = new QueryWrapper<>();
|
||||
list.eq(StringUtils.isNotEmpty(categorg),"CATEGORG",categorg)
|
||||
.like(StringUtils.isNotEmpty(cname),"CNAME",cname)
|
||||
.gt(start!=null,"STARTTIME",start).
|
||||
le(end!=null,"ENDTIME",end);
|
||||
|
||||
Page<SarPublicIdea> page = new Page<>(p,size);
|
||||
IPage<SarPublicIdea> userIPage = sarPublicIdeaDao.selectPage(page, list);
|
||||
System.out.println("总条数"+userIPage.getTotal());
|
||||
System.out.println("总页数"+userIPage.getPages());
|
||||
return userIPage;
|
||||
|
||||
Reference in New Issue
Block a user