linwe
2024-09-03 764d883b5ea3bdc06abbec548b6df0511e567978
src/main/java/org/springblade/modules/task/controller/TaskSchoolEvenController.java
New file
@@ -0,0 +1,144 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.task.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import javax.validation.Valid;
import org.springblade.core.log.annotation.ApiLog;
import org.springblade.core.log.logger.BladeLogger;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.jackson.JsonUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.task.entity.TaskResidencePermitApplyEntity;
import org.springblade.modules.task.service.ITaskSchoolEvenService;
import org.springblade.modules.task.vo.TaskSchoolEvenVO;
import org.springblade.modules.task.wrapper.TaskSchoolEvenWrapper;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.task.entity.TaskSchoolEvenEntity;
import org.springblade.core.boot.ctrl.BladeController;
/**
 * 校园事件 控制器
 *
 * @author BladeX
 * @since 2024-04-18
 */
@RestController
@AllArgsConstructor
@RequestMapping("blade-taskSchoolEven/taskSchoolEven")
@Api(value = "校园事件", tags = "校园事件接口")
public class TaskSchoolEvenController extends BladeController {
   private final BladeLogger bladeLogger;
   private final ITaskSchoolEvenService taskSchoolEvenService;
   /**
    * 校园事件 详情
    */
   @GetMapping("/detail")
   @ApiOperationSupport(order = 1)
   @ApiOperation(value = "详情", notes = "传入taskSchoolEven")
   public R<TaskSchoolEvenVO> detail(TaskSchoolEvenVO taskSchoolEven) {
      TaskSchoolEvenVO detail = taskSchoolEvenService.selectTaskSchoolEvenDetail(taskSchoolEven);
      return R.data(detail);
   }
   /**
    * 校园事件 分页
    */
   @GetMapping("/list")
   @ApiOperationSupport(order = 2)
   @ApiOperation(value = "分页", notes = "传入taskSchoolEven")
   public R<IPage<TaskSchoolEvenVO>> list(TaskSchoolEvenEntity taskSchoolEven, Query query) {
      IPage<TaskSchoolEvenEntity> pages = taskSchoolEvenService.page(Condition.getPage(query), Condition.getQueryWrapper(taskSchoolEven));
      return R.data(TaskSchoolEvenWrapper.build().pageVO(pages));
   }
   /**
    * 校园事件 自定义分页
    */
   @GetMapping("/page")
   @ApiOperationSupport(order = 3)
   @ApiOperation(value = "分页", notes = "传入taskSchoolEven")
   public R<IPage<TaskSchoolEvenVO>> page(TaskSchoolEvenVO taskSchoolEven, Query query) {
      IPage<TaskSchoolEvenVO> pages = taskSchoolEvenService.selectTaskSchoolEvenPage(Condition.getPage(query), taskSchoolEven);
      return R.data(pages);
   }
   /**
    * 校园事件 新增
    */
   @PostMapping("/save")
   @ApiOperationSupport(order = 4)
   @ApiOperation(value = "新增", notes = "传入taskSchoolEven")
   public R save(@Valid @RequestBody TaskSchoolEvenEntity taskSchoolEven) {
      taskSchoolEven.setCreateUser(AuthUtil.getUserId());
      return R.status(taskSchoolEvenService.save(taskSchoolEven));
   }
   /**
    * 校园事件 修改
    */
   @PostMapping("/update")
   @ApiOperationSupport(order = 5)
   @ApiOperation(value = "修改", notes = "传入taskSchoolEven")
   public R update(@Valid @RequestBody TaskSchoolEvenEntity taskSchoolEven) {
      return R.status(taskSchoolEvenService.updateById(taskSchoolEven));
   }
   /**
    * 校园事件 新增或修改
    */
   @PostMapping("/submit")
   @ApiOperationSupport(order = 6)
   @ApiOperation(value = "新增或修改", notes = "传入taskSchoolEven")
   public R submit(@Valid @RequestBody TaskSchoolEvenEntity taskSchoolEven) {
      return R.status(taskSchoolEvenService.saveOrUpdate(taskSchoolEven));
   }
   /**
    * 校园事件 删除
    */
   @PostMapping("/remove")
   @ApiOperationSupport(order = 7)
   @ApiOperation(value = "逻辑删除", notes = "传入ids")
   public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
      return R.status(taskSchoolEvenService.removeBatchByIds(Func.toLongList(ids)));
   }
   /**
    * 校园事件 审核
    */
   @PostMapping("/auditing")
   @ApiOperationSupport(order = 5)
   @ApiLog("校园事件 审核")
   @ApiOperation(value = "审核", notes = "传入taskResidencePermitApply")
   public R updateSchoolEven(@Valid @RequestBody TaskSchoolEvenVO taskSchoolEvenVO) {
      bladeLogger.info("校园事件 审核", JsonUtil.toJson(taskSchoolEvenVO));
      return R.status(taskSchoolEvenService.updateSchoolEven(taskSchoolEvenVO));
   }
}