feat: 活动编辑功能完成

This commit is contained in:
萌狼蓝天 2024-11-14 09:35:15 +08:00
parent 2dbafa77ea
commit 97b6f2ddb3
4 changed files with 25 additions and 3 deletions

View File

@ -24,8 +24,6 @@ public class ActivateController {
// todo 以后可考虑按机构来加载
return ResponseEntity.ok(activateService.loadActivate());
}
@Operation(
summary = "活动 新增",
description = "新增一个活动",
@ -35,5 +33,14 @@ public class ActivateController {
public ResponseEntity addActivate(@RequestBody ActiveBaseInfo activeBaseInfo){
return ResponseEntity.ok(activateService.addActivate(activeBaseInfo));
}
@Operation(
summary = "活动 更新",
description = "更新活动基本信息",
tags = {"活动相关接口"}
)
@PostMapping("/update")
public ResponseEntity updateActivate(@RequestBody ActiveBaseInfo activeBaseInfo){
return ResponseEntity.ok(activateService.updateActivate(activeBaseInfo));
}
}

View File

@ -13,13 +13,14 @@ import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.security.NoSuchAlgorithmException;
import java.util.Objects;
@Slf4j
@RestController
@Tag(name="系统认证接口")
@RequestMapping("/auth")
@ -87,7 +88,9 @@ public class AuthController {
)
@PostMapping("/logout")
public ResponseEntity logout() {
String id = StpUtil.getLoginId().toString();
StpUtil.logout();
log.info("用户"+id+"退出");
return ResponseEntity.ok().build();
}
@Operation(

View File

@ -12,4 +12,6 @@ public interface ActivateService {
ResponseResult addActivate(ActiveBaseInfo activeBaseInfo);
ResponseResult loadActivate();
ResponseResult updateActivate(ActiveBaseInfo activeBaseInfo);
}

View File

@ -70,4 +70,14 @@ public class ActivateServiceImpl implements ActivateService {
List<ActiveBaseInfo> activeList = activateMapper.selectList(queryWrapper);
return ResponseResult.success(activeList);
}
@Override
public ResponseResult updateActivate(ActiveBaseInfo activeBaseInfo) {
int i = activateMapper.updateById(activeBaseInfo);
if(i>0){
return ResponseResult.success(activeBaseInfo);
}else{
return ResponseResult.error("更新失败");
}
}
}