通知公告优化,增加历史通知
This commit is contained in:
parent
36ea17cf7d
commit
9031f22fbb
|
@ -1,37 +1,20 @@
|
||||||
package org.jeecg.modules.kc.zyGonggao.controller;
|
package org.jeecg.modules.kc.zyGonggao.controller;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.net.URLDecoder;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.system.query.QueryGenerator;
|
import org.jeecg.common.system.query.QueryGenerator;
|
||||||
import org.jeecg.common.util.oConvertUtils;
|
|
||||||
import org.jeecg.modules.kc.zyGonggao.entity.ZyGonggao;
|
import org.jeecg.modules.kc.zyGonggao.entity.ZyGonggao;
|
||||||
import org.jeecg.modules.kc.zyGonggao.service.IZyGonggaoService;
|
import org.jeecg.modules.kc.zyGonggao.service.IZyGonggaoService;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
|
||||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
|
||||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
|
||||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
|
||||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
|
||||||
import org.jeecg.common.system.base.controller.JeecgController;
|
import org.jeecg.common.system.base.controller.JeecgController;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||||
|
@ -98,8 +81,19 @@ public class ZyGonggaoController extends JeecgController<ZyGonggao, IZyGonggaoSe
|
||||||
@ApiOperation(value="公告-编辑", notes="公告-编辑")
|
@ApiOperation(value="公告-编辑", notes="公告-编辑")
|
||||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||||
public Result<String> edit(@RequestBody ZyGonggao zyGonggao) {
|
public Result<String> edit(@RequestBody ZyGonggao zyGonggao) {
|
||||||
|
String res = "编辑成功!";
|
||||||
zyGonggaoService.updateById(zyGonggao);
|
zyGonggaoService.updateById(zyGonggao);
|
||||||
return Result.OK("编辑成功!");
|
if(zyGonggao.getFlag()!=null){
|
||||||
|
if(zyGonggao.getFlag().equals("1")){
|
||||||
|
res = "发布成功!";
|
||||||
|
}
|
||||||
|
if(zyGonggao.getFlag().equals("0")){
|
||||||
|
res = "撤回成功!";
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
zyGonggaoService.addHistory(zyGonggao);
|
||||||
|
}
|
||||||
|
return Result.OK(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -173,4 +167,15 @@ public class ZyGonggaoController extends JeecgController<ZyGonggao, IZyGonggaoSe
|
||||||
return super.importExcel(request, response, ZyGonggao.class);
|
return super.importExcel(request, response, ZyGonggao.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@AutoLog(value = "公告历史-分页列表查询")
|
||||||
|
@ApiOperation(value="公告历史-分页列表查询", notes="公告历史-分页列表查询")
|
||||||
|
@GetMapping(value = "/historyList")
|
||||||
|
public Result<IPage<ZyGonggao>> queryHistoryPageList(ZyGonggao zyGonggao,
|
||||||
|
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||||
|
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||||
|
HttpServletRequest req) {
|
||||||
|
Page<ZyGonggao> pageList = zyGonggaoService.findHistoryPage(zyGonggao,new Page<ZyGonggao>(pageNo, pageSize));
|
||||||
|
return Result.OK(pageList);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,10 +4,8 @@ import java.io.Serializable;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
@ -48,8 +46,8 @@ public class ZyGonggao implements Serializable {
|
||||||
@ApiModelProperty(value = "updateBy")
|
@ApiModelProperty(value = "updateBy")
|
||||||
private java.lang.String updateBy;
|
private java.lang.String updateBy;
|
||||||
/**updateTime*/
|
/**updateTime*/
|
||||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||||
@ApiModelProperty(value = "updateTime")
|
@ApiModelProperty(value = "updateTime")
|
||||||
private java.util.Date updateTime;
|
private java.util.Date updateTime;
|
||||||
/**标题*/
|
/**标题*/
|
||||||
|
@ -72,6 +70,11 @@ public class ZyGonggao implements Serializable {
|
||||||
@ApiModelProperty(value = "发布时间")
|
@ApiModelProperty(value = "发布时间")
|
||||||
private java.util.Date fbTime;
|
private java.util.Date fbTime;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private java.lang.String flag;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private java.lang.String originId;
|
||||||
|
|
||||||
private java.lang.String rwbh;
|
private java.lang.String rwbh;
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,11 @@ package org.jeecg.modules.kc.zyGonggao.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.jeecg.modules.kc.zyGonggao.entity.ZyGonggao;
|
import org.jeecg.modules.kc.zyGonggao.entity.ZyGonggao;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.jeecg.modules.zyk.entity.ZykInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 公告
|
* @Description: 公告
|
||||||
|
@ -13,5 +15,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
* @Version: V1.0
|
* @Version: V1.0
|
||||||
*/
|
*/
|
||||||
public interface ZyGonggaoMapper extends BaseMapper<ZyGonggao> {
|
public interface ZyGonggaoMapper extends BaseMapper<ZyGonggao> {
|
||||||
|
void addHistory(ZyGonggao zyGonggao);
|
||||||
|
List<ZyGonggao> findHistoryPage(Page<ZyGonggao> page, ZyGonggao params);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,57 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="org.jeecg.modules.kc.zyGonggao.mapper.ZyGonggaoMapper">
|
<mapper namespace="org.jeecg.modules.kc.zyGonggao.mapper.ZyGonggaoMapper">
|
||||||
|
<insert id="addHistory" parameterType="org.jeecg.modules.kc.zyGonggao.entity.ZyGonggao">
|
||||||
|
insert into zy_gonggao_history(
|
||||||
|
id,
|
||||||
|
create_by,
|
||||||
|
create_time,
|
||||||
|
update_by,
|
||||||
|
update_time,
|
||||||
|
origin_id,
|
||||||
|
title,
|
||||||
|
content,
|
||||||
|
gg_status,
|
||||||
|
fb_time,
|
||||||
|
rwbh,
|
||||||
|
xqxn
|
||||||
|
)
|
||||||
|
values(
|
||||||
|
#{id},
|
||||||
|
#{createBy},
|
||||||
|
#{createTime},
|
||||||
|
#{updateBy},
|
||||||
|
#{updateTime},
|
||||||
|
#{originId},
|
||||||
|
#{title},
|
||||||
|
#{content},
|
||||||
|
#{ggStatus},
|
||||||
|
#{fbTime},
|
||||||
|
#{rwbh},
|
||||||
|
#{xqxn}
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<select id="findHistoryPage" parameterType="org.jeecg.modules.kc.zyGonggao.entity.ZyGonggao" resultType="org.jeecg.modules.kc.zyGonggao.entity.ZyGonggao">
|
||||||
|
SELECT
|
||||||
|
id,
|
||||||
|
create_by,
|
||||||
|
create_time,
|
||||||
|
update_by,
|
||||||
|
update_time,
|
||||||
|
origin_id,
|
||||||
|
title,
|
||||||
|
content,
|
||||||
|
gg_status,
|
||||||
|
fb_time,
|
||||||
|
rwbh,
|
||||||
|
xqxn
|
||||||
|
FROM zy_gonggao_history
|
||||||
|
where origin_id = #{params.id}
|
||||||
|
<if test="params.title != null and params.title != ''">
|
||||||
|
and title like CONCAT('%', #{params.title}, '%')
|
||||||
|
</if>
|
||||||
|
order by update_time desc
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
|
@ -1,5 +1,6 @@
|
||||||
package org.jeecg.modules.kc.zyGonggao.service;
|
package org.jeecg.modules.kc.zyGonggao.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import org.jeecg.modules.kc.zyGonggao.entity.ZyGonggao;
|
import org.jeecg.modules.kc.zyGonggao.entity.ZyGonggao;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
@ -10,5 +11,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
* @Version: V1.0
|
* @Version: V1.0
|
||||||
*/
|
*/
|
||||||
public interface IZyGonggaoService extends IService<ZyGonggao> {
|
public interface IZyGonggaoService extends IService<ZyGonggao> {
|
||||||
|
void addHistory(ZyGonggao zyGonggao);
|
||||||
|
Page<ZyGonggao> findHistoryPage(ZyGonggao zyGonggao, Page<ZyGonggao> page);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package org.jeecg.modules.kc.zyGonggao.service.impl;
|
package org.jeecg.modules.kc.zyGonggao.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.incrementer.DefaultIdentifierGenerator;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import org.jeecg.modules.kc.zyGonggao.entity.ZyGonggao;
|
import org.jeecg.modules.kc.zyGonggao.entity.ZyGonggao;
|
||||||
import org.jeecg.modules.kc.zyGonggao.mapper.ZyGonggaoMapper;
|
import org.jeecg.modules.kc.zyGonggao.mapper.ZyGonggaoMapper;
|
||||||
import org.jeecg.modules.kc.zyGonggao.service.IZyGonggaoService;
|
import org.jeecg.modules.kc.zyGonggao.service.IZyGonggaoService;
|
||||||
|
@ -7,6 +9,8 @@ import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 公告
|
* @Description: 公告
|
||||||
* @Author: jeecg-boot
|
* @Author: jeecg-boot
|
||||||
|
@ -16,4 +20,18 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
@Service
|
@Service
|
||||||
public class ZyGonggaoServiceImpl extends ServiceImpl<ZyGonggaoMapper, ZyGonggao> implements IZyGonggaoService {
|
public class ZyGonggaoServiceImpl extends ServiceImpl<ZyGonggaoMapper, ZyGonggao> implements IZyGonggaoService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addHistory(ZyGonggao zyGonggao){
|
||||||
|
zyGonggao.setOriginId(zyGonggao.getId());
|
||||||
|
Long id = new DefaultIdentifierGenerator().nextId(new ZyGonggao());
|
||||||
|
zyGonggao.setId(id.toString());
|
||||||
|
baseMapper.addHistory(zyGonggao);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<ZyGonggao> findHistoryPage(ZyGonggao zyGonggao, Page<ZyGonggao> page){
|
||||||
|
List<ZyGonggao> list = baseMapper.findHistoryPage(page,zyGonggao);
|
||||||
|
page.setRecords(list);
|
||||||
|
return page;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue