通知中心接口
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
package com.czg.controller.admin;
|
||||
|
||||
import com.czg.account.entity.SyncNotice;
|
||||
import com.czg.account.service.SyncNoticeService;
|
||||
import com.czg.product.dto.SyncNoticeReadDTO;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/admin/syncNotice")
|
||||
public class SyncNoticeController {
|
||||
@Resource
|
||||
private SyncNoticeService syncNoticeService;
|
||||
|
||||
/**
|
||||
* 通知消息列表
|
||||
* @param name 名称
|
||||
* @param startTime 起始时间
|
||||
* @param endTime 结束时间
|
||||
* @param type 0-商品 1-耗材
|
||||
* @param isRead 0-未读 1-已读
|
||||
* @return 分页数据
|
||||
*/
|
||||
@GetMapping
|
||||
public CzgResult<Page<SyncNotice>> page(@RequestParam(required = false) String name, @RequestParam(required = false) String startTime,
|
||||
@RequestParam(required = false) String endTime, @RequestParam(required = false) Integer type,
|
||||
@RequestParam(required = false) Integer isRead) {
|
||||
return CzgResult.success(syncNoticeService.pageInfo(StpKit.USER.getShopId(), name, startTime, endTime, type, isRead));
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
* @param id id
|
||||
* @return 详细信息
|
||||
*/
|
||||
@GetMapping("/detail")
|
||||
public CzgResult<SyncNotice> detail(@RequestParam Long id) {
|
||||
return CzgResult.success(syncNoticeService.getOne(new QueryWrapper().eq(SyncNotice::getShopId, StpKit.USER.getShopId()).eq(SyncNotice::getId, id)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 已读消息
|
||||
* @return 是否成功
|
||||
*/
|
||||
@PutMapping("/read")
|
||||
public CzgResult<Boolean> read(@RequestBody @Validated SyncNoticeReadDTO syncNoticeReadDTO) {
|
||||
return CzgResult.success(syncNoticeService.read(StpKit.USER.getShopId(), syncNoticeReadDTO));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 消息统计
|
||||
* @return 消息记录数
|
||||
*/
|
||||
@PutMapping("/count")
|
||||
public CzgResult<Long> count(@RequestParam Integer isRead) {
|
||||
QueryWrapper queryWrapper = new QueryWrapper().eq(SyncNotice::getShopId, StpKit.USER.getShopId());
|
||||
queryWrapper.eq(SyncNotice::getIsRead, isRead);
|
||||
return CzgResult.success(syncNoticeService.count(queryWrapper));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user