mirror of
https://github.com/FatttSnake/Pinnacle-OA.git
synced 2026-04-05 23:11:24 +08:00
add the function of fuzzy query by senderIds had been completed
This commit is contained in:
@@ -8,10 +8,10 @@ import com.cfive.pinnacle.entity.common.ResponseCode;
|
||||
import com.cfive.pinnacle.entity.common.ResponseResult;
|
||||
import com.cfive.pinnacle.service.INoticeReceiveService;
|
||||
import com.cfive.pinnacle.service.INoticeService;
|
||||
import com.cfive.pinnacle.utils.WebUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
@@ -39,7 +39,8 @@ public class NoticeController {
|
||||
//分页查询所有公告或分页模糊查询
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("hasAuthority('notice:manage:get')")
|
||||
public ResponseResult<List<Notice>> selectPageNotice(Integer currentPage, Integer pageSize, String title, String type, String startTime, String endTime,String userName) {
|
||||
public ResponseResult<List<Notice>> selectPageNotice(Integer currentPage, Integer pageSize, String title, String type, String startTime, String endTime,String userIdList) {
|
||||
List<Long> userIds = WebUtil.convertStringToList(userIdList, Long.class);
|
||||
Page<Notice> noticePage;
|
||||
if (null != currentPage && null != pageSize) {
|
||||
noticePage = PageDTO.of(currentPage, pageSize);
|
||||
@@ -47,7 +48,7 @@ public class NoticeController {
|
||||
// 不进行分页
|
||||
noticePage = PageDTO.of(1, -1);
|
||||
}
|
||||
IPage<Notice> noticeIPage = noticeService.selectPageNotice(noticePage, title.trim(), type.trim(), startTime.trim(), endTime.trim(),userName.trim());
|
||||
IPage<Notice> noticeIPage = noticeService.selectPageNotice(noticePage, title.trim(), type.trim(), startTime.trim(), endTime.trim(),userIds);
|
||||
int code = noticeIPage.getRecords() != null ? ResponseCode.DATABASE_SELECT_OK : ResponseCode.DATABASE_SELECT_ERROR;
|
||||
String msg = noticeIPage.getRecords() != null ? String.valueOf(noticeIPage.getTotal()) : "数据查询失败,请重试!";
|
||||
return ResponseResult.build(code, msg, noticeIPage.getRecords());
|
||||
|
||||
@@ -20,6 +20,6 @@ import java.util.List;
|
||||
public interface NoticeMapper extends BaseMapper<Notice> {
|
||||
Notice selectByNoticeId(Long nid);
|
||||
|
||||
IPage<Notice> selectPageNotice(IPage<?> page, String title, String type, LocalDateTime startTime, LocalDateTime endTime,String userName);
|
||||
IPage<Notice> selectPageNotice(IPage<?> page, String title, String type, LocalDateTime startTime, LocalDateTime endTime,List<Long> userIdList);
|
||||
|
||||
}
|
||||
|
||||
@@ -27,5 +27,5 @@ public interface INoticeService extends IService<Notice> {
|
||||
|
||||
Boolean addNotice(Notice notice);
|
||||
|
||||
IPage<Notice> selectPageNotice(IPage<Notice> page, String title, String type, String startTime, String endTime,String userName);
|
||||
IPage<Notice> selectPageNotice(IPage<Notice> page, String title, String type, String startTime, String endTime,List<Long> userIdList);
|
||||
}
|
||||
|
||||
@@ -44,13 +44,13 @@ public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<Notice> selectPageNotice(IPage<Notice> page, String title, String type, String startTime, String endTime,String userName) {
|
||||
public IPage<Notice> selectPageNotice(IPage<Notice> page, String title, String type, String startTime, String endTime,List<Long> userIdList) {
|
||||
LocalDateTime start=null,end=null;
|
||||
if (startTime!=""&&endTime!=""){
|
||||
start= LocalDateTime.parse(startTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
end = LocalDateTime.parse(endTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
}
|
||||
return noticeMapper.selectPageNotice(page, title, type, start, end,userName);
|
||||
return noticeMapper.selectPageNotice(page, title, type, start, end,userIdList);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -50,12 +50,12 @@
|
||||
<if test="null!=startTime">
|
||||
and n.send_time >= #{startTime}
|
||||
</if>
|
||||
<if test="null !=endTime">
|
||||
<if test="null != endTime">
|
||||
and n.end_time < #{endTime}
|
||||
</if>
|
||||
<if test="null!=userName and userName!=''">
|
||||
and u.username = #{userName}
|
||||
</if>
|
||||
<foreach collection="userIdList" item="item" index="index" open="and u.id in (" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
and n.deleted = 0
|
||||
and n.old = 0
|
||||
</where>
|
||||
|
||||
Reference in New Issue
Block a user