日期默认生成yyyy-mm-dd HH:mm:ss 自动生成方法的说明.
This commit is contained in:
parent
fc9bb69c85
commit
3ce2d6ffa5
|
|
@ -40,8 +40,8 @@ public class ${ClassName} extends ${Entity}
|
|||
#if($parentheseIndex != -1)
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
#elseif($column.javaType == 'Date')
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
#else
|
||||
@Excel(name = "${comment}")
|
||||
#end
|
||||
|
|
@ -62,11 +62,18 @@ public class ${ClassName} extends ${Entity}
|
|||
#else
|
||||
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||
#end
|
||||
/**
|
||||
* 设置 ${AttrName}
|
||||
* @param $column.columnComment
|
||||
*/
|
||||
public void set${AttrName}($column.javaType $column.javaField)
|
||||
{
|
||||
this.$column.javaField = $column.javaField;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 $column.columnComment
|
||||
* @return
|
||||
*/
|
||||
public $column.javaType get${AttrName}()
|
||||
{
|
||||
return $column.javaField;
|
||||
|
|
|
|||
|
|
@ -78,6 +78,12 @@
|
|||
<artifactId>ruoyi-common-swagger</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.nutz</groupId>
|
||||
<artifactId>nutz</artifactId>
|
||||
<version>1.r.69.20210929</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,173 @@
|
|||
package com.ruoyi.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.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.log.annotation.Log;
|
||||
import com.ruoyi.common.log.enums.BusinessType;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.system.domain.BulletinInfo;
|
||||
import com.ruoyi.system.domain.BulletinRecive;
|
||||
import com.ruoyi.system.service.IBulletinInfoService;
|
||||
import com.ruoyi.system.service.IBulletinReciveService;
|
||||
import com.ruoyi.common.core.web.controller.BaseController;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 公告栏Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-03-09
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/bulletin")
|
||||
public class BulletinInfoController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IBulletinInfoService bulletinInfoService;
|
||||
|
||||
@Autowired
|
||||
private IBulletinReciveService bulletinReciveService;
|
||||
|
||||
/**
|
||||
* 查询公告栏列表
|
||||
*/
|
||||
@RequiresPermissions("system:bulletin:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(BulletinInfo bulletinInfo)
|
||||
{
|
||||
startPage();
|
||||
List<BulletinInfo> list = bulletinInfoService.selectBulletinInfoList(bulletinInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取公告栏详细信息
|
||||
*/
|
||||
@RequiresPermissions("system:bulletin:query")
|
||||
@GetMapping(value = "/{bulletinId}")
|
||||
public AjaxResult getInfo(@PathVariable("bulletinId") String bulletinId)
|
||||
{
|
||||
return success(bulletinInfoService.selectBulletinInfoByBulletinId(bulletinId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送公告栏
|
||||
*/
|
||||
@RequiresPermissions("system:bulletin:add")
|
||||
@Log(title = "公告栏", businessType = BusinessType.OTHER)
|
||||
@PostMapping("/batchSend/{bulletinIds}")
|
||||
public AjaxResult batchSend(@PathVariable String[] bulletinIds)
|
||||
{
|
||||
return toAjax(bulletinInfoService.sendBulletinInfo(bulletinIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增或发送 公告栏
|
||||
*/
|
||||
@RequiresPermissions("system:bulletin:add")
|
||||
@Log(title = "公告栏", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody BulletinInfo bulletinInfo)
|
||||
{
|
||||
return toAjax(bulletinInfoService.insertBulletinInfo(bulletinInfo));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 修改公告栏
|
||||
*/
|
||||
@RequiresPermissions("system:bulletin:edit")
|
||||
@Log(title = "公告栏", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody BulletinInfo bulletinInfo)
|
||||
{
|
||||
return toAjax(bulletinInfoService.updateBulletinInfo(bulletinInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 物理删除公告栏
|
||||
*/
|
||||
@RequiresPermissions("system:bulletin:remove")
|
||||
@Log(title = "公告栏", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/delete/{bulletinIds}")
|
||||
public AjaxResult removePysical(@PathVariable String[] bulletinIds)
|
||||
{
|
||||
return toAjax(bulletinInfoService.deleteBulletinInfoByBulletinIds(bulletinIds,"D"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 逻辑删除公告栏
|
||||
*/
|
||||
@RequiresPermissions("system:bulletin:remove")
|
||||
@Log(title = "公告栏", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{bulletinIds}")
|
||||
public AjaxResult remove(@PathVariable String[] bulletinIds)
|
||||
{
|
||||
return toAjax(bulletinInfoService.deleteBulletinInfoByBulletinIds(bulletinIds,"B"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量阅读成功
|
||||
*/
|
||||
@RequiresPermissions("system:bulletin:edit")
|
||||
@PutMapping("/recive/batchRead/{reciveIds}")
|
||||
public AjaxResult batchRead(@PathVariable String[] reciveIds)
|
||||
{
|
||||
return toAjax(bulletinReciveService.batchRead(reciveIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询公告接收者列表
|
||||
*/
|
||||
@RequiresPermissions("system:bulletin:list")
|
||||
@GetMapping("/recive/list")
|
||||
public TableDataInfo reciveList(BulletinRecive bulletinRecive)
|
||||
{
|
||||
startPage();
|
||||
List<BulletinInfo> list = bulletinReciveService.selectBulletinReciveList(bulletinRecive);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 逻辑删除公告接收者
|
||||
*/
|
||||
@RequiresPermissions("system:bulletin:remove")
|
||||
@Log(title = "公告接收者", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/recive/{reciveIds}")
|
||||
public AjaxResult reciveRemove(@PathVariable String[] reciveIds)
|
||||
{
|
||||
return toAjax(bulletinReciveService.deleteBulletinReciveByReciveIds(reciveIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 物理删除公告接收者
|
||||
*/
|
||||
@RequiresPermissions("system:bulletin:remove")
|
||||
@Log(title = "公告接收者", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/recive/delete/{reciveIds}")
|
||||
public AjaxResult recivePhysicalRemove(@PathVariable String[] reciveIds)
|
||||
{
|
||||
return toAjax(bulletinReciveService.deletePhysicalBulletinReciveByReciveIds(reciveIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取公告接收者详细信息
|
||||
*/
|
||||
@RequiresPermissions("system:bulletin:query")
|
||||
@GetMapping(value = "/recive/{reciveId}")
|
||||
public AjaxResult getReciveInfo(@PathVariable("reciveId") String reciveId)
|
||||
{
|
||||
return success(bulletinReciveService.selectBulletinReciveByReciveId(reciveId));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,242 @@
|
|||
package com.ruoyi.system.domain;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 公告栏对象 t_bulletin_info
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-03-09
|
||||
*/
|
||||
public class BulletinInfo extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 公告ID */
|
||||
private String bulletinId;
|
||||
|
||||
/** 公告标题 */
|
||||
@Excel(name = "公告标题")
|
||||
@NotEmpty(message = "公告标题不允许为空")
|
||||
private String title;
|
||||
|
||||
/** 公告内容 */
|
||||
@Excel(name = "公告内容")
|
||||
private String content;
|
||||
|
||||
/** 已读人数 */
|
||||
@Excel(name = "已读人数")
|
||||
private Long readNum;
|
||||
|
||||
/** 公告的发送时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "公告的发送时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date sendTime;
|
||||
|
||||
/** 员工ID */
|
||||
@Excel(name = "员工ID")
|
||||
private Long createUserId;
|
||||
|
||||
/** 更新员工 */
|
||||
@Excel(name = "更新员工")
|
||||
private Long updateUserId;
|
||||
|
||||
/** 状态 */
|
||||
@Excel(name = "状态")
|
||||
@NotEmpty(message = "状态不允许为空")
|
||||
private String sts;
|
||||
|
||||
/** 公告接收者信息 */
|
||||
private List<BulletinRecive> bulletinReciveList;
|
||||
/**
|
||||
* 给前端过渡,用于生成BulletinRecive
|
||||
*/
|
||||
private List<Long> receiveStaffIds;
|
||||
/**
|
||||
* 接收人员,以逗号分隔
|
||||
*/
|
||||
private String reciveStaffNames;
|
||||
|
||||
|
||||
public String getReciveStaffNames() {
|
||||
return reciveStaffNames;
|
||||
}
|
||||
public void setReciveStaffNames(String reciveStaffNames) {
|
||||
this.reciveStaffNames = reciveStaffNames;
|
||||
}
|
||||
public List<Long> getReceiveStaffIds() {
|
||||
if(receiveStaffIds==null) {
|
||||
receiveStaffIds=Collections.emptyList();
|
||||
}
|
||||
return receiveStaffIds;
|
||||
}
|
||||
public void setReceiveStaffIds(List<Long> receiveStaffIds) {
|
||||
this.receiveStaffIds = receiveStaffIds;
|
||||
}
|
||||
/**
|
||||
* 设置 BulletinId
|
||||
* @param 公告ID
|
||||
*/
|
||||
public void setBulletinId(String bulletinId)
|
||||
{
|
||||
this.bulletinId = bulletinId;
|
||||
}
|
||||
/**
|
||||
* 获取 公告ID
|
||||
* @return
|
||||
*/
|
||||
public String getBulletinId()
|
||||
{
|
||||
return bulletinId;
|
||||
}
|
||||
/**
|
||||
* 设置 Title
|
||||
* @param 公告标题
|
||||
*/
|
||||
public void setTitle(String title)
|
||||
{
|
||||
this.title = title;
|
||||
}
|
||||
/**
|
||||
* 获取 公告标题
|
||||
* @return
|
||||
*/
|
||||
public String getTitle()
|
||||
{
|
||||
return title;
|
||||
}
|
||||
/**
|
||||
* 设置 Content
|
||||
* @param 公告内容
|
||||
*/
|
||||
public void setContent(String content)
|
||||
{
|
||||
this.content = content;
|
||||
}
|
||||
/**
|
||||
* 获取 公告内容
|
||||
* @return
|
||||
*/
|
||||
public String getContent()
|
||||
{
|
||||
return content;
|
||||
}
|
||||
/**
|
||||
* 设置 ReadNum
|
||||
* @param 已读人数
|
||||
*/
|
||||
public void setReadNum(Long readNum)
|
||||
{
|
||||
this.readNum = readNum;
|
||||
}
|
||||
/**
|
||||
* 获取 已读人数
|
||||
* @return
|
||||
*/
|
||||
public Long getReadNum()
|
||||
{
|
||||
return readNum;
|
||||
}
|
||||
/**
|
||||
* 设置 SendTime
|
||||
* @param 公告的发送时间
|
||||
*/
|
||||
public void setSendTime(Date sendTime)
|
||||
{
|
||||
this.sendTime = sendTime;
|
||||
}
|
||||
/**
|
||||
* 获取 公告的发送时间
|
||||
* @return
|
||||
*/
|
||||
public Date getSendTime()
|
||||
{
|
||||
return sendTime;
|
||||
}
|
||||
/**
|
||||
* 设置 CreateUserId
|
||||
* @param 员工ID
|
||||
*/
|
||||
public void setCreateUserId(Long createUserId)
|
||||
{
|
||||
this.createUserId = createUserId;
|
||||
}
|
||||
/**
|
||||
* 获取 员工ID
|
||||
* @return
|
||||
*/
|
||||
public Long getCreateUserId()
|
||||
{
|
||||
return createUserId;
|
||||
}
|
||||
/**
|
||||
* 设置 UpdateUserId
|
||||
* @param 更新员工
|
||||
*/
|
||||
public void setUpdateUserId(Long updateUserId)
|
||||
{
|
||||
this.updateUserId = updateUserId;
|
||||
}
|
||||
/**
|
||||
* 获取 更新员工
|
||||
* @return
|
||||
*/
|
||||
public Long getUpdateUserId()
|
||||
{
|
||||
return updateUserId;
|
||||
}
|
||||
/**
|
||||
* 设置 Sts
|
||||
* @param 状态
|
||||
*/
|
||||
public void setSts(String sts)
|
||||
{
|
||||
this.sts = sts;
|
||||
}
|
||||
/**
|
||||
* 获取 状态
|
||||
* @return
|
||||
*/
|
||||
public String getSts()
|
||||
{
|
||||
return sts;
|
||||
}
|
||||
|
||||
public List<BulletinRecive> getBulletinReciveList()
|
||||
{
|
||||
return bulletinReciveList;
|
||||
}
|
||||
|
||||
public void setBulletinReciveList(List<BulletinRecive> bulletinReciveList)
|
||||
{
|
||||
this.bulletinReciveList = bulletinReciveList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("bulletinId", getBulletinId())
|
||||
.append("title", getTitle())
|
||||
.append("content", getContent())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("readNum", getReadNum())
|
||||
.append("sendTime", getSendTime())
|
||||
.append("createUserId", getCreateUserId())
|
||||
.append("updateUserId", getUpdateUserId())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.append("sts", getSts())
|
||||
.append("bulletinReciveList", getBulletinReciveList())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,197 @@
|
|||
package com.ruoyi.system.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 公告接收者对象 t_bulletin_recive
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-03-09
|
||||
*/
|
||||
public class BulletinRecive extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 接收ID */
|
||||
private String reciveId;
|
||||
|
||||
/** 接收员工ID */
|
||||
@Excel(name = "接收员工ID")
|
||||
private Long reciveUserId;
|
||||
|
||||
/** 阅读时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "阅读时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date readTime;
|
||||
|
||||
/** 阅读次数 */
|
||||
@Excel(name = "阅读次数")
|
||||
private Long readNum;
|
||||
|
||||
/** 员工ID */
|
||||
@Excel(name = "员工ID")
|
||||
private Long createUserId;
|
||||
|
||||
/** 更新员工 */
|
||||
@Excel(name = "更新员工")
|
||||
private Long updateUserId;
|
||||
|
||||
/** 公告ID */
|
||||
@Excel(name = "公告ID")
|
||||
private String bulletinId;
|
||||
|
||||
/** A:已阅读,B:已删除 C:未阅读 */
|
||||
@Excel(name = "A:已阅读,B:已删除 C:未阅读")
|
||||
private String sts;
|
||||
|
||||
/**
|
||||
* 设置 ReciveId
|
||||
* @param 接收ID
|
||||
*/
|
||||
public void setReciveId(String reciveId)
|
||||
{
|
||||
this.reciveId = reciveId;
|
||||
}
|
||||
/**
|
||||
* 获取 接收ID
|
||||
* @return
|
||||
*/
|
||||
public String getReciveId()
|
||||
{
|
||||
return reciveId;
|
||||
}
|
||||
/**
|
||||
* 设置 ReciveUserId
|
||||
* @param 接收员工ID
|
||||
*/
|
||||
public void setReciveUserId(Long reciveUserId)
|
||||
{
|
||||
this.reciveUserId = reciveUserId;
|
||||
}
|
||||
/**
|
||||
* 获取 接收员工ID
|
||||
* @return
|
||||
*/
|
||||
public Long getReciveUserId()
|
||||
{
|
||||
return reciveUserId;
|
||||
}
|
||||
/**
|
||||
* 设置 ReadTime
|
||||
* @param 阅读时间
|
||||
*/
|
||||
public void setReadTime(Date readTime)
|
||||
{
|
||||
this.readTime = readTime;
|
||||
}
|
||||
/**
|
||||
* 获取 阅读时间
|
||||
* @return
|
||||
*/
|
||||
public Date getReadTime()
|
||||
{
|
||||
return readTime;
|
||||
}
|
||||
/**
|
||||
* 设置 ReadNum
|
||||
* @param 阅读次数
|
||||
*/
|
||||
public void setReadNum(Long readNum)
|
||||
{
|
||||
this.readNum = readNum;
|
||||
}
|
||||
/**
|
||||
* 获取 阅读次数
|
||||
* @return
|
||||
*/
|
||||
public Long getReadNum()
|
||||
{
|
||||
return readNum;
|
||||
}
|
||||
/**
|
||||
* 设置 CreateUserId
|
||||
* @param 员工ID
|
||||
*/
|
||||
public void setCreateUserId(Long createUserId)
|
||||
{
|
||||
this.createUserId = createUserId;
|
||||
}
|
||||
/**
|
||||
* 获取 员工ID
|
||||
* @return
|
||||
*/
|
||||
public Long getCreateUserId()
|
||||
{
|
||||
return createUserId;
|
||||
}
|
||||
/**
|
||||
* 设置 UpdateUserId
|
||||
* @param 更新员工
|
||||
*/
|
||||
public void setUpdateUserId(Long updateUserId)
|
||||
{
|
||||
this.updateUserId = updateUserId;
|
||||
}
|
||||
/**
|
||||
* 获取 更新员工
|
||||
* @return
|
||||
*/
|
||||
public Long getUpdateUserId()
|
||||
{
|
||||
return updateUserId;
|
||||
}
|
||||
/**
|
||||
* 设置 BulletinId
|
||||
* @param 公告ID
|
||||
*/
|
||||
public void setBulletinId(String bulletinId)
|
||||
{
|
||||
this.bulletinId = bulletinId;
|
||||
}
|
||||
/**
|
||||
* 获取 公告ID
|
||||
* @return
|
||||
*/
|
||||
public String getBulletinId()
|
||||
{
|
||||
return bulletinId;
|
||||
}
|
||||
/**
|
||||
* 设置 Sts
|
||||
* @param A:已阅读,B:已删除 C:未阅读
|
||||
*/
|
||||
public void setSts(String sts)
|
||||
{
|
||||
this.sts = sts;
|
||||
}
|
||||
/**
|
||||
* 获取 A:已阅读,B:已删除 C:未阅读
|
||||
* @return
|
||||
*/
|
||||
public String getSts()
|
||||
{
|
||||
return sts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("reciveId", getReciveId())
|
||||
.append("reciveUserId", getReciveUserId())
|
||||
.append("readTime", getReadTime())
|
||||
.append("readNum", getReadNum())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("createUserId", getCreateUserId())
|
||||
.append("updateUserId", getUpdateUserId())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.append("bulletinId", getBulletinId())
|
||||
.append("sts", getSts())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
import com.ruoyi.system.domain.BulletinInfo;
|
||||
import com.ruoyi.system.domain.BulletinRecive;
|
||||
|
||||
/**
|
||||
* 公告栏Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-03-09
|
||||
*/
|
||||
public interface BulletinInfoMapper
|
||||
{
|
||||
/**
|
||||
* 查询公告栏
|
||||
*
|
||||
* @param bulletinId 公告栏主键
|
||||
* @return 公告栏
|
||||
*/
|
||||
public BulletinInfo selectBulletinInfoByBulletinId(String bulletinId);
|
||||
|
||||
/**
|
||||
* 查询公告栏列表
|
||||
*
|
||||
* @param bulletinInfo 公告栏
|
||||
* @return 公告栏集合
|
||||
*/
|
||||
public List<BulletinInfo> selectBulletinInfoList(BulletinInfo bulletinInfo);
|
||||
|
||||
/**
|
||||
* 根据bulletinId查询公告栏列表
|
||||
* @param bulletinIds
|
||||
* @return
|
||||
*/
|
||||
public List<BulletinInfo> selectBulletinInfoListbyBulletinIds(String[] bulletinIds);
|
||||
/**
|
||||
* 新增公告栏
|
||||
*
|
||||
* @param bulletinInfo 公告栏
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBulletinInfo(BulletinInfo bulletinInfo);
|
||||
|
||||
/**
|
||||
* 修改公告栏
|
||||
*
|
||||
* @param bulletinInfo 公告栏
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBulletinInfo(BulletinInfo bulletinInfo);
|
||||
|
||||
/**
|
||||
* 删除公告栏
|
||||
*
|
||||
* @param bulletinId 公告栏主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBulletinInfoByBulletinId(String bulletinId);
|
||||
|
||||
/**
|
||||
* 批量删除公告栏
|
||||
*
|
||||
* @param bulletinIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBulletinInfoByBulletinIds(String[] bulletinIds);
|
||||
|
||||
/**
|
||||
* 批量删除公告接收者
|
||||
*
|
||||
* @param bulletinIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBulletinReciveByBulletinIds(String[] bulletinIds);
|
||||
|
||||
/**
|
||||
* 批量新增公告接收者
|
||||
*
|
||||
* @param bulletinReciveList 公告接收者列表
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchBulletinRecive(List<BulletinRecive> bulletinReciveList);
|
||||
|
||||
|
||||
/**
|
||||
* 通过公告栏主键删除公告接收者信息
|
||||
*
|
||||
* @param bulletinId 公告栏ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBulletinReciveByBulletinId(String bulletinId);
|
||||
}
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.BulletinRecive;
|
||||
|
||||
/**
|
||||
* 公告接收者Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-03-09
|
||||
*/
|
||||
public interface BulletinReciveMapper
|
||||
{
|
||||
|
||||
/**
|
||||
* 批量更新已阅读
|
||||
* @param bulletinRecive
|
||||
* @return
|
||||
*/
|
||||
public int batchUpdateRead(String[] reciveIds);
|
||||
/**
|
||||
* 只查询出bulletinId和接收的reciveUserId
|
||||
* @param bulletinIds
|
||||
* @return
|
||||
*/
|
||||
public List<BulletinRecive> selectBulletinReciveUserIdByBulletinIds(String[] bulletinIds);
|
||||
/**
|
||||
* 查询公告接收者
|
||||
*
|
||||
* @param reciveId 公告接收者主键
|
||||
* @return 公告接收者
|
||||
*/
|
||||
public BulletinRecive selectBulletinReciveByReciveId(String reciveId);
|
||||
|
||||
/**
|
||||
* 查询公告接收者列表
|
||||
*
|
||||
* @param bulletinRecive 公告接收者
|
||||
* @return 公告接收者集合
|
||||
*/
|
||||
public List<BulletinRecive> selectBulletinReciveList(BulletinRecive bulletinRecive);
|
||||
|
||||
/**
|
||||
* 新增公告接收者
|
||||
*
|
||||
* @param bulletinRecive 公告接收者
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBulletinRecive(BulletinRecive bulletinRecive);
|
||||
|
||||
/**
|
||||
* 修改公告接收者
|
||||
*
|
||||
* @param bulletinRecive 公告接收者
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBulletinRecive(BulletinRecive bulletinRecive);
|
||||
|
||||
/**
|
||||
* 删除公告接收者
|
||||
*
|
||||
* @param reciveId 公告接收者主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBulletinReciveByReciveId(String reciveId);
|
||||
|
||||
/**
|
||||
* 批量删除公告接收者
|
||||
*
|
||||
* @param reciveIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBulletinReciveByReciveIds(String[] reciveIds);
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.BulletinInfo;
|
||||
|
||||
/**
|
||||
* 公告栏Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-03-09
|
||||
*/
|
||||
public interface IBulletinInfoService
|
||||
{
|
||||
/**
|
||||
* 查询公告栏
|
||||
*
|
||||
* @param bulletinId 公告栏主键
|
||||
* @return 公告栏
|
||||
*/
|
||||
public BulletinInfo selectBulletinInfoByBulletinId(String bulletinId);
|
||||
|
||||
/**
|
||||
* 查询公告栏列表
|
||||
*
|
||||
* @param bulletinInfo 公告栏
|
||||
* @return 公告栏集合
|
||||
*/
|
||||
public List<BulletinInfo> selectBulletinInfoList(BulletinInfo bulletinInfo);
|
||||
|
||||
/**
|
||||
* 新增公告栏
|
||||
*
|
||||
* @param bulletinInfo 公告栏
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBulletinInfo(BulletinInfo bulletinInfo);
|
||||
|
||||
/**
|
||||
* 修改公告栏
|
||||
*
|
||||
* @param bulletinInfo 公告栏
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBulletinInfo(BulletinInfo bulletinInfo);
|
||||
|
||||
/**
|
||||
* 批量删除公告栏
|
||||
*
|
||||
* @param bulletinIds 需要删除的公告栏主键集合
|
||||
* @param sts B:逻辑删除,D:物理删除
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBulletinInfoByBulletinIds(String[] bulletinIds,String sts);
|
||||
|
||||
/**
|
||||
* 删除公告栏信息
|
||||
*
|
||||
* @param bulletinId 公告栏主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBulletinInfoByBulletinId(String bulletinId);
|
||||
|
||||
/**
|
||||
* 批量发送公告
|
||||
* @param bulletinIds
|
||||
* @return
|
||||
*/
|
||||
int sendBulletinInfo(String[] bulletinIds);
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.system.domain.BulletinInfo;
|
||||
import com.ruoyi.system.domain.BulletinRecive;
|
||||
|
||||
/**
|
||||
* 公告接收者Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-03-09
|
||||
*/
|
||||
public interface IBulletinReciveService
|
||||
{
|
||||
/**
|
||||
* 查询公告接收者
|
||||
*
|
||||
* @param reciveId 公告接收者主键
|
||||
* @return 公告接收者
|
||||
*/
|
||||
public BulletinRecive selectBulletinReciveByReciveId(String reciveId);
|
||||
|
||||
/**
|
||||
* 查询公告接收者列表
|
||||
*
|
||||
* @param bulletinRecive 公告接收者
|
||||
* @return 公告接收者集合
|
||||
*/
|
||||
public List<BulletinInfo> selectBulletinReciveList(BulletinRecive bulletinRecive);
|
||||
|
||||
/**
|
||||
* 新增公告接收者
|
||||
*
|
||||
* @param bulletinRecive 公告接收者
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBulletinRecive(BulletinRecive bulletinRecive);
|
||||
|
||||
/**
|
||||
* 修改公告接收者
|
||||
*
|
||||
* @param bulletinRecive 公告接收者
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBulletinRecive(BulletinRecive bulletinRecive);
|
||||
|
||||
/**
|
||||
* 批量删除公告接收者
|
||||
*
|
||||
* @param reciveIds 需要删除的公告接收者主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBulletinReciveByReciveIds(String[] reciveIds);
|
||||
|
||||
/**
|
||||
* 删除公告接收者信息
|
||||
*
|
||||
* @param reciveId 公告接收者主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBulletinReciveByReciveId(String reciveId);
|
||||
|
||||
/**
|
||||
* 批量更新已阅读
|
||||
* @param reciveIds
|
||||
* @return
|
||||
*/
|
||||
int batchRead(String[] reciveIds);
|
||||
|
||||
/**
|
||||
* 批量物理删除公告接收者
|
||||
*
|
||||
* @param reciveIds 需要删除的公告接收者主键
|
||||
* @return 结果
|
||||
*/
|
||||
int deletePhysicalBulletinReciveByReciveIds(String[] reciveIds);
|
||||
}
|
||||
|
|
@ -0,0 +1,237 @@
|
|||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.ruoyi.system.domain.BulletinRecive;
|
||||
import com.ruoyi.system.mapper.BulletinInfoMapper;
|
||||
import com.ruoyi.system.mapper.BulletinReciveMapper;
|
||||
import com.ruoyi.system.domain.BulletinInfo;
|
||||
import com.ruoyi.system.service.IBulletinInfoService;
|
||||
|
||||
import ecc.c3.util.IDUtil;
|
||||
|
||||
/**
|
||||
* 公告栏Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-03-09
|
||||
*/
|
||||
@Service
|
||||
public class BulletinInfoServiceImpl implements IBulletinInfoService
|
||||
{
|
||||
private Logger log=LoggerFactory.getLogger(BulletinInfoServiceImpl.class);
|
||||
@Autowired
|
||||
private BulletinInfoMapper bulletinInfoMapper;
|
||||
@Autowired
|
||||
private BulletinReciveMapper bulletinReciveMapper;
|
||||
|
||||
/**
|
||||
* 查询公告栏
|
||||
*
|
||||
* @param bulletinId 公告栏主键
|
||||
* @return 公告栏
|
||||
*/
|
||||
@Override
|
||||
public BulletinInfo selectBulletinInfoByBulletinId(String bulletinId)
|
||||
{
|
||||
List<BulletinRecive> reciveUserIdAndbulletinId=bulletinReciveMapper.selectBulletinReciveUserIdByBulletinIds(new String[] {bulletinId});
|
||||
BulletinInfo info= bulletinInfoMapper.selectBulletinInfoByBulletinId(bulletinId);
|
||||
//TODO 把员工换算成名称
|
||||
info.setCreateBy(info.getCreateUserId()+"");
|
||||
info.setUpdateBy(info.getUpdateUserId()+"");
|
||||
List<Long> reciveUserIdList=reciveUserIdAndbulletinId.stream().map(userId->userId.getReciveUserId()).collect(Collectors.toList());
|
||||
info.setReceiveStaffIds(reciveUserIdList);
|
||||
info.setReciveStaffNames(StringUtils.join(reciveUserIdList.iterator(), ","));
|
||||
return info;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询公告栏列表
|
||||
*
|
||||
* @param bulletinInfo 公告栏
|
||||
* @return 公告栏
|
||||
*/
|
||||
@Override
|
||||
public List<BulletinInfo> selectBulletinInfoList(BulletinInfo bulletinInfo)
|
||||
{
|
||||
bulletinInfo.setCreateUserId(SecurityUtils.getUserId());
|
||||
List<BulletinInfo> list=bulletinInfoMapper.selectBulletinInfoList(bulletinInfo);
|
||||
String[] bulletinIds=list.stream().map(info->info.getBulletinId()).toArray(String[]::new);
|
||||
if(bulletinIds.length>0) {
|
||||
final NutMap reciveUserNameMap=NutMap.NEW();
|
||||
final NutMap reciveBulletinReciveMap=NutMap.NEW();
|
||||
List<BulletinRecive> reciveUserIdAndbulletinIdList=bulletinReciveMapper.selectBulletinReciveUserIdByBulletinIds(bulletinIds);
|
||||
reciveUserIdAndbulletinIdList.forEach(reciveUserIdAndBulletinId->{
|
||||
//TODO 这里要把reciveUserId换算成用户名
|
||||
reciveUserNameMap.addv2(reciveUserIdAndBulletinId.getBulletinId(), reciveUserIdAndBulletinId.getReciveUserId()+"");
|
||||
reciveBulletinReciveMap.addv2(reciveUserIdAndBulletinId.getBulletinId(), reciveUserIdAndBulletinId);
|
||||
});
|
||||
list.forEach(info->{
|
||||
String reciveStaffNames=String.join(",", reciveUserNameMap.getList(info.getBulletinId(), String.class, Collections.emptyList()));
|
||||
info.setReciveStaffNames(reciveStaffNames);
|
||||
info.setBulletinReciveList(reciveBulletinReciveMap.getList(info.getBulletinId(), BulletinRecive.class,Collections.emptyList()));
|
||||
});
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量发送公告
|
||||
* @param bulletinIds
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int sendBulletinInfo(String[] bulletinIds) {
|
||||
int updateCount=0;
|
||||
for (String bulletinId : bulletinIds) {
|
||||
log.info("发送公告,bulletinId:{}",bulletinId);
|
||||
BulletinInfo info=new BulletinInfo();
|
||||
info.setBulletinId(bulletinId);
|
||||
info.setSendTime(DateUtils.getNowDate());
|
||||
info.setUpdateUserId(SecurityUtils.getUserId());
|
||||
info.setUpdateTime(info.getSendTime());
|
||||
info.setSts("A");
|
||||
|
||||
updateCount+=bulletinInfoMapper.updateBulletinInfo(info);
|
||||
}
|
||||
return updateCount;
|
||||
}
|
||||
/**
|
||||
* 推送公告给客户端
|
||||
* @param bulletinId
|
||||
* @return
|
||||
*/
|
||||
private boolean pushBulletinToClient(String bulletinId) {
|
||||
//TODO 发送公告的业务逻辑还没做,需要获取在线用户,推送给对方
|
||||
log.info("发送公告,bulletinId:{} 业务逻辑还是空的",bulletinId);
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* 新增公告栏
|
||||
*
|
||||
* @param bulletinInfo 公告栏
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public int insertBulletinInfo(BulletinInfo bulletinInfo)
|
||||
{
|
||||
bulletinInfo.setBulletinId(IDUtil.getStrId());
|
||||
Long userId=SecurityUtils.getUserId();
|
||||
bulletinInfo.setCreateUserId(userId);
|
||||
Date currDate=DateUtils.getNowDate();
|
||||
bulletinInfo.setCreateTime(currDate);
|
||||
bulletinInfo.setUpdateTime(currDate);
|
||||
bulletinInfo.setUpdateUserId(userId);
|
||||
if("A".equals(bulletinInfo.getSts())) {
|
||||
bulletinInfo.setSendTime(bulletinInfo.getCreateTime());
|
||||
}
|
||||
bulletinInfo.setReadNum(0L);
|
||||
int rows = bulletinInfoMapper.insertBulletinInfo(bulletinInfo);
|
||||
insertBulletinRecive(bulletinInfo);
|
||||
pushBulletinToClient(bulletinInfo.getBulletinId());
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改公告栏
|
||||
*
|
||||
* @param bulletinInfo 公告栏
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public int updateBulletinInfo(BulletinInfo bulletinInfo)
|
||||
{
|
||||
bulletinInfo.setUpdateTime(DateUtils.getNowDate());
|
||||
bulletinInfo.setUpdateUserId(SecurityUtils.getUserId());
|
||||
if(!bulletinInfo.getReceiveStaffIds().isEmpty()) {
|
||||
bulletinInfoMapper.deleteBulletinReciveByBulletinId(bulletinInfo.getBulletinId());
|
||||
insertBulletinRecive(bulletinInfo);
|
||||
}
|
||||
return bulletinInfoMapper.updateBulletinInfo(bulletinInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量逻辑删除公告栏
|
||||
*
|
||||
* @param bulletinIds 需要删除的公告栏主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public int deleteBulletinInfoByBulletinIds(String[] bulletinIds,String sts)
|
||||
{
|
||||
int iCount=0;
|
||||
for (String bulletinId : bulletinIds) {
|
||||
BulletinInfo bulletinInfo=new BulletinInfo();
|
||||
bulletinInfo.setBulletinId(bulletinId);
|
||||
bulletinInfo.setUpdateTime(DateUtils.getNowDate());
|
||||
bulletinInfo.setUpdateUserId(SecurityUtils.getUserId());
|
||||
bulletinInfo.setSts(sts);
|
||||
iCount+=bulletinInfoMapper.updateBulletinInfo(bulletinInfo);
|
||||
}
|
||||
return iCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* 逻辑删除公告栏信息
|
||||
*
|
||||
* @param bulletinId 公告栏主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public int deleteBulletinInfoByBulletinId(String bulletinId)
|
||||
{
|
||||
return deleteBulletinInfoByBulletinIds(new String[] {bulletinId},"B");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增公告接收者信息
|
||||
*
|
||||
* @param bulletinInfo 公告栏对象
|
||||
*/
|
||||
public void insertBulletinRecive(BulletinInfo bulletinInfo)
|
||||
{
|
||||
List<Long> reciveUserIdList=bulletinInfo.getReceiveStaffIds();
|
||||
String bulletinId = bulletinInfo.getBulletinId();
|
||||
List<BulletinRecive> reciveList=new ArrayList<>(reciveUserIdList.size());
|
||||
Date now=DateUtils.getNowDate();
|
||||
bulletinInfo.setBulletinReciveList(reciveList);
|
||||
Long userId=SecurityUtils.getUserId();
|
||||
for (Long reciveUserId : reciveUserIdList) {
|
||||
BulletinRecive bulletinRecive=new BulletinRecive();
|
||||
bulletinRecive.setBulletinId(bulletinId);
|
||||
bulletinRecive.setCreateTime(now);
|
||||
bulletinRecive.setCreateUserId(userId);
|
||||
bulletinRecive.setUpdateTime(now);
|
||||
bulletinRecive.setUpdateUserId(userId);
|
||||
bulletinRecive.setReadNum(0L);
|
||||
bulletinRecive.setSts("C");
|
||||
bulletinRecive.setReciveUserId(reciveUserId);
|
||||
bulletinRecive.setReciveId(IDUtil.getStrId());
|
||||
reciveList.add(bulletinRecive);
|
||||
}
|
||||
if (reciveList.size() > 0)
|
||||
{
|
||||
bulletinInfoMapper.batchBulletinRecive(reciveList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,157 @@
|
|||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.ruoyi.system.mapper.BulletinInfoMapper;
|
||||
import com.ruoyi.system.mapper.BulletinReciveMapper;
|
||||
import com.ruoyi.system.domain.BulletinInfo;
|
||||
import com.ruoyi.system.domain.BulletinRecive;
|
||||
import com.ruoyi.system.service.IBulletinReciveService;
|
||||
|
||||
/**
|
||||
* 公告接收者Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-03-09
|
||||
*/
|
||||
@Service
|
||||
public class BulletinReciveServiceImpl implements IBulletinReciveService
|
||||
{
|
||||
@Autowired
|
||||
private BulletinReciveMapper bulletinReciveMapper;
|
||||
@Autowired
|
||||
private BulletinInfoMapper bulletinInfoMapper;
|
||||
|
||||
@Transactional
|
||||
/**
|
||||
* 批量更新已阅读
|
||||
* @param reciveIds
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int batchRead(String[] reciveIds) {
|
||||
return bulletinReciveMapper.batchUpdateRead(reciveIds);
|
||||
}
|
||||
/**
|
||||
* 查询公告接收者
|
||||
*
|
||||
* @param reciveId 公告接收者主键
|
||||
* @return 公告接收者
|
||||
*/
|
||||
@Override
|
||||
public BulletinRecive selectBulletinReciveByReciveId(String reciveId)
|
||||
{
|
||||
return bulletinReciveMapper.selectBulletinReciveByReciveId(reciveId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询公告接收者列表
|
||||
*
|
||||
* @param bulletinRecive 公告接收者
|
||||
* @return 公告接收者
|
||||
*/
|
||||
@Override
|
||||
public List<BulletinInfo> selectBulletinReciveList(BulletinRecive bulletinRecive)
|
||||
{
|
||||
bulletinRecive.setReciveUserId(SecurityUtils.getUserId());
|
||||
List<BulletinRecive> reciveList= bulletinReciveMapper.selectBulletinReciveList(bulletinRecive);
|
||||
if(reciveList.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
NutMap map=NutMap.NEW();
|
||||
String[] bulletinIds=new String[reciveList.size()];
|
||||
for (int i = 0; i < bulletinIds.length; i++) {
|
||||
BulletinRecive recive=reciveList.get(i);
|
||||
map.addv2(recive.getBulletinId(), recive);
|
||||
bulletinIds[i]=recive.getBulletinId();
|
||||
}
|
||||
List<BulletinInfo> infoList=bulletinInfoMapper.selectBulletinInfoListbyBulletinIds(bulletinIds);
|
||||
infoList.forEach(info->{
|
||||
info.setBulletinReciveList(map.getList(info.getBulletinId(), BulletinRecive.class,Collections.emptyList()));
|
||||
});
|
||||
return infoList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增公告接收者
|
||||
*
|
||||
* @param bulletinRecive 公告接收者
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertBulletinRecive(BulletinRecive bulletinRecive)
|
||||
{
|
||||
bulletinRecive.setCreateTime(DateUtils.getNowDate());
|
||||
return bulletinReciveMapper.insertBulletinRecive(bulletinRecive);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改公告接收者
|
||||
*
|
||||
* @param bulletinRecive 公告接收者
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateBulletinRecive(BulletinRecive bulletinRecive)
|
||||
{
|
||||
bulletinRecive.setUpdateTime(DateUtils.getNowDate());
|
||||
bulletinRecive.setUpdateUserId(SecurityUtils.getUserId());
|
||||
return bulletinReciveMapper.updateBulletinRecive(bulletinRecive);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量物理删除公告接收者
|
||||
*
|
||||
* @param reciveIds 需要删除的公告接收者主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePhysicalBulletinReciveByReciveIds(String[] reciveIds)
|
||||
{
|
||||
return bulletinReciveMapper.deleteBulletinReciveByReciveIds(reciveIds);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量逻辑删除公告接收者
|
||||
*
|
||||
* @param reciveIds 需要删除的公告接收者主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int deleteBulletinReciveByReciveIds(String[] reciveIds)
|
||||
{
|
||||
int iCount=0;
|
||||
for (String reciveId : reciveIds) {
|
||||
BulletinRecive bulletinRecive=new BulletinRecive();
|
||||
bulletinRecive.setReciveId(reciveId);
|
||||
bulletinRecive.setSts("B");
|
||||
bulletinRecive.setUpdateTime(DateUtils.getNowDate());
|
||||
bulletinRecive.setUpdateUserId(SecurityUtils.getUserId());
|
||||
iCount+=bulletinReciveMapper.updateBulletinRecive(bulletinRecive);
|
||||
}
|
||||
return iCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除公告接收者信息
|
||||
*
|
||||
* @param reciveId 公告接收者主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBulletinReciveByReciveId(String reciveId)
|
||||
{
|
||||
return bulletinReciveMapper.deleteBulletinReciveByReciveId(reciveId);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
package ecc.c3.util;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* 自动生成ID的工具类
|
||||
* @author Condy
|
||||
*
|
||||
*/
|
||||
public class IDUtil {
|
||||
static private SnowflakeIdWorker id;
|
||||
static {
|
||||
Random random=new Random();
|
||||
int workId=random.nextInt(32);
|
||||
int datacenterId=random.nextInt(32);
|
||||
id=new SnowflakeIdWorker(workId,datacenterId);
|
||||
}
|
||||
/**
|
||||
* 获取18位的唯一主键
|
||||
* @return
|
||||
*/
|
||||
static public long getId(){
|
||||
try {
|
||||
return id.nextId();
|
||||
}catch(RuntimeException e) {
|
||||
//时间被调整回去了,可能是时间同步引起的
|
||||
if(e.toString().contains("Clock moved backwards")) {
|
||||
try {Thread.sleep(50);} catch (InterruptedException e1) {}
|
||||
return id.nextId();
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回18位字符串的唯一ID
|
||||
* @return
|
||||
*/
|
||||
static public String getStrId(){
|
||||
return id.nextId()+"";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,146 @@
|
|||
package ecc.c3.util;
|
||||
|
||||
/**
|
||||
* Twitter_Snowflake<br>
|
||||
* SnowFlake的结构如下(每部分用-分开):<br>
|
||||
* 0 - 0000000000 0000000000 0000000000 0000000000 0 - 00000 - 00000 - 000000000000 <br>
|
||||
* 1位标识,由于long基本类型在Java中是带符号的,最高位是符号位,正数是0,负数是1,所以id一般是正数,最高位是0<br>
|
||||
* 41位时间截(毫秒级),注意,41位时间截不是存储当前时间的时间截,而是存储时间截的差值(当前时间截 - 开始时间截)
|
||||
* 得到的值),这里的的开始时间截,一般是我们的id生成器开始使用的时间,由我们程序来指定的(如下下面程序IdWorker类的startTime属性)。41位的时间截,可以使用69年,年T = (1L << 41) / (1000L * 60 * 60 * 24 * 365) = 69<br>
|
||||
* 10位的数据机器位,可以部署在1024个节点,包括5位datacenterId和5位workerId<br>
|
||||
* 12位序列,毫秒内的计数,12位的计数顺序号支持每个节点每毫秒(同一机器,同一时间截)产生4096个ID序号<br>
|
||||
* 加起来刚好64位,为一个Long型。<br>
|
||||
* SnowFlake的优点是,整体上按照时间自增排序,并且整个分布式系统内不会产生ID碰撞(由数据中心ID和机器ID作区分),并且效率较高,经测试,SnowFlake每秒能够产生26万ID左右。
|
||||
*/
|
||||
public class SnowflakeIdWorker {
|
||||
|
||||
// ==============================Fields===========================================
|
||||
/** 开始时间截 (2015-01-01) */
|
||||
private final long twepoch = 1420041600000L;
|
||||
|
||||
/** 机器id所占的位数 */
|
||||
private final long workerIdBits = 5L;
|
||||
|
||||
/** 数据标识id所占的位数 */
|
||||
private final long datacenterIdBits = 5L;
|
||||
|
||||
/** 支持的最大机器id,结果是31 (这个移位算法可以很快的计算出几位二进制数所能表示的最大十进制数) */
|
||||
private final long maxWorkerId = -1L ^ (-1L << workerIdBits);
|
||||
|
||||
/** 支持的最大数据标识id,结果是31 */
|
||||
private final long maxDatacenterId = -1L ^ (-1L << datacenterIdBits);
|
||||
|
||||
/** 序列在id中占的位数 */
|
||||
private final long sequenceBits = 12L;
|
||||
|
||||
/** 机器ID向左移12位 */
|
||||
private final long workerIdShift = sequenceBits;
|
||||
|
||||
/** 数据标识id向左移17位(12+5) */
|
||||
private final long datacenterIdShift = sequenceBits + workerIdBits;
|
||||
|
||||
/** 时间截向左移22位(5+5+12) */
|
||||
private final long timestampLeftShift = sequenceBits + workerIdBits + datacenterIdBits;
|
||||
|
||||
/** 生成序列的掩码,这里为4095 (0b111111111111=0xfff=4095) */
|
||||
private final long sequenceMask = -1L ^ (-1L << sequenceBits);
|
||||
|
||||
/** 工作机器ID(0~31) */
|
||||
private long workerId;
|
||||
|
||||
/** 数据中心ID(0~31) */
|
||||
private long datacenterId;
|
||||
|
||||
/** 毫秒内序列(0~4095) */
|
||||
private long sequence = 0L;
|
||||
|
||||
/** 上次生成ID的时间截 */
|
||||
private long lastTimestamp = -1L;
|
||||
|
||||
//==============================Constructors=====================================
|
||||
/**
|
||||
* 构造函数
|
||||
* @param workerId 工作ID (0~31)
|
||||
* @param datacenterId 数据中心ID (0~31)
|
||||
*/
|
||||
public SnowflakeIdWorker(long workerId, long datacenterId) {
|
||||
if (workerId > maxWorkerId || workerId < 0) {
|
||||
throw new IllegalArgumentException(String.format("worker Id can't be greater than %d or less than 0", maxWorkerId));
|
||||
}
|
||||
if (datacenterId > maxDatacenterId || datacenterId < 0) {
|
||||
throw new IllegalArgumentException(String.format("datacenter Id can't be greater than %d or less than 0", maxDatacenterId));
|
||||
}
|
||||
this.workerId = workerId;
|
||||
this.datacenterId = datacenterId;
|
||||
}
|
||||
|
||||
// ==============================Methods==========================================
|
||||
/**
|
||||
* 获得下一个ID (该方法是线程安全的)
|
||||
* @return SnowflakeId
|
||||
*/
|
||||
public synchronized long nextId() {
|
||||
long timestamp = timeGen();
|
||||
|
||||
//如果当前时间小于上一次ID生成的时间戳,说明系统时钟回退过这个时候应当抛出异常
|
||||
if (timestamp < lastTimestamp) {
|
||||
throw new RuntimeException(
|
||||
String.format("Clock moved backwards. Refusing to generate id for %d milliseconds", lastTimestamp - timestamp));
|
||||
}
|
||||
|
||||
//如果是同一时间生成的,则进行毫秒内序列
|
||||
if (lastTimestamp == timestamp) {
|
||||
sequence = (sequence + 1) & sequenceMask;
|
||||
//毫秒内序列溢出
|
||||
if (sequence == 0) {
|
||||
//阻塞到下一个毫秒,获得新的时间戳
|
||||
timestamp = tilNextMillis(lastTimestamp);
|
||||
}
|
||||
}
|
||||
//时间戳改变,毫秒内序列重置
|
||||
else {
|
||||
sequence = 0L;
|
||||
}
|
||||
|
||||
//上次生成ID的时间截
|
||||
lastTimestamp = timestamp;
|
||||
|
||||
//移位并通过或运算拼到一起组成64位的ID
|
||||
return ((timestamp - twepoch) << timestampLeftShift) //
|
||||
| (datacenterId << datacenterIdShift) //
|
||||
| (workerId << workerIdShift) //
|
||||
| sequence;
|
||||
}
|
||||
|
||||
/**
|
||||
* 阻塞到下一个毫秒,直到获得新的时间戳
|
||||
* @param lastTimestamp 上次生成ID的时间截
|
||||
* @return 当前时间戳
|
||||
*/
|
||||
protected long tilNextMillis(long lastTimestamp) {
|
||||
long timestamp = timeGen();
|
||||
while (timestamp <= lastTimestamp) {
|
||||
timestamp = timeGen();
|
||||
}
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回以毫秒为单位的当前时间
|
||||
* @return 当前时间(毫秒)
|
||||
*/
|
||||
protected long timeGen() {
|
||||
return System.currentTimeMillis();
|
||||
}
|
||||
|
||||
//==============================Test=============================================
|
||||
/** 测试 */
|
||||
public static void main(String[] args) {
|
||||
SnowflakeIdWorker idWorker = new SnowflakeIdWorker(0, 0);
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
long id = idWorker.nextId();
|
||||
System.out.println(Long.toBinaryString(id));
|
||||
System.out.println(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,7 +3,10 @@
|
|||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="logs/ruoyi-system" />
|
||||
<!-- 日志输出格式 -->
|
||||
<!--
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
|
||||
-->
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} %-5level %logger - [%method,%line] - %msg%n" />
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
|
|
@ -12,6 +15,29 @@
|
|||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统日志输出 -->
|
||||
<appender name="file_debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/debug.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/debug.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>4</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>DEBUG</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 系统日志输出 -->
|
||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/info.log</file>
|
||||
|
|
@ -61,14 +87,24 @@
|
|||
<logger name="com.ruoyi" level="info" />
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn" />
|
||||
<logger name="springfox" level="info" />
|
||||
<logger name="org.apache" level="info" />
|
||||
<logger name="com.alibaba" level="info" />
|
||||
<logger name="org.hibernate" level="info" />
|
||||
<logger name="io.lettuce" level="info" />
|
||||
<logger name="druid.sql" level="info" />
|
||||
<logger name="org.mybatis" level="info" />
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="com.ruoyi.system.mapper" level="debug" />
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="console" />
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<root level="debug">
|
||||
<appender-ref ref="file_info" />
|
||||
<appender-ref ref="file_error" />
|
||||
<appender-ref ref="file_debug" />
|
||||
</root>
|
||||
</configuration>
|
||||
|
|
@ -0,0 +1,145 @@
|
|||
<?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.ruoyi.system.mapper.BulletinInfoMapper">
|
||||
|
||||
<resultMap type="BulletinInfo" id="BulletinInfoResult">
|
||||
<result property="bulletinId" column="BULLETIN_ID" />
|
||||
<result property="title" column="TITLE" />
|
||||
<result property="content" column="CONTENT" />
|
||||
<result property="createTime" column="CREATE_TIME" />
|
||||
<result property="readNum" column="READ_NUM" />
|
||||
<result property="sendTime" column="SEND_TIME" />
|
||||
<result property="createUserId" column="CREATE_USER_ID" />
|
||||
<result property="updateUserId" column="UPDATE_USER_ID" />
|
||||
<result property="updateTime" column="UPDATE_TIME" />
|
||||
<result property="remark" column="REMARK" />
|
||||
<result property="sts" column="STS" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="BulletinInfoBulletinReciveResult" type="BulletinInfo" extends="BulletinInfoResult">
|
||||
<collection property="bulletinReciveList" notNullColumn="sub_RECIVE_ID" javaType="java.util.List" resultMap="BulletinReciveResult" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="BulletinRecive" id="BulletinReciveResult">
|
||||
<result property="reciveId" column="sub_RECIVE_ID" />
|
||||
<result property="reciveUserId" column="sub_RECIVE_USER_ID" />
|
||||
<result property="readTime" column="sub_READ_TIME" />
|
||||
<result property="readNum" column="sub_READ_NUM" />
|
||||
<result property="createTime" column="sub_CREATE_TIME" />
|
||||
<result property="createUserId" column="sub_CREATE_USER_ID" />
|
||||
<result property="updateUserId" column="sub_UPDATE_USER_ID" />
|
||||
<result property="updateTime" column="sub_UPDATE_TIME" />
|
||||
<result property="remark" column="sub_REMARK" />
|
||||
<result property="bulletinId" column="sub_BULLETIN_ID" />
|
||||
<result property="sts" column="sub_STS" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectBulletinInfoVo">
|
||||
select BULLETIN_ID, TITLE, CONTENT, CREATE_TIME, READ_NUM, SEND_TIME, CREATE_USER_ID, UPDATE_USER_ID, UPDATE_TIME, REMARK, STS from t_bulletin_info
|
||||
</sql>
|
||||
|
||||
<select id="selectBulletinInfoList" parameterType="BulletinInfo" resultMap="BulletinInfoResult">
|
||||
<include refid="selectBulletinInfoVo"/>
|
||||
<where>
|
||||
<if test="title != null and title != ''"> and TITLE like concat('%', #{title}, '%')</if>
|
||||
<if test="createUserId != null and createUserId != ''"> and CREATE_USER_ID = #{createUserId}</if>
|
||||
<if test="sts != null and sts != ''"> and STS = #{sts}</if>
|
||||
</where>
|
||||
order by UPDATE_TIME desc
|
||||
</select>
|
||||
|
||||
<select id="selectBulletinInfoListbyBulletinIds" resultMap="BulletinInfoResult">
|
||||
<include refid="selectBulletinInfoVo"/> where BULLETIN_ID in
|
||||
<foreach item="bulletinId" collection="array" open="(" separator="," close=")">
|
||||
#{bulletinId}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="selectBulletinInfoByBulletinId" parameterType="Long" resultMap="BulletinInfoBulletinReciveResult">
|
||||
select a.BULLETIN_ID, a.TITLE, a.CONTENT, a.CREATE_TIME, a.READ_NUM, a.SEND_TIME, a.CREATE_USER_ID, a.UPDATE_USER_ID, a.UPDATE_TIME, a.REMARK, a.STS,
|
||||
b.RECIVE_ID as sub_RECIVE_ID, b.RECIVE_USER_ID as sub_RECIVE_USER_ID, b.READ_TIME as sub_READ_TIME, b.READ_NUM as sub_READ_NUM, b.CREATE_TIME as sub_CREATE_TIME, b.CREATE_USER_ID as sub_CREATE_USER_ID, b.UPDATE_USER_ID as sub_UPDATE_USER_ID, b.UPDATE_TIME as sub_UPDATE_TIME, b.REMARK as sub_REMARK, b.BULLETIN_ID as sub_BULLETIN_ID, b.STS as sub_STS
|
||||
from t_bulletin_info a
|
||||
left join t_bulletin_recive b on b.BULLETIN_ID = a.BULLETIN_ID
|
||||
where a.BULLETIN_ID = #{bulletinId}
|
||||
</select>
|
||||
|
||||
<insert id="insertBulletinInfo" parameterType="BulletinInfo">
|
||||
insert into t_bulletin_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="bulletinId != null">BULLETIN_ID,</if>
|
||||
<if test="title != null and title != ''">TITLE,</if>
|
||||
<if test="content != null and content != ''">CONTENT,</if>
|
||||
<if test="createTime != null">CREATE_TIME,</if>
|
||||
<if test="readNum != null">READ_NUM,</if>
|
||||
<if test="sendTime != null">SEND_TIME,</if>
|
||||
<if test="createUserId != null and createUserId != ''">CREATE_USER_ID,</if>
|
||||
<if test="updateUserId != null">UPDATE_USER_ID,</if>
|
||||
<if test="updateTime != null">UPDATE_TIME,</if>
|
||||
<if test="remark != null">REMARK,</if>
|
||||
<if test="sts != null and sts != ''">STS,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="bulletinId != null">#{bulletinId},</if>
|
||||
<if test="title != null and title != ''">#{title},</if>
|
||||
<if test="content != null and content != ''">#{content},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="readNum != null">#{readNum},</if>
|
||||
<if test="sendTime != null">#{sendTime},</if>
|
||||
<if test="createUserId != null and createUserId != ''">#{createUserId},</if>
|
||||
<if test="updateUserId != null">#{updateUserId},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="sts != null and sts != ''">#{sts},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateBulletinInfo" parameterType="BulletinInfo">
|
||||
update t_bulletin_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="title != null and title != ''">TITLE = #{title},</if>
|
||||
<if test="content != null and content != ''">CONTENT = #{content},</if>
|
||||
<if test="createTime != null">CREATE_TIME = #{createTime},</if>
|
||||
<if test="readNum != null">READ_NUM = #{readNum},</if>
|
||||
<if test="sendTime != null">SEND_TIME = #{sendTime},</if>
|
||||
<if test="createUserId != null and createUserId != ''">CREATE_USER_ID = #{createUserId},</if>
|
||||
<if test="updateUserId != null">UPDATE_USER_ID = #{updateUserId},</if>
|
||||
<if test="updateTime != null">UPDATE_TIME = #{updateTime},</if>
|
||||
<if test="remark != null">REMARK = #{remark},</if>
|
||||
<if test="sts != null and sts != ''">STS = #{sts},</if>
|
||||
</trim>
|
||||
where BULLETIN_ID = #{bulletinId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteBulletinInfoByBulletinId" parameterType="String">
|
||||
delete from t_bulletin_info where BULLETIN_ID = #{bulletinId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBulletinInfoByBulletinIds" parameterType="String">
|
||||
delete from t_bulletin_info where BULLETIN_ID in
|
||||
<foreach item="bulletinId" collection="array" open="(" separator="," close=")">
|
||||
#{bulletinId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBulletinReciveByBulletinIds" parameterType="String">
|
||||
delete from t_bulletin_recive where BULLETIN_ID in
|
||||
<foreach item="bulletinId" collection="array" open="(" separator="," close=")">
|
||||
#{bulletinId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBulletinReciveByBulletinId" parameterType="String">
|
||||
delete from t_bulletin_recive where BULLETIN_ID = #{bulletinId}
|
||||
</delete>
|
||||
|
||||
<insert id="batchBulletinRecive">
|
||||
insert into t_bulletin_recive( RECIVE_ID, RECIVE_USER_ID, READ_TIME, READ_NUM, CREATE_TIME, CREATE_USER_ID, UPDATE_USER_ID, UPDATE_TIME, REMARK, BULLETIN_ID, STS) values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
( #{item.reciveId}, #{item.reciveUserId}, #{item.readTime}, #{item.readNum}, #{item.createTime}, #{item.createUserId}, #{item.updateUserId}, #{item.updateTime}, #{item.remark}, #{item.bulletinId}, #{item.sts})
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,124 @@
|
|||
<?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.ruoyi.system.mapper.BulletinReciveMapper">
|
||||
|
||||
<resultMap type="BulletinRecive" id="BulletinReciveResult">
|
||||
<result property="reciveId" column="RECIVE_ID" />
|
||||
<result property="reciveUserId" column="RECIVE_USER_ID" />
|
||||
<result property="readTime" column="READ_TIME" />
|
||||
<result property="readNum" column="READ_NUM" />
|
||||
<result property="createTime" column="CREATE_TIME" />
|
||||
<result property="createUserId" column="CREATE_USER_ID" />
|
||||
<result property="updateUserId" column="UPDATE_USER_ID" />
|
||||
<result property="updateTime" column="UPDATE_TIME" />
|
||||
<result property="remark" column="REMARK" />
|
||||
<result property="bulletinId" column="BULLETIN_ID" />
|
||||
<result property="sts" column="STS" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectBulletinReciveVo">
|
||||
select RECIVE_ID, RECIVE_USER_ID, READ_TIME, READ_NUM, CREATE_TIME, CREATE_USER_ID, UPDATE_USER_ID, UPDATE_TIME, REMARK, BULLETIN_ID, STS from t_bulletin_recive
|
||||
</sql>
|
||||
|
||||
<select id="selectBulletinReciveList" parameterType="BulletinRecive" resultMap="BulletinReciveResult">
|
||||
<include refid="selectBulletinReciveVo"/>
|
||||
<where>
|
||||
<if test="reciveUserId != null "> and RECIVE_USER_ID = #{reciveUserId}</if>
|
||||
<if test="readTime != null "> and READ_TIME = #{readTime}</if>
|
||||
<if test="readNum != null "> and READ_NUM = #{readNum}</if>
|
||||
<if test="createTime != null "> and CREATE_TIME = #{createTime}</if>
|
||||
<if test="createUserId != null and createUserId != ''"> and CREATE_USER_ID = #{createUserId}</if>
|
||||
<if test="updateUserId != null "> and UPDATE_USER_ID = #{updateUserId}</if>
|
||||
<if test="updateTime != null "> and UPDATE_TIME = #{updateTime}</if>
|
||||
<if test="remark != null and remark != ''"> and REMARK = #{remark}</if>
|
||||
<if test="bulletinId != null "> and BULLETIN_ID = #{bulletinId}</if>
|
||||
<if test="sts != null and sts != ''"> and STS = #{sts}</if>
|
||||
<if test="sts == null or sts == ''"> and STS in ('A','C')</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectBulletinReciveUserIdByBulletinIds" parameterType="String" resultMap="BulletinReciveResult">
|
||||
select RECIVE_USER_ID, BULLETIN_ID from t_bulletin_recive where BULLETIN_ID in
|
||||
<foreach item="bulletinId" collection="array" open="(" separator="," close=")">
|
||||
#{bulletinId}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectBulletinReciveByReciveId" parameterType="String" resultMap="BulletinReciveResult">
|
||||
<include refid="selectBulletinReciveVo"/>
|
||||
where RECIVE_ID = #{reciveId}
|
||||
</select>
|
||||
|
||||
<insert id="insertBulletinRecive" parameterType="BulletinRecive">
|
||||
insert into t_bulletin_recive
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="reciveId != null">RECIVE_ID,</if>
|
||||
<if test="reciveUserId != null">RECIVE_USER_ID,</if>
|
||||
<if test="readTime != null">READ_TIME,</if>
|
||||
<if test="readNum != null">READ_NUM,</if>
|
||||
<if test="createTime != null">CREATE_TIME,</if>
|
||||
<if test="createUserId != null and createUserId != ''">CREATE_USER_ID,</if>
|
||||
<if test="updateUserId != null">UPDATE_USER_ID,</if>
|
||||
<if test="updateTime != null">UPDATE_TIME,</if>
|
||||
<if test="remark != null and remark != ''">REMARK,</if>
|
||||
<if test="bulletinId != null">BULLETIN_ID,</if>
|
||||
<if test="sts != null and sts != ''">STS,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="reciveId != null">#{reciveId},</if>
|
||||
<if test="reciveUserId != null">#{reciveUserId},</if>
|
||||
<if test="readTime != null">#{readTime},</if>
|
||||
<if test="readNum != null">#{readNum},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="createUserId != null and createUserId != ''">#{createUserId},</if>
|
||||
<if test="updateUserId != null">#{updateUserId},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
<if test="bulletinId != null">#{bulletinId},</if>
|
||||
<if test="sts != null and sts != ''">#{sts},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateBulletinRecive" parameterType="BulletinRecive">
|
||||
update t_bulletin_recive
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="reciveUserId != null">RECIVE_USER_ID = #{reciveUserId},</if>
|
||||
<if test="readTime != null">READ_TIME = #{readTime},</if>
|
||||
<if test="readNum != null">READ_NUM = #{readNum},</if>
|
||||
<if test="createTime != null">CREATE_TIME = #{createTime},</if>
|
||||
<if test="createUserId != null and createUserId != ''">CREATE_USER_ID = #{createUserId},</if>
|
||||
<if test="updateUserId != null">UPDATE_USER_ID = #{updateUserId},</if>
|
||||
<if test="updateTime != null">UPDATE_TIME = #{updateTime},</if>
|
||||
<if test="remark != null and remark != ''">REMARK = #{remark},</if>
|
||||
<if test="bulletinId != null">BULLETIN_ID = #{bulletinId},</if>
|
||||
<if test="sts != null and sts != ''">STS = #{sts},</if>
|
||||
</trim>
|
||||
where RECIVE_ID = #{reciveId}
|
||||
</update>
|
||||
|
||||
<update id="batchUpdateRead">
|
||||
update t_bulletin_recive set
|
||||
READ_TIME = sysdate() ,
|
||||
READ_NUM = READ_NUM+1,
|
||||
sts ='A',
|
||||
UPDATE_TIME=sysdate(),
|
||||
UPDATE_USER_ID = RECIVE_USER_ID
|
||||
where RECIVE_ID in
|
||||
<foreach item="reciveId" collection="array" open="(" separator="," close=")">
|
||||
#{reciveId}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<delete id="deleteBulletinReciveByReciveId" parameterType="String">
|
||||
delete from t_bulletin_recive where RECIVE_ID = #{reciveId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBulletinReciveByReciveIds" parameterType="String">
|
||||
delete from t_bulletin_recive where RECIVE_ID in
|
||||
<foreach item="reciveId" collection="array" open="(" separator="," close=")">
|
||||
#{reciveId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue