app用户消息配置接口

This commit is contained in:
2023-08-21 11:35:40 +08:00
parent 62058c41ca
commit 91217219a4
10 changed files with 282 additions and 2 deletions

View File

@@ -0,0 +1,58 @@
package com.njcn.cssystem.controller.messageConfig;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.cssystem.pojo.param.AppInfoSetParam;
import com.njcn.cssystem.pojo.po.AppInfoSet;
import com.njcn.cssystem.service.IAppInfoSetService;
import com.njcn.web.controller.BaseController;
import com.njcn.web.utils.RequestUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* <p>
* 前端控制器
* </p>
* 用户推送消息配置
* @author xuyang
* @since 2023-08-21
*/
@RestController
@RequestMapping("/appInfoSet")
@Api(tags = "用户推送消息配置")
@AllArgsConstructor
@Validated
public class AppInfoSetController extends BaseController {
private final IAppInfoSetService appInfoSetService;
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/queryByUserId")
@ApiOperation("查看用户消息推送配置")
public HttpResult<AppInfoSet> queryByUserId(){
String methodDescribe = getMethodDescribe("queryByUserId");
AppInfoSet appInfoSet = appInfoSetService.lambdaQuery().eq(AppInfoSet::getUserId,RequestUtil.getUserIndex()).one();
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, appInfoSet, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/update")
@ApiOperation("更新消息推送配置")
@ApiImplicitParam(name = "param", value = "参数实体", required = true)
public HttpResult<String> update(@RequestBody AppInfoSetParam.AppInfoSetUpdateParam param){
String methodDescribe = getMethodDescribe("update");
appInfoSetService.updateAppInfo(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
}

View File

@@ -0,0 +1,16 @@
package com.njcn.cssystem.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.cssystem.pojo.po.AppInfoSet;
/**
* <p>
* Mapper 接口
* </p>
*
* @author xuyang
* @since 2023-08-21
*/
public interface AppInfoSetMapper extends BaseMapper<AppInfoSet> {
}

View File

@@ -0,0 +1,21 @@
package com.njcn.cssystem.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.cssystem.pojo.param.AppInfoSetParam;
import com.njcn.cssystem.pojo.po.AppInfoSet;
/**
* <p>
* 服务类
* </p>
*
* @author xuyang
* @since 2023-08-21
*/
public interface IAppInfoSetService extends IService<AppInfoSet> {
/**
* 更新用户消息配置
*/
void updateAppInfo(AppInfoSetParam param);
}

View File

@@ -0,0 +1,30 @@
package com.njcn.cssystem.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.cssystem.mapper.AppInfoSetMapper;
import com.njcn.cssystem.pojo.param.AppInfoSetParam;
import com.njcn.cssystem.pojo.po.AppInfoSet;
import com.njcn.cssystem.service.IAppInfoSetService;
import com.njcn.web.utils.RequestUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author xuyang
* @since 2023-08-21
*/
@Service
public class AppInfoSetServiceImpl extends ServiceImpl<AppInfoSetMapper, AppInfoSet> implements IAppInfoSetService {
@Override
public void updateAppInfo(AppInfoSetParam param) {
AppInfoSet appInfoSet = new AppInfoSet();
BeanUtils.copyProperties(param,appInfoSet);
appInfoSet.setUserId(RequestUtil.getUserIndex());
this.updateById(appInfoSet);
}
}