parent
fc9bb69c85
commit
3ce2d6ffa5
@ -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,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,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,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