add:标准公开征求意见

This commit is contained in:
zzy
2021-06-05 15:34:43 +08:00
parent 99c2dd95ce
commit 9ce1094070
19 changed files with 433 additions and 292 deletions
@@ -1,23 +1,22 @@
package com.adc.da.sys.controller;
package com.adc.da.slrs.sarStandIdea.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.adc.da.slrs.sarStandIdea.entity.DelStandDto;
import com.adc.da.slrs.sarStandIdea.entity.DetAllStandDto;
import com.adc.da.slrs.sarStandIdea.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 com.adc.da.slrs.sarStandIdea.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>
@@ -29,40 +28,41 @@ import java.util.List;
*/
@RestController
@Api(description = "|SarPublicIdeaAll|")
@RequestMapping("/${restPath}/sys/sar-public-idea-all")
@RequestMapping("/${restPath}/slrs/sar-public-idea-all")
public class SarPublicIdeaAllController extends BaseController<SarPublicIdeaAll> {
@Autowired
private ISarPublicIdeaAllService iSarPublicIdeaAllService;
private SarPublicIdeaAllServiceImpl sarPublicIdeaAllImpl;
@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);
@GetMapping("/getAllStand")
public ResponseMessage getAllStand(DetAllStandDto detAllStandDto){
IPage<SarPublicIdeaAll> publicList =sarPublicIdeaAllImpl.selectAll(detAllStandDto);
return Result.success("200",publicList);
}
@ApiOperation(value = "增加意见")
@GetMapping("/inserdallStand")
@GetMapping("/insetStand")
public ResponseMessage addAllStand(SarPublicIdeaAll sar){
String src=iSarPublicIdeaAllService.add(sar);
String src=sarPublicIdeaAllImpl.add(sar);
return Result.success("200",src);
}
@ApiOperation(value = "删除意见")
@GetMapping("/deleteStand")
public ResponseMessage deleteStand(String id){
String src=iSarPublicIdeaAllService.delete(id);
public ResponseMessage deleteStand(DelStandDto delStandDto){
String src=sarPublicIdeaAllImpl.delete(delStandDto);
return Result.success("200",src);
}
@ApiOperation(value = "修改意见")
@GetMapping("/updateStand")
public ResponseMessage updateStand(SarPublicIdeaAll sarPublicIdeaAll){
String src=iSarPublicIdeaAllService.updaetById(sarPublicIdeaAll);
public ResponseMessage updateStand(SarPublicIdeaAll sarPublicIdeaAll,String autUserId){
String src=sarPublicIdeaAllImpl.updateById(sarPublicIdeaAll,autUserId);
return Result.success("200",src);
}
@@ -71,8 +71,8 @@ public class SarPublicIdeaAllController extends BaseController<SarPublicIdeaAll>
@ApiOperation(value = "导出全部意见")
@GetMapping("/tuallStand")
public ResponseMessage getAllStand(HttpServletResponse response){
String src=iSarPublicIdeaAllService.stuListExcel(response);
public ResponseMessage getAllStand(HttpServletResponse response,String cid){
String src=sarPublicIdeaAllImpl.stuListExcel(response,cid);
return Result.success("200",src);
}
@@ -0,0 +1,47 @@
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.Impl.SarPublicIdeaServiceImpl;
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.*;
import com.adc.da.slrs.sarStandIdea.entity.SarPublicIdea;
import io.swagger.annotations.Api;
import com.adc.da.base.web.BaseController;
/**
* <p>
* 前端控制器
* </p>
*
* @author super_liu
* @since 2021-06-02
*/
@RestController
@Api(description = "|SarPublicIdea|")
@RequestMapping("/${restPath}/slrs/sar-public-idea")
public class SarPublicIdeaController extends BaseController<SarPublicIdea> {
@Autowired
private SarPublicIdeaServiceImpl 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);
}
@ApiOperation(value = "动态查询")
@GetMapping("/SelectByo")
public ResponseMessage selectByDynamic(SeByoDto seByoDto){
IPage<SarPublicIdea> publicList =sarPublicIdeaService.selectAllDynamic(seByoDto);
return Result.success(publicList);
}
}
@@ -1,11 +1,9 @@
package com.adc.da.sys.dao;
package com.adc.da.slrs.sarStandIdea.dao;
import com.adc.da.sys.entity.SarPublicIdeaAll;
import com.adc.da.slrs.sarStandIdea.entity.SarPublicIdeaAll;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* <p>
* Mapper 接口
@@ -1,6 +1,7 @@
package com.adc.da.sys.dao;
package com.adc.da.slrs.sarStandIdea.dao;
import com.adc.da.sys.entity.SarPublicIdea;
import com.adc.da.slrs.sarStandIdea.entity.SarPublicIdea;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
@@ -0,0 +1,31 @@
package com.adc.da.slrs.sarStandIdea.entity;
public class DelStandDto {
private String id;
private String userId;
private String autUserId;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getAutUserId() {
return autUserId;
}
public void setAutUserId(String autUserId) {
this.autUserId = autUserId;
}
}
@@ -0,0 +1,40 @@
package com.adc.da.slrs.sarStandIdea.entity;
public class DetAllStandDto {
Integer page;
Integer size;
String cid;
String userId;
public Integer getPage() {
return page;
}
public void setPage(Integer page) {
this.page = page;
}
public Integer getSize() {
return size;
}
public void setSize(Integer size) {
this.size = size;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getCid() {
return cid;
}
public void setCid(String cid) {
this.cid = cid;
}
}
@@ -1,4 +1,4 @@
package com.adc.da.sys.entity;
package com.adc.da.slrs.sarStandIdea.entity;
import com.adc.da.base.entity.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableName;
@@ -26,36 +26,36 @@ import org.springframework.format.annotation.DateTimeFormat;
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("SAR_PUBLIC_IDEA")
@TableName("sar_public_idea")
@ApiModel(value="SarPublicIdea对象", description="")
public class SarPublicIdea extends BaseEntity {
private static final long serialVersionUID = 1L;
@TableId("ID")
@TableId("id")
private String id;
@TableField("CATEGORG")
private String categorg;
@TableField("category")
private String category;
@TableField("CID")
@TableField("cid")
private String cid;
@TableField("CNAME")
@TableField("cname")
private String cname;
@TableField("STARTTIME")
@TableField("start_time")
@DateTimeFormat(pattern="yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
private Date starttime;
private Date startTime;
@TableField("ENDTIME")
@TableField("end_time")
@DateTimeFormat(pattern="yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
private Date endtime;
private Date endTime;
@TableField("VALIG_FLAG")
private String valigFlag;
@TableField("category_flag")
private String categoryFlag;
}
@@ -1,4 +1,4 @@
package com.adc.da.sys.entity;
package com.adc.da.slrs.sarStandIdea.entity;
import com.adc.da.base.entity.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableId;
@@ -21,27 +21,25 @@ import lombok.experimental.Accessors;
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("SAR_PUBLIC_IDEA_ALL")
@TableName("sar_public_idea_all")
@ApiModel(value="SarPublicIdeaAll对象", description="")
public class SarPublicIdeaAll extends BaseEntity {
@TableId
private String id;
@TableField("CID")
@TableField("cid")
private String cid;
@TableField("PART_CODE")
@TableField("part_code")
private String partCode;
@TableField("COUNTENT")
private String countent;
@TableField("content")
private String content;
@TableField("DEPARTMENT")
private String department;
@TableField("USER")
private String user;
@TableField("user_id")
private String userId;
public static final String CID = "cid";
}
@@ -0,0 +1,59 @@
package com.adc.da.slrs.sarStandIdea.entity;
public class SeByoDto {
Integer page;
Integer size;
String category;
String cname;
String startTime;
String endTime;
public Integer getPage() {
return page;
}
public void setPage(Integer page) {
this.page = page;
}
public Integer getSize() {
return size;
}
public void setSize(Integer size) {
this.size = size;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getCname() {
return cname;
}
public void setCname(String cname) {
this.cname = cname;
}
public String getStartTime() {
return startTime;
}
public void setStartTime(String startTime) {
this.startTime = startTime;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
}
@@ -0,0 +1,30 @@
package com.adc.da.slrs.sarStandIdea.service;
import com.adc.da.slrs.sarStandIdea.entity.DelStandDto;
import com.adc.da.slrs.sarStandIdea.entity.DetAllStandDto;
import com.adc.da.slrs.sarStandIdea.entity.SarPublicIdeaAll;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import javax.servlet.http.HttpServletResponse;
/**
* <p>
* 服务类
* </p>
*
* @author super_liu
* @since 2021-06-02
*/
public interface ISarPublicIdeaAllService extends IService<SarPublicIdeaAll> {
IPage<SarPublicIdeaAll> selectAll(DetAllStandDto detAllStandDto);
String add(SarPublicIdeaAll sarPublicIdeaAll);
String updateById(SarPublicIdeaAll sarPublicIdeaAll, String autUseerid);
String delete(DelStandDto delStandDto);
String del(String id);
String stuListExcel(HttpServletResponse response,String cid);
}
@@ -0,0 +1,23 @@
package com.adc.da.slrs.sarStandIdea.service;
import com.adc.da.slrs.sarStandIdea.entity.SarPublicIdea;
import com.adc.da.slrs.sarStandIdea.entity.SeByoDto;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <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> selectAllDynamic(SeByoDto seByoDto);
}
@@ -1,14 +1,19 @@
package com.adc.da.sys.service.impl;
package com.adc.da.slrs.sarStandIdea.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 cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.IdUtil;
import com.adc.da.slrs.sarStandIdea.dao.SarPublicIdeaAllDao;
import com.adc.da.slrs.sarStandIdea.entity.DelStandDto;
import com.adc.da.slrs.sarStandIdea.entity.DetAllStandDto;
import com.adc.da.slrs.sarStandIdea.entity.SarPublicIdeaAll;
import com.adc.da.slrs.sarStandIdea.service.ISarPublicIdeaAllService;
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.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
@@ -37,10 +42,10 @@ public class SarPublicIdeaAllServiceImpl extends ServiceImpl<SarPublicIdeaAllDao
@Override
public IPage<SarPublicIdeaAll> SelectAll(Integer p,Integer size,String cid){
public IPage<SarPublicIdeaAll> selectAll(DetAllStandDto detAllStandDto){
QueryWrapper<SarPublicIdeaAll> wrapper = new QueryWrapper<>();
wrapper.eq("CID",cid);
Page<SarPublicIdeaAll> page = new Page<>(p, size);
wrapper.eq("CID",detAllStandDto.getCid());
Page<SarPublicIdeaAll> page = new Page<>(detAllStandDto.getPage(),detAllStandDto.getSize());
IPage<SarPublicIdeaAll> userIPage = sarPublicIdeaAllDao.selectPage(page, wrapper);
System.out.println("总条数"+userIPage.getTotal());
System.out.println("总页数"+userIPage.getPages());
@@ -49,36 +54,53 @@ public class SarPublicIdeaAllServiceImpl extends ServiceImpl<SarPublicIdeaAllDao
@Override
public String add(SarPublicIdeaAll sar) {
if (!sar.getId().isEmpty()){
sar.setId(UUIDUtils.randomUUID10());
if (!StringUtils.isBlank(sar.getId())) {
Snowflake snowflake = IdUtil.createSnowflake(1, 1);
sar.setId(String.valueOf(snowflake.nextId()));
sarPublicIdeaAllDao.insert(sar);
return "增加成功";
}
return "增加失败";
}
@Override
public String delete(String id) {
if (sarPublicIdeaAllDao.deleteById(id)==1){
sarPublicIdeaAllDao.deleteById(id);
return "删除成功";
} else return "删除失败,不存在该数据";
public String updateById(SarPublicIdeaAll sar, String autUseerid) {
if(sar.getUserId().equals(autUseerid)){
sarPublicIdeaAllDao.updateById(sar);
return "修改成功";
}else {
return "修改失败";
}
}
@Override
public String updaetById(SarPublicIdeaAll sar) {
sarPublicIdeaAllDao.updateById(sar);
return "删除成功";
public String delete(DelStandDto delStandDto) {
if (delStandDto.getUserId().equals(delStandDto.getAutUserId())){
return del(delStandDto.getId());
}else {
return "删除失败,不能删除别人的意见";
}
}
@Override
public String del(String id) {
sarPublicIdeaAllDao.deleteById(id);
return "删除成功";
}
@Override
public String stuListExcel(HttpServletResponse response) {
List<SarPublicIdeaAll> data=sarPublicIdeaAllDao.selectList(null);
public String stuListExcel(HttpServletResponse response,String cid) {
QueryWrapper<SarPublicIdeaAll> wrapper = new QueryWrapper<>();
wrapper.eq(SarPublicIdeaAll.CID,cid);
List<SarPublicIdeaAll> data=sarPublicIdeaAllDao.selectList(wrapper);
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyyMMdd hhmmss");
Workbook wb = new XSSFWorkbook();
//标题行抽出字段
String[] title = {"", "标准或政策编号","章节编号", "内容", "提出部门", "提出人"};
String[] title = {"", "标准或政策编号","章节编号", "内容","提出人"};
//设置sheet名称并创建新的sheet对象
String sheetName = "意见信息一览";
Sheet stuSheet = wb.createSheet(sheetName);
@@ -103,9 +125,8 @@ public class SarPublicIdeaAllServiceImpl extends ServiceImpl<SarPublicIdeaAllDao
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());
row.createCell(3).setCellValue(data.get(i).getContent());
row.createCell(4).setCellValue(data.get(i).getUserId());
}
@@ -115,7 +136,7 @@ public class SarPublicIdeaAllServiceImpl extends ServiceImpl<SarPublicIdeaAllDao
stuSheet.setColumnWidth(i, stuSheet.getColumnWidth(i) * 15 / 10);
}
//获取配置文件中保存对应excel文件的路径本地也可以直接写成Fexcel/stuInfoExcel路径
String folderPath = "D:/upload/";
String folderPath = "D:/";
//设置文件名
String fileName = sdf1.format(new Date()) + sheetName + ".xlsx";
@@ -157,7 +178,9 @@ public class SarPublicIdeaAllServiceImpl extends ServiceImpl<SarPublicIdeaAllDao
i = bis.read(buffer);
}
file.delete();
return "下载成功";
} catch (Exception e) {
e.printStackTrace();
} finally {
@@ -171,12 +194,14 @@ public class SarPublicIdeaAllServiceImpl extends ServiceImpl<SarPublicIdeaAllDao
if (fis != null) {
try {
fis.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
file.delete();
return "下载失败";
}
@@ -0,0 +1,104 @@
package com.adc.da.slrs.sarStandIdea.service.Impl;
import com.adc.da.slrs.sarStandIdea.dao.SarPublicIdeaDao;
import com.adc.da.slrs.sarStandIdea.entity.SarPublicIdea;
import com.adc.da.slrs.sarStandIdea.entity.SeByoDto;
import com.adc.da.slrs.sarStandIdea.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.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.ParseException;
import java.text.SimpleDateFormat;
/**
* <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;
}
/**
*
* @param seByoDto
* @return
*/
@Override
public IPage<SarPublicIdea> selectAllDynamic(SeByoDto seByoDto) {
SarPublicIdea sar = new SarPublicIdea();
sar.setCategory(seByoDto.getCategory());
sar.setCname(seByoDto.getCname());
SimpleDateFormat formater = new SimpleDateFormat();
formater.applyPattern("yyyy-MM-dd");
try {
if (seByoDto.getStartTime()!=null){
sar.setStartTime(formater.parse(seByoDto.getStartTime()));
}
if (seByoDto.getEndTime()!=null){
sar.setEndTime(formater.parse(seByoDto.getEndTime()));
}
} catch (ParseException e) {
e.printStackTrace();
}
QueryWrapper<SarPublicIdea> wrapper = new QueryWrapper<>();
if (sar.getCategory()!=null&&sar.getCategory().length()!=0){
wrapper.like("category",sar.getCategory());
}
if (sar.getCname()!=null&&sar.getCname().length()!=0){
wrapper.like("cname",sar.getCname());
}
if (sar.getStartTime()!=null){
wrapper.le("start_time",sar.getStartTime());
}
if (sar.getEndTime()!=null){
wrapper.gt("end_time",sar.getEndTime());
}
// list.eq(StringUtils.isNotEmpty(sar.getCategory()),"category",sar.getCategory())
// .like(StringUtils.isNotEmpty(sar.getCname()),"cname",sar.getCname())
// .gt(sar.getStartTime()!=null,"start_time",sar.getStartTime())
// .le(sar.getEndTime()!=null,"end_time",sar.getEndTime());
Page<SarPublicIdea> page = new Page<>(seByoDto.getPage(), seByoDto.getSize());
IPage<SarPublicIdea> userIPage = sarPublicIdeaDao.selectPage(page, wrapper);
System.out.println("总条数"+userIPage.getTotal());
System.out.println("总页数"+userIPage.getPages());
return userIPage;
}
}
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.adc.da.sys.dao.SarPublicIdeaAllDao">
<mapper namespace="com.adc.da.slrs.sarStandIdea.dao.SarPublicIdeaAllDao">
</mapper>
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.adc.da.sys.dao.SarPublicIdeaDao">
<mapper namespace="com.adc.da.slrs.sarStandIdea.dao.SarPublicIdeaDao">
</mapper>
@@ -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,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);
}
@@ -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;
}
}