新增 用户通知偏好设置
This commit is contained in:
@@ -0,0 +1,105 @@
|
||||
package com.vetti.web.controller.hotake;
|
||||
|
||||
import com.vetti.common.annotation.Log;
|
||||
import com.vetti.common.core.controller.BaseController;
|
||||
import com.vetti.common.core.domain.R;
|
||||
import com.vetti.common.core.page.TableWebDataInfo;
|
||||
import com.vetti.common.enums.BusinessType;
|
||||
import com.vetti.hotake.domain.HotakeNotificationPreferences;
|
||||
import com.vetti.hotake.service.IHotakeNotificationPreferencesService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户通知偏好设置Controller
|
||||
*
|
||||
* @author vetti
|
||||
* @date 2026-02-01
|
||||
*/
|
||||
@Api(tags = "用户通知偏好设置")
|
||||
@RestController
|
||||
@RequestMapping("/hotake/notificationPreferences")
|
||||
public class HotakeNotificationPreferencesController extends BaseController {
|
||||
@Autowired
|
||||
private IHotakeNotificationPreferencesService hotakeNotificationPreferencesService;
|
||||
|
||||
/**
|
||||
* 查询用户通知偏好设置列表
|
||||
*/
|
||||
@ApiOperation("查询用户通知偏好设置列表(分页)")
|
||||
@GetMapping("/getPagelist")
|
||||
public TableWebDataInfo<HotakeNotificationPreferences> list(HotakeNotificationPreferences hotakeNotificationPreferences) {
|
||||
startPage();
|
||||
hotakeNotificationPreferences.setCreateBy(getUsername());
|
||||
List<HotakeNotificationPreferences> list = hotakeNotificationPreferencesService.selectHotakeNotificationPreferencesList(hotakeNotificationPreferences);
|
||||
return getWebDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户通知偏好设置列表
|
||||
*/
|
||||
@ApiOperation("查询用户通知偏好设置列表(无分页)")
|
||||
@GetMapping("/getList")
|
||||
public R<List<HotakeNotificationPreferences>> getList(HotakeNotificationPreferences hotakeNotificationPreferences) {
|
||||
hotakeNotificationPreferences.setCreateBy(getUsername());
|
||||
List<HotakeNotificationPreferences> list = hotakeNotificationPreferencesService.selectHotakeNotificationPreferencesList(hotakeNotificationPreferences);
|
||||
return R.ok(list, "");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户通知偏好设置详细信息
|
||||
*/
|
||||
@ApiOperation("获取用户通知偏好设置详细信息")
|
||||
@GetMapping(value = "/{id}")
|
||||
public R<HotakeNotificationPreferences> getInfo(@ApiParam("设置ID") @PathVariable("id") Long id) {
|
||||
return R.ok(hotakeNotificationPreferencesService.selectHotakeNotificationPreferencesById(id), "");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户通知偏好设置
|
||||
*/
|
||||
@ApiOperation("新增用户通知偏好设置")
|
||||
@Log(title = "用户通知偏好设置", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<HotakeNotificationPreferences> add(@RequestBody HotakeNotificationPreferences hotakeNotificationPreferences) {
|
||||
return R.ok(hotakeNotificationPreferencesService.insertHotakeNotificationPreferences(hotakeNotificationPreferences));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户通知偏好设置
|
||||
*/
|
||||
@ApiOperation("修改用户通知偏好设置")
|
||||
@Log(title = "用户通知偏好设置", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<HotakeNotificationPreferences> edit(@RequestBody HotakeNotificationPreferences hotakeNotificationPreferences) {
|
||||
return R.ok(hotakeNotificationPreferencesService.updateHotakeNotificationPreferences(hotakeNotificationPreferences));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户通知偏好设置
|
||||
*/
|
||||
@ApiOperation("删除用户通知偏好设置")
|
||||
@Log(title = "用户通知偏好设置", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{id}")
|
||||
public R remove(@PathVariable Long id) {
|
||||
return R.ok(hotakeNotificationPreferencesService.deleteHotakeNotificationPreferencesById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前登录用户的通知偏好设置
|
||||
* 如果不存在则自动创建默认设置
|
||||
*/
|
||||
@ApiOperation("获取当前登录用户的通知偏好设置")
|
||||
@GetMapping("/getCurrentUser")
|
||||
public R<HotakeNotificationPreferences> getCurrentUserPreferences() {
|
||||
String username = getUsername();
|
||||
HotakeNotificationPreferences preferences = hotakeNotificationPreferencesService.getCurrentUserPreferences(username);
|
||||
return R.ok(preferences, "");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user