新建公告用户表
This commit is contained in:
+12
-14
@@ -1,18 +1,8 @@
|
|||||||
package com.tongran.system.controller;
|
package com.tongran.system.controller;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.tongran.common.core.web.controller.BaseController;
|
import com.tongran.common.core.web.controller.BaseController;
|
||||||
import com.tongran.common.core.web.domain.AjaxResult;
|
import com.tongran.common.core.web.domain.AjaxResult;
|
||||||
|
import com.tongran.common.core.web.page.PageDomain;
|
||||||
import com.tongran.common.core.web.page.TableDataInfo;
|
import com.tongran.common.core.web.page.TableDataInfo;
|
||||||
import com.tongran.common.log.annotation.Log;
|
import com.tongran.common.log.annotation.Log;
|
||||||
import com.tongran.common.log.enums.BusinessType;
|
import com.tongran.common.log.enums.BusinessType;
|
||||||
@@ -20,6 +10,11 @@ import com.tongran.common.security.annotation.RequiresPermissions;
|
|||||||
import com.tongran.common.security.utils.SecurityUtils;
|
import com.tongran.common.security.utils.SecurityUtils;
|
||||||
import com.tongran.system.domain.SysNotice;
|
import com.tongran.system.domain.SysNotice;
|
||||||
import com.tongran.system.service.ISysNoticeService;
|
import com.tongran.system.service.ISysNoticeService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 公告 信息操作处理
|
* 公告 信息操作处理
|
||||||
@@ -37,10 +32,13 @@ public class SysNoticeController extends BaseController
|
|||||||
* 获取通知公告列表
|
* 获取通知公告列表
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:notice:list")
|
@RequiresPermissions("system:notice:list")
|
||||||
@GetMapping("/list")
|
@PostMapping("/list")
|
||||||
public TableDataInfo list(SysNotice notice)
|
public TableDataInfo list(@RequestBody SysNotice notice)
|
||||||
{
|
{
|
||||||
startPage();
|
PageDomain pageDomain = new PageDomain();
|
||||||
|
pageDomain.setPageNum(notice.getPageNum());
|
||||||
|
pageDomain.setPageSize(notice.getPageSize());
|
||||||
|
startPage(pageDomain);
|
||||||
List<SysNotice> list = noticeService.selectNoticeList(notice);
|
List<SysNotice> list = noticeService.selectNoticeList(notice);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|||||||
+63
@@ -0,0 +1,63 @@
|
|||||||
|
package com.tongran.system.controller;
|
||||||
|
|
||||||
|
import com.tongran.common.core.web.controller.BaseController;
|
||||||
|
import com.tongran.common.core.web.domain.AjaxResult;
|
||||||
|
import com.tongran.common.log.annotation.Log;
|
||||||
|
import com.tongran.common.log.enums.BusinessType;
|
||||||
|
import com.tongran.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.tongran.system.domain.SysNoticeRead;
|
||||||
|
import com.tongran.system.service.ISysNoticeReadService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告阅读记录Controller
|
||||||
|
*
|
||||||
|
* @author tongran
|
||||||
|
* @date 2026-02-12
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/sysNoticeRead")
|
||||||
|
public class SysNoticeReadController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private ISysNoticeReadService sysNoticeReadService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询公告阅读记录列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:sysNoticeRead:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
public AjaxResult list(@RequestBody SysNoticeRead sysNoticeRead)
|
||||||
|
{
|
||||||
|
List<SysNoticeRead> list = sysNoticeReadService.selectSysNoticeReadList(sysNoticeRead);
|
||||||
|
return success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增公告阅读记录
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:sysNoticeRead:add")
|
||||||
|
@Log(title = "公告阅读记录", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody SysNoticeRead sysNoticeRead)
|
||||||
|
{
|
||||||
|
return toAjax(sysNoticeReadService.insertSysNoticeRead(sysNoticeRead));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除公告阅读记录
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:sysNoticeRead:remove")
|
||||||
|
@Log(title = "公告阅读记录", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] ids)
|
||||||
|
{
|
||||||
|
return toAjax(sysNoticeReadService.deleteSysNoticeReadByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
+10
-73
@@ -1,17 +1,17 @@
|
|||||||
package com.tongran.system.domain;
|
package com.tongran.system.domain;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import javax.validation.constraints.Size;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
|
||||||
import com.tongran.common.core.web.domain.BaseEntity;
|
import com.tongran.common.core.web.domain.BaseEntity;
|
||||||
import com.tongran.common.core.xss.Xss;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通知公告表 sys_notice
|
* 通知公告表 sys_notice
|
||||||
*
|
*
|
||||||
* @author tongran
|
* @author tongran
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class SysNotice extends BaseEntity
|
public class SysNotice extends BaseEntity
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -30,73 +30,10 @@ public class SysNotice extends BaseEntity
|
|||||||
|
|
||||||
/** 公告状态(0正常 1关闭) */
|
/** 公告状态(0正常 1关闭) */
|
||||||
private String status;
|
private String status;
|
||||||
|
/** 发布状态(0 未发布,1 已发布 ) */
|
||||||
|
private String releaseStatus;
|
||||||
|
/** 发布时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date releaseTime;
|
||||||
|
|
||||||
public Long getNoticeId()
|
|
||||||
{
|
|
||||||
return noticeId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNoticeId(Long noticeId)
|
|
||||||
{
|
|
||||||
this.noticeId = noticeId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNoticeTitle(String noticeTitle)
|
|
||||||
{
|
|
||||||
this.noticeTitle = noticeTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Xss(message = "公告标题不能包含脚本字符")
|
|
||||||
@NotBlank(message = "公告标题不能为空")
|
|
||||||
@Size(min = 0, max = 50, message = "公告标题不能超过50个字符")
|
|
||||||
public String getNoticeTitle()
|
|
||||||
{
|
|
||||||
return noticeTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNoticeType(String noticeType)
|
|
||||||
{
|
|
||||||
this.noticeType = noticeType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNoticeType()
|
|
||||||
{
|
|
||||||
return noticeType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNoticeContent(String noticeContent)
|
|
||||||
{
|
|
||||||
this.noticeContent = noticeContent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNoticeContent()
|
|
||||||
{
|
|
||||||
return noticeContent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus(String status)
|
|
||||||
{
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStatus()
|
|
||||||
{
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
|
||||||
.append("noticeId", getNoticeId())
|
|
||||||
.append("noticeTitle", getNoticeTitle())
|
|
||||||
.append("noticeType", getNoticeType())
|
|
||||||
.append("noticeContent", getNoticeContent())
|
|
||||||
.append("status", getStatus())
|
|
||||||
.append("createBy", getCreateBy())
|
|
||||||
.append("createTime", getCreateTime())
|
|
||||||
.append("updateBy", getUpdateBy())
|
|
||||||
.append("updateTime", getUpdateTime())
|
|
||||||
.append("remark", getRemark())
|
|
||||||
.toString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+47
@@ -0,0 +1,47 @@
|
|||||||
|
package com.tongran.system.domain;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.tongran.common.core.annotation.Excel;
|
||||||
|
import com.tongran.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告阅读记录对象 sys_notice_read
|
||||||
|
*
|
||||||
|
* @author tongran
|
||||||
|
* @date 2026-02-12
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SysNoticeRead extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 记录ID */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 公告ID */
|
||||||
|
@Excel(name = "公告ID")
|
||||||
|
private Long noticeId;
|
||||||
|
|
||||||
|
/** 用户ID */
|
||||||
|
@Excel(name = "用户ID")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/** 用户昵称 */
|
||||||
|
@Excel(name = "用户昵称")
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
/** 已读状态(0未读 1已读) */
|
||||||
|
@Excel(name = "已读状态", readConverterExp = "0=未读,1=已读")
|
||||||
|
private String readStatus;
|
||||||
|
|
||||||
|
/** 阅读时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "阅读时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date readTime;
|
||||||
|
/** 发布状态(0 未发布,1 已发布) */
|
||||||
|
@Excel(name = "发布状态(0 未发布,1 已发布)")
|
||||||
|
private String releaseStatus;
|
||||||
|
}
|
||||||
+61
@@ -0,0 +1,61 @@
|
|||||||
|
package com.tongran.system.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.tongran.system.domain.SysNoticeRead;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告阅读记录Mapper接口
|
||||||
|
*
|
||||||
|
* @author tongran
|
||||||
|
* @date 2026-02-12
|
||||||
|
*/
|
||||||
|
public interface SysNoticeReadMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询公告阅读记录
|
||||||
|
*
|
||||||
|
* @param id 公告阅读记录主键
|
||||||
|
* @return 公告阅读记录
|
||||||
|
*/
|
||||||
|
public SysNoticeRead selectSysNoticeReadById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询公告阅读记录列表
|
||||||
|
*
|
||||||
|
* @param sysNoticeRead 公告阅读记录
|
||||||
|
* @return 公告阅读记录集合
|
||||||
|
*/
|
||||||
|
public List<SysNoticeRead> selectSysNoticeReadList(SysNoticeRead sysNoticeRead);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增公告阅读记录
|
||||||
|
*
|
||||||
|
* @param sysNoticeRead 公告阅读记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertSysNoticeRead(SysNoticeRead sysNoticeRead);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改公告阅读记录
|
||||||
|
*
|
||||||
|
* @param sysNoticeRead 公告阅读记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateSysNoticeRead(SysNoticeRead sysNoticeRead);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除公告阅读记录
|
||||||
|
*
|
||||||
|
* @param id 公告阅读记录主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteSysNoticeReadById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除公告阅读记录
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteSysNoticeReadByIds(Long[] ids);
|
||||||
|
}
|
||||||
+61
@@ -0,0 +1,61 @@
|
|||||||
|
package com.tongran.system.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.tongran.system.domain.SysNoticeRead;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告阅读记录Service接口
|
||||||
|
*
|
||||||
|
* @author tongran
|
||||||
|
* @date 2026-02-12
|
||||||
|
*/
|
||||||
|
public interface ISysNoticeReadService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询公告阅读记录
|
||||||
|
*
|
||||||
|
* @param id 公告阅读记录主键
|
||||||
|
* @return 公告阅读记录
|
||||||
|
*/
|
||||||
|
public SysNoticeRead selectSysNoticeReadById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询公告阅读记录列表
|
||||||
|
*
|
||||||
|
* @param sysNoticeRead 公告阅读记录
|
||||||
|
* @return 公告阅读记录集合
|
||||||
|
*/
|
||||||
|
public List<SysNoticeRead> selectSysNoticeReadList(SysNoticeRead sysNoticeRead);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增公告阅读记录
|
||||||
|
*
|
||||||
|
* @param sysNoticeRead 公告阅读记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertSysNoticeRead(SysNoticeRead sysNoticeRead);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改公告阅读记录
|
||||||
|
*
|
||||||
|
* @param sysNoticeRead 公告阅读记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateSysNoticeRead(SysNoticeRead sysNoticeRead);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除公告阅读记录
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的公告阅读记录主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteSysNoticeReadByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除公告阅读记录信息
|
||||||
|
*
|
||||||
|
* @param id 公告阅读记录主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteSysNoticeReadById(Long id);
|
||||||
|
}
|
||||||
+9
-1
@@ -1,8 +1,9 @@
|
|||||||
package com.tongran.system.service;
|
package com.tongran.system.service;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.tongran.system.domain.SysNotice;
|
import com.tongran.system.domain.SysNotice;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 公告 服务层
|
* 公告 服务层
|
||||||
*
|
*
|
||||||
@@ -57,4 +58,11 @@ public interface ISysNoticeService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteNoticeByIds(Long[] noticeIds);
|
public int deleteNoticeByIds(Long[] noticeIds);
|
||||||
|
/**
|
||||||
|
* 新增公告
|
||||||
|
*
|
||||||
|
* @param notice 公告信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int addNotice(SysNotice notice);
|
||||||
}
|
}
|
||||||
|
|||||||
+96
@@ -0,0 +1,96 @@
|
|||||||
|
package com.tongran.system.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.tongran.common.core.utils.DateUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.tongran.system.mapper.SysNoticeReadMapper;
|
||||||
|
import com.tongran.system.domain.SysNoticeRead;
|
||||||
|
import com.tongran.system.service.ISysNoticeReadService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告阅读记录Service业务层处理
|
||||||
|
*
|
||||||
|
* @author tongran
|
||||||
|
* @date 2026-02-12
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SysNoticeReadServiceImpl implements ISysNoticeReadService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private SysNoticeReadMapper sysNoticeReadMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询公告阅读记录
|
||||||
|
*
|
||||||
|
* @param id 公告阅读记录主键
|
||||||
|
* @return 公告阅读记录
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SysNoticeRead selectSysNoticeReadById(Long id)
|
||||||
|
{
|
||||||
|
return sysNoticeReadMapper.selectSysNoticeReadById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询公告阅读记录列表
|
||||||
|
*
|
||||||
|
* @param sysNoticeRead 公告阅读记录
|
||||||
|
* @return 公告阅读记录
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SysNoticeRead> selectSysNoticeReadList(SysNoticeRead sysNoticeRead)
|
||||||
|
{
|
||||||
|
return sysNoticeReadMapper.selectSysNoticeReadList(sysNoticeRead);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增公告阅读记录
|
||||||
|
*
|
||||||
|
* @param sysNoticeRead 公告阅读记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertSysNoticeRead(SysNoticeRead sysNoticeRead)
|
||||||
|
{
|
||||||
|
sysNoticeRead.setCreateTime(DateUtils.getNowDate());
|
||||||
|
return sysNoticeReadMapper.insertSysNoticeRead(sysNoticeRead);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改公告阅读记录
|
||||||
|
*
|
||||||
|
* @param sysNoticeRead 公告阅读记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateSysNoticeRead(SysNoticeRead sysNoticeRead)
|
||||||
|
{
|
||||||
|
sysNoticeRead.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
return sysNoticeReadMapper.updateSysNoticeRead(sysNoticeRead);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除公告阅读记录
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的公告阅读记录主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteSysNoticeReadByIds(Long[] ids)
|
||||||
|
{
|
||||||
|
return sysNoticeReadMapper.deleteSysNoticeReadByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除公告阅读记录信息
|
||||||
|
*
|
||||||
|
* @param id 公告阅读记录主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteSysNoticeReadById(Long id)
|
||||||
|
{
|
||||||
|
return sysNoticeReadMapper.deleteSysNoticeReadById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
+10
-3
@@ -1,11 +1,12 @@
|
|||||||
package com.tongran.system.service.impl;
|
package com.tongran.system.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import com.tongran.system.domain.SysNotice;
|
import com.tongran.system.domain.SysNotice;
|
||||||
import com.tongran.system.mapper.SysNoticeMapper;
|
import com.tongran.system.mapper.SysNoticeMapper;
|
||||||
import com.tongran.system.service.ISysNoticeService;
|
import com.tongran.system.service.ISysNoticeService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 公告 服务层实现
|
* 公告 服务层实现
|
||||||
@@ -89,4 +90,10 @@ public class SysNoticeServiceImpl implements ISysNoticeService
|
|||||||
{
|
{
|
||||||
return noticeMapper.deleteNoticeByIds(noticeIds);
|
return noticeMapper.deleteNoticeByIds(noticeIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int addNotice(SysNotice notice) {
|
||||||
|
int rows = noticeMapper.insertNotice(notice);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+50
-31
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<!DOCTYPE mapper
|
<!DOCTYPE mapper
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.tongran.system.mapper.SysNoticeMapper">
|
<mapper namespace="com.tongran.system.mapper.SysNoticeMapper">
|
||||||
|
|
||||||
<resultMap type="SysNotice" id="SysNoticeResult">
|
<resultMap type="SysNotice" id="SysNoticeResult">
|
||||||
@@ -10,6 +10,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="noticeType" column="notice_type" />
|
<result property="noticeType" column="notice_type" />
|
||||||
<result property="noticeContent" column="notice_content" />
|
<result property="noticeContent" column="notice_content" />
|
||||||
<result property="status" column="status" />
|
<result property="status" column="status" />
|
||||||
|
<result property="releaseStatus" column="release_status" />
|
||||||
|
<result property="releaseTime" column="release_time" />
|
||||||
<result property="createBy" column="create_by" />
|
<result property="createBy" column="create_by" />
|
||||||
<result property="createTime" column="create_time" />
|
<result property="createTime" column="create_time" />
|
||||||
<result property="updateBy" column="update_by" />
|
<result property="updateBy" column="update_by" />
|
||||||
@@ -18,8 +20,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectNoticeVo">
|
<sql id="selectNoticeVo">
|
||||||
select notice_id, notice_title, notice_type, cast(notice_content as char) as notice_content, status, create_by, create_time, update_by, update_time, remark
|
select notice_id, notice_title, notice_type, cast(notice_content as char) as notice_content, status, release_status, release_time, create_by, create_time, update_by, update_time, remark
|
||||||
from sys_notice
|
from sys_notice
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectNoticeById" parameterType="Long" resultMap="SysNoticeResult">
|
<select id="selectNoticeById" parameterType="Long" resultMap="SysNoticeResult">
|
||||||
@@ -30,36 +32,43 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<select id="selectNoticeList" parameterType="SysNotice" resultMap="SysNoticeResult">
|
<select id="selectNoticeList" parameterType="SysNotice" resultMap="SysNoticeResult">
|
||||||
<include refid="selectNoticeVo"/>
|
<include refid="selectNoticeVo"/>
|
||||||
<where>
|
<where>
|
||||||
<if test="noticeTitle != null and noticeTitle != ''">
|
<if test="noticeTitle != null and noticeTitle != ''">
|
||||||
AND notice_title like concat('%', #{noticeTitle}, '%')
|
AND notice_title like concat('%', #{noticeTitle}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="noticeType != null and noticeType != ''">
|
<if test="noticeType != null and noticeType != ''">
|
||||||
AND notice_type = #{noticeType}
|
AND notice_type = #{noticeType}
|
||||||
</if>
|
</if>
|
||||||
<if test="createBy != null and createBy != ''">
|
<if test="releaseStatus != null and releaseStatus != ''">
|
||||||
AND create_by like concat('%', #{createBy}, '%')
|
AND release_status = #{releaseStatus}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
<if test="createBy != null and createBy != ''">
|
||||||
|
AND create_by like concat('%', #{createBy}, '%')
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertNotice" parameterType="SysNotice">
|
<insert id="insertNotice" parameterType="SysNotice">
|
||||||
insert into sys_notice (
|
insert into sys_notice (
|
||||||
<if test="noticeTitle != null and noticeTitle != '' ">notice_title, </if>
|
<if test="noticeTitle != null and noticeTitle != '' ">notice_title, </if>
|
||||||
<if test="noticeType != null and noticeType != '' ">notice_type, </if>
|
<if test="noticeType != null and noticeType != '' ">notice_type, </if>
|
||||||
<if test="noticeContent != null and noticeContent != '' ">notice_content, </if>
|
<if test="noticeContent != null and noticeContent != '' ">notice_content, </if>
|
||||||
<if test="status != null and status != '' ">status, </if>
|
<if test="status != null and status != '' ">status, </if>
|
||||||
<if test="remark != null and remark != ''">remark,</if>
|
<if test="releaseStatus != null and releaseStatus != '' ">release_status, </if>
|
||||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
<if test="releaseTime != null">release_time, </if>
|
||||||
create_time
|
<if test="remark != null and remark != ''">remark,</if>
|
||||||
)values(
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||||
<if test="noticeTitle != null and noticeTitle != ''">#{noticeTitle}, </if>
|
create_time
|
||||||
<if test="noticeType != null and noticeType != ''">#{noticeType}, </if>
|
)values(
|
||||||
<if test="noticeContent != null and noticeContent != ''">#{noticeContent}, </if>
|
<if test="noticeTitle != null and noticeTitle != ''">#{noticeTitle}, </if>
|
||||||
<if test="status != null and status != ''">#{status}, </if>
|
<if test="noticeType != null and noticeType != ''">#{noticeType}, </if>
|
||||||
<if test="remark != null and remark != ''">#{remark},</if>
|
<if test="noticeContent != null and noticeContent != ''">#{noticeContent}, </if>
|
||||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
<if test="status != null and status != ''">#{status}, </if>
|
||||||
sysdate()
|
<if test="releaseStatus != null and releaseStatus != ''">#{releaseStatus}, </if>
|
||||||
)
|
<if test="releaseTime != null">#{releaseTime}, </if>
|
||||||
|
<if test="remark != null and remark != ''">#{remark},</if>
|
||||||
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||||
|
sysdate()
|
||||||
|
)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<update id="updateNotice" parameterType="SysNotice">
|
<update id="updateNotice" parameterType="SysNotice">
|
||||||
@@ -69,12 +78,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="noticeType != null and noticeType != ''">notice_type = #{noticeType}, </if>
|
<if test="noticeType != null and noticeType != ''">notice_type = #{noticeType}, </if>
|
||||||
<if test="noticeContent != null">notice_content = #{noticeContent}, </if>
|
<if test="noticeContent != null">notice_content = #{noticeContent}, </if>
|
||||||
<if test="status != null and status != ''">status = #{status}, </if>
|
<if test="status != null and status != ''">status = #{status}, </if>
|
||||||
|
<if test="releaseStatus != null and releaseStatus != ''">release_status = #{releaseStatus}, </if>
|
||||||
|
<if test="releaseTime != null">release_time = #{releaseTime}, </if>
|
||||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||||
update_time = sysdate()
|
update_time = sysdate()
|
||||||
</set>
|
</set>
|
||||||
where notice_id = #{noticeId}
|
where notice_id = #{noticeId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<update id="updateReleaseStatus">
|
||||||
|
update sys_notice
|
||||||
|
set release_status = #{releaseStatus},
|
||||||
|
<if test="releaseTime != null">release_time = #{releaseTime},</if>
|
||||||
|
update_time = sysdate()
|
||||||
|
where notice_id = #{noticeId}
|
||||||
|
</update>
|
||||||
|
|
||||||
<delete id="deleteNoticeById" parameterType="Long">
|
<delete id="deleteNoticeById" parameterType="Long">
|
||||||
delete from sys_notice where notice_id = #{noticeId}
|
delete from sys_notice where notice_id = #{noticeId}
|
||||||
</delete>
|
</delete>
|
||||||
|
|||||||
+89
@@ -0,0 +1,89 @@
|
|||||||
|
<?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.tongran.system.mapper.SysNoticeReadMapper">
|
||||||
|
|
||||||
|
<resultMap type="SysNoticeRead" id="SysNoticeReadResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="noticeId" column="notice_id" />
|
||||||
|
<result property="userId" column="user_id" />
|
||||||
|
<result property="userName" column="user_name" />
|
||||||
|
<result property="readStatus" column="read_status" />
|
||||||
|
<result property="readTime" column="read_time" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="releaseStatus" column="release_status" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectSysNoticeReadVo">
|
||||||
|
select id, notice_id, user_id, user_name, read_status, read_time, create_time, update_time, release_status from sys_notice_read
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectSysNoticeReadList" parameterType="SysNoticeRead" resultMap="SysNoticeReadResult">
|
||||||
|
<include refid="selectSysNoticeReadVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="noticeId != null "> and notice_id = #{noticeId}</if>
|
||||||
|
<if test="userId != null "> and user_id = #{userId}</if>
|
||||||
|
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
|
||||||
|
<if test="readStatus != null and readStatus != ''"> and read_status = #{readStatus}</if>
|
||||||
|
<if test="readTime != null "> and read_time = #{readTime}</if>
|
||||||
|
<if test="releaseStatus != null and releaseStatus != ''"> and release_status = #{releaseStatus}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectSysNoticeReadById" parameterType="Long" resultMap="SysNoticeReadResult">
|
||||||
|
<include refid="selectSysNoticeReadVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertSysNoticeRead" parameterType="SysNoticeRead" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into sys_notice_read
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="noticeId != null">notice_id,</if>
|
||||||
|
<if test="userId != null">user_id,</if>
|
||||||
|
<if test="userName != null and userName != ''">user_name,</if>
|
||||||
|
<if test="readStatus != null and readStatus != ''">read_status,</if>
|
||||||
|
<if test="readTime != null">read_time,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
<if test="releaseStatus != null">release_status,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="noticeId != null">#{noticeId},</if>
|
||||||
|
<if test="userId != null">#{userId},</if>
|
||||||
|
<if test="userName != null and userName != ''">#{userName},</if>
|
||||||
|
<if test="readStatus != null and readStatus != ''">#{readStatus},</if>
|
||||||
|
<if test="readTime != null">#{readTime},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
<if test="releaseStatus != null">#{releaseStatus},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateSysNoticeRead" parameterType="SysNoticeRead">
|
||||||
|
update sys_notice_read
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="noticeId != null">notice_id = #{noticeId},</if>
|
||||||
|
<if test="userId != null">user_id = #{userId},</if>
|
||||||
|
<if test="userName != null and userName != ''">user_name = #{userName},</if>
|
||||||
|
<if test="readStatus != null and readStatus != ''">read_status = #{readStatus},</if>
|
||||||
|
<if test="readTime != null">read_time = #{readTime},</if>
|
||||||
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
<if test="releaseStatus != null">release_status = #{releaseStatus},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteSysNoticeReadById" parameterType="Long">
|
||||||
|
delete from sys_notice_read where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteSysNoticeReadByIds" parameterType="String">
|
||||||
|
delete from sys_notice_read where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
Reference in New Issue
Block a user