add:标准公开征求意见
This commit is contained in:
@@ -1,79 +0,0 @@
|
||||
package com.adc.da.sys.controller;
|
||||
|
||||
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.http.Result;
|
||||
import com.adc.da.sys.service.ISarPublicIdeaAllService;
|
||||
import com.adc.da.sys.service.impl.SarPublicIdeaAllServiceImpl;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import com.adc.da.sys.entity.SarPublicIdeaAll;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.adc.da.base.web.BaseController;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author super_liu
|
||||
* @since 2021-06-02
|
||||
*/
|
||||
@RestController
|
||||
@Api(description = "|SarPublicIdeaAll|")
|
||||
@RequestMapping("/${restPath}/sys/sar-public-idea-all")
|
||||
public class SarPublicIdeaAllController extends BaseController<SarPublicIdeaAll> {
|
||||
|
||||
@Autowired
|
||||
private ISarPublicIdeaAllService iSarPublicIdeaAllService;
|
||||
|
||||
|
||||
@ApiOperation(value = "查询全部意见")
|
||||
@GetMapping("/getallStand")
|
||||
public ResponseMessage getAllStand( @RequestParam(defaultValue="1")Integer page, @RequestParam(defaultValue="10")Integer size,String cid){
|
||||
IPage<SarPublicIdeaAll> Publiclist =iSarPublicIdeaAllService.SelectAll(page,size,cid);
|
||||
return Result.success(Publiclist);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "增加意见")
|
||||
@GetMapping("/inserdallStand")
|
||||
public ResponseMessage addAllStand(SarPublicIdeaAll sar){
|
||||
String src=iSarPublicIdeaAllService.add(sar);
|
||||
return Result.success("200",src);
|
||||
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除意见")
|
||||
@GetMapping("/deleteStand")
|
||||
public ResponseMessage deleteStand(String id){
|
||||
String src=iSarPublicIdeaAllService.delete(id);
|
||||
return Result.success("200",src);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "修改意见")
|
||||
@GetMapping("/updateStand")
|
||||
public ResponseMessage updateStand(SarPublicIdeaAll sarPublicIdeaAll){
|
||||
String src=iSarPublicIdeaAllService.updaetById(sarPublicIdeaAll);
|
||||
return Result.success("200",src);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ApiOperation(value = "导出全部意见")
|
||||
@GetMapping("/tuallStand")
|
||||
public ResponseMessage getAllStand(HttpServletResponse response){
|
||||
String src=iSarPublicIdeaAllService.stuListExcel(response);
|
||||
return Result.success("200",src);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
package com.adc.da.sys.controller;
|
||||
|
||||
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.http.Result;
|
||||
import com.adc.da.sys.entity.SarPublicIdeaAll;
|
||||
import com.adc.da.sys.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;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.adc.da.sys.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>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author super_liu
|
||||
* @since 2021-06-02
|
||||
*/
|
||||
@RestController
|
||||
@Api(description = "|SarPublicIdea|")
|
||||
@RequestMapping("/${restPath}/sys/sar-public-idea")
|
||||
public class SarPublicIdeaController extends BaseController<SarPublicIdea> {
|
||||
|
||||
@Autowired
|
||||
private SarPublicIdeaServiceImpl sarPublicIdeaService;
|
||||
|
||||
@ApiOperation(value = "分页查询")
|
||||
@GetMapping("/SelectAllP")
|
||||
public ResponseMessage SelectAllP(@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.SelectAllo(page,size,categorg,cname,startdate,enddate);
|
||||
return Result.success(Publiclist);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "模糊查询")
|
||||
@GetMapping("/SelectByo")
|
||||
public ResponseMessage SelectByo(@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(end);
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
IPage<SarPublicIdea> Publiclist =sarPublicIdeaService.SelectAllo(page,size,categorg,cname,startdate,enddate);
|
||||
return Result.success(Publiclist);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.adc.da.sys.dao;
|
||||
|
||||
import com.adc.da.sys.entity.SarPublicIdeaAll;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author super_liu
|
||||
* @since 2021-06-02
|
||||
*/
|
||||
@Mapper
|
||||
public interface SarPublicIdeaAllDao extends BaseMapper<SarPublicIdeaAll> {
|
||||
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.adc.da.sys.dao;
|
||||
|
||||
import com.adc.da.sys.entity.SarPublicIdea;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author super_liu
|
||||
* @since 2021-06-02
|
||||
*/
|
||||
@Mapper
|
||||
public interface SarPublicIdeaDao extends BaseMapper<SarPublicIdea> {
|
||||
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
package com.adc.da.sys.entity;
|
||||
|
||||
import com.adc.da.base.entity.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author super_liu
|
||||
* @since 2021-06-02
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@TableName("SAR_PUBLIC_IDEA")
|
||||
@ApiModel(value="SarPublicIdea对象", description="")
|
||||
public class SarPublicIdea extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId("ID")
|
||||
private String id;
|
||||
|
||||
@TableField("CATEGORG")
|
||||
private String categorg;
|
||||
|
||||
@TableField("CID")
|
||||
private String cid;
|
||||
|
||||
@TableField("CNAME")
|
||||
private String cname;
|
||||
|
||||
@TableField("STARTTIME")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
private Date starttime;
|
||||
|
||||
@TableField("ENDTIME")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
private Date endtime;
|
||||
|
||||
@TableField("VALIG_FLAG")
|
||||
private String valigFlag;
|
||||
|
||||
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package com.adc.da.sys.entity;
|
||||
|
||||
import com.adc.da.base.entity.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author super_liu
|
||||
* @since 2021-06-02
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@TableName("SAR_PUBLIC_IDEA_ALL")
|
||||
@ApiModel(value="SarPublicIdeaAll对象", description="")
|
||||
public class SarPublicIdeaAll extends BaseEntity {
|
||||
|
||||
@TableId
|
||||
private String id;
|
||||
|
||||
@TableField("CID")
|
||||
private String cid;
|
||||
|
||||
@TableField("PART_CODE")
|
||||
private String partCode;
|
||||
|
||||
@TableField("COUNTENT")
|
||||
private String countent;
|
||||
|
||||
@TableField("DEPARTMENT")
|
||||
private String department;
|
||||
|
||||
@TableField("USER")
|
||||
private String user;
|
||||
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package com.adc.da.sys.service;
|
||||
|
||||
import com.adc.da.sys.entity.SarPublicIdeaAll;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author super_liu
|
||||
* @since 2021-06-02
|
||||
*/
|
||||
public interface ISarPublicIdeaAllService extends IService<SarPublicIdeaAll> {
|
||||
|
||||
|
||||
IPage<SarPublicIdeaAll> SelectAll(Integer page,Integer size,String cid);
|
||||
String add(SarPublicIdeaAll sarPublicIdeaAll);
|
||||
String delete(String id);
|
||||
String updaetById(SarPublicIdeaAll sarPublicIdeaAll);
|
||||
String stuListExcel(HttpServletResponse response);
|
||||
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package com.adc.da.sys.service;
|
||||
|
||||
|
||||
import com.adc.da.sys.entity.SarPublicIdea;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author super_liu
|
||||
* @since 2021-06-02
|
||||
*/
|
||||
public interface ISarPublicIdeaService extends IService<SarPublicIdea> {
|
||||
|
||||
String add(SarPublicIdea sarPublicIdea);
|
||||
// IPage<SarPublicIdea> SelectAllP(Integer page,Integer size);
|
||||
IPage<SarPublicIdea> SelectAllo(Integer page, Integer size,String categorg,String cname,Date start,Date end);
|
||||
}
|
||||
-183
@@ -1,183 +0,0 @@
|
||||
package com.adc.da.sys.service.impl;
|
||||
|
||||
import com.adc.da.sys.entity.SarPublicIdeaAll;
|
||||
import com.adc.da.sys.dao.SarPublicIdeaAllDao;
|
||||
import com.adc.da.sys.service.ISarPublicIdeaAllService;
|
||||
import com.adc.da.util.UUIDUtils;
|
||||
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.poi.ss.usermodel.*;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author super_liu
|
||||
* @since 2021-06-02
|
||||
*/
|
||||
@Service
|
||||
public class SarPublicIdeaAllServiceImpl extends ServiceImpl<SarPublicIdeaAllDao, SarPublicIdeaAll> implements ISarPublicIdeaAllService {
|
||||
|
||||
@Autowired
|
||||
private SarPublicIdeaAllDao sarPublicIdeaAllDao;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public IPage<SarPublicIdeaAll> SelectAll(Integer p,Integer size,String cid){
|
||||
QueryWrapper<SarPublicIdeaAll> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("CID",cid);
|
||||
Page<SarPublicIdeaAll> page = new Page<>(p, size);
|
||||
IPage<SarPublicIdeaAll> userIPage = sarPublicIdeaAllDao.selectPage(page, wrapper);
|
||||
System.out.println("总条数"+userIPage.getTotal());
|
||||
System.out.println("总页数"+userIPage.getPages());
|
||||
return userIPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String add(SarPublicIdeaAll sar) {
|
||||
if (!sar.getId().isEmpty()){
|
||||
sar.setId(UUIDUtils.randomUUID10());
|
||||
sarPublicIdeaAllDao.insert(sar);
|
||||
return "增加成功";
|
||||
}
|
||||
return "增加失败";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String delete(String id) {
|
||||
if (sarPublicIdeaAllDao.deleteById(id)==1){
|
||||
sarPublicIdeaAllDao.deleteById(id);
|
||||
return "删除成功";
|
||||
} else return "删除失败,不存在该数据";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String updaetById(SarPublicIdeaAll sar) {
|
||||
sarPublicIdeaAllDao.updateById(sar);
|
||||
return "删除成功";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String stuListExcel(HttpServletResponse response) {
|
||||
List<SarPublicIdeaAll> data=sarPublicIdeaAllDao.selectList(null);
|
||||
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyyMMdd hhmmss");
|
||||
Workbook wb = new XSSFWorkbook();
|
||||
//标题行抽出字段
|
||||
String[] title = {"", "标准或政策编号","章节编号", "内容", "提出部门", "提出人"};
|
||||
//设置sheet名称,并创建新的sheet对象
|
||||
String sheetName = "意见信息一览";
|
||||
Sheet stuSheet = wb.createSheet(sheetName);
|
||||
//获取表头行
|
||||
Row titleRow = stuSheet.createRow(0);
|
||||
//创建单元格,设置style居中,字体,单元格大小等
|
||||
CellStyle style = wb.createCellStyle();
|
||||
Cell cell;
|
||||
//把已经写好的标题行写入excel文件中
|
||||
for (int i = 1; i < title.length; i++) {
|
||||
cell = titleRow.createCell(i);
|
||||
cell.setCellValue(title[i]);
|
||||
cell.setCellStyle(style);
|
||||
}
|
||||
//把从数据库中取得的数据一一写入excel文件中
|
||||
Row row = null;
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
//创建list.size()行数据
|
||||
row = stuSheet.createRow(i + 1);
|
||||
//把值一一写进单元格里
|
||||
//设置第一列为自动递增的序号
|
||||
row.createCell(0).setCellValue(i + 1);
|
||||
row.createCell(1).setCellValue(data.get(i).getCid());
|
||||
row.createCell(2).setCellValue(data.get(i).getPartCode());
|
||||
row.createCell(3).setCellValue(data.get(i).getCountent());
|
||||
row.createCell(4).setCellValue(data.get(i).getDepartment());
|
||||
row.createCell(5).setCellValue(data.get(i).getUser());
|
||||
|
||||
|
||||
}
|
||||
//设置单元格宽度自适应,在此基础上把宽度调至1.5倍
|
||||
for (int i = 0; i < title.length; i++) {
|
||||
stuSheet.autoSizeColumn(i, true);
|
||||
stuSheet.setColumnWidth(i, stuSheet.getColumnWidth(i) * 15 / 10);
|
||||
}
|
||||
//获取配置文件中保存对应excel文件的路径,本地也可以直接写成F:excel/stuInfoExcel路径
|
||||
String folderPath = "D:/upload/";
|
||||
|
||||
//设置文件名
|
||||
String fileName = sdf1.format(new Date()) + sheetName + ".xlsx";
|
||||
String savePath = folderPath + File.separator + fileName;
|
||||
|
||||
OutputStream fileOut = null;
|
||||
try {
|
||||
fileOut = new FileOutputStream(savePath);
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
wb.write(fileOut);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
fileOut.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
response.setContentType("application/vnd..ms-excel");
|
||||
File file = new File(folderPath, fileName);
|
||||
if (file.exists()) {
|
||||
response.setContentType("application/x-download;charset=utf-8");// 设置强制下载不打开
|
||||
response.addHeader("Content-Disposition", "attachment;fileName=" + fileName);
|
||||
byte[] buffer = new byte[1024];
|
||||
FileInputStream fis = null;
|
||||
BufferedInputStream bis = null;
|
||||
try {
|
||||
fis = new FileInputStream(file);
|
||||
bis = new BufferedInputStream(fis);
|
||||
OutputStream outputStream = response.getOutputStream();
|
||||
int i = bis.read(buffer);
|
||||
while (i != -1) {
|
||||
outputStream.write(buffer, 0, i);
|
||||
i = bis.read(buffer);
|
||||
}
|
||||
|
||||
return "下载成功";
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (bis != null) {
|
||||
try {
|
||||
bis.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (fis != null) {
|
||||
try {
|
||||
fis.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return "下载失败";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
package com.adc.da.sys.service.impl;
|
||||
|
||||
|
||||
import com.adc.da.sys.entity.SarPublicIdea;
|
||||
import com.adc.da.sys.dao.SarPublicIdeaDao;
|
||||
import com.adc.da.sys.entity.SarPublicIdeaAll;
|
||||
import com.adc.da.sys.service.ISarPublicIdeaService;
|
||||
import com.adc.da.util.UUIDUtils;
|
||||
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.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author super_liu
|
||||
* @since 2021-06-02
|
||||
*/
|
||||
@Service("PublicIdeaStandEOService")
|
||||
public class SarPublicIdeaServiceImpl extends ServiceImpl<SarPublicIdeaDao, SarPublicIdea> implements ISarPublicIdeaService {
|
||||
|
||||
@Autowired
|
||||
private SarPublicIdeaDao sarPublicIdeaDao;
|
||||
|
||||
@Override
|
||||
public String add(SarPublicIdea sarPublicIdea) {
|
||||
if (!sarPublicIdea.getId().isEmpty()){
|
||||
sarPublicIdea.setId(UUIDUtils.randomUUID10());
|
||||
sarPublicIdeaDao.insert(sarPublicIdea);
|
||||
return "增加成功";
|
||||
}
|
||||
return "增加失败";
|
||||
}
|
||||
|
||||
// @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);
|
||||
// System.out.println("总条数"+userIPage.getTotal());
|
||||
// System.out.println("总页数"+userIPage.getPages());
|
||||
// return userIPage;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public IPage<SarPublicIdea> SelectAllo(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);
|
||||
|
||||
|
||||
// list.eq(sarPublicIdea.getStarttiml()!=null,"STARTTIML",sarPublicIdea.getStarttiml());
|
||||
// list.eq(sarPublicIdea.getEndtime()!=null, "ENDTIME",sarPublicIdea.getEndtime());
|
||||
// list.like(StringUtils.isNoneEmpty(sarPublicIdea.getCname()), "CNAME", sarPublicIdea.getCname());
|
||||
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