| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
| | | import com.ycl.entity.NewsInformationPolice;
|
| | | import com.ycl.service.NewsInformationPoliceService;
|
| | | import io.swagger.annotations.Api;
|
| | | import io.swagger.annotations.ApiOperation;
|
| | | import org.springframework.web.bind.annotation.*;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
| | | */
|
| | | @RestController
|
| | | @RequestMapping("newsInformationPolice")
|
| | | @Api(tags = "资讯警员中间表控制层")
|
| | | public class NewsInformationPoliceController extends ApiController {
|
| | | /**
|
| | | * 服务对象
|
| | |
| | | * @return 所有数据
|
| | | */
|
| | | @GetMapping
|
| | | @ApiOperation(value = "查询所有数据")
|
| | | public R selectAll(Page<NewsInformationPolice> page, NewsInformationPolice newsInformationPolice) {
|
| | | return success(this.newsInformationPoliceService.page(page, new QueryWrapper<>(newsInformationPolice)));
|
| | | }
|
| | |
| | | * @return 单条数据
|
| | | */
|
| | | @GetMapping("{id}")
|
| | | @ApiOperation(value = "按id查询数据")
|
| | | public R selectOne(@PathVariable Serializable id) {
|
| | | return success(this.newsInformationPoliceService.getById(id));
|
| | | }
|
| | |
| | | * @return 新增结果
|
| | | */
|
| | | @PostMapping
|
| | | @ApiOperation(value = "新增数据")
|
| | | public R insert(@RequestBody NewsInformationPolice newsInformationPolice) {
|
| | | return success(this.newsInformationPoliceService.save(newsInformationPolice));
|
| | | }
|
| | |
| | | * @return 修改结果
|
| | | */
|
| | | @PutMapping
|
| | | @ApiOperation(value = "修改数据或签收状态")
|
| | | public R updateSignStatus(@RequestBody NewsInformationPolice newsInformationPolice) {
|
| | | if (newsInformationPolice.getId()==null){
|
| | | QueryWrapper<NewsInformationPolice> wrapper = new QueryWrapper<>();
|
| | |
| | | * @return 删除结果
|
| | | */
|
| | | @DeleteMapping
|
| | | @ApiOperation(value = "删除数据")
|
| | | public R delete(@RequestParam("idList") List<Long> idList) {
|
| | | return success(this.newsInformationPoliceService.removeByIds(idList));
|
| | | }
|
| | |
| | | * @return 单条数据
|
| | | */
|
| | | @GetMapping("information/{id}")
|
| | | @ApiOperation(value = "按资讯id查询总数和已阅人数")
|
| | | public R selectListByInformationId(@PathVariable Serializable id) {
|
| | | int sum = this.newsInformationPoliceService.count(new QueryWrapper<NewsInformationPolice>().eq("news_information_id", id));
|
| | | int sign = this.newsInformationPoliceService.count(new QueryWrapper<NewsInformationPolice>().eq("news_information_id", id).eq("is_sign",1));
|