123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- package com.fdkankan.manage.controller;
- import cn.dev33.satoken.stp.StpUtil;
- import com.fdkankan.manage.common.ResultCode;
- import com.fdkankan.manage.common.ResultData;
- import com.fdkankan.manage.entity.ServiceUpTip;
- import com.fdkankan.manage.exception.BusinessException;
- import com.fdkankan.manage.service.IServiceUpTipService;
- import com.fdkankan.manage.vo.request.ServiceUPTipParam;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.PostMapping;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- /**
- * <p>
- * 前端控制器
- * </p>
- *
- * @author
- * @since 2023-04-03
- */
- @RestController
- @RequestMapping("/service/manage/serviceUpTip")
- public class ServiceUpTipController extends BaseController{
- @Autowired
- IServiceUpTipService serviceUpTipService;
- @PostMapping("/list")
- public ResultData list(@RequestBody ServiceUPTipParam param){
- if(param.getType() == null){
- throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
- }
- return ResultData.ok(serviceUpTipService.pageList(param));
- }
- @PostMapping("/saveOrUpdate")
- public ResultData saveOrUpdate(@RequestBody ServiceUpTip param){
- if(param.getId() != null){
- ServiceUpTip entity = serviceUpTipService.getById(param.getId());
- param.setType(entity.getType());
- }
- param.setCreateTime(null);
- param.setUpdateTime(null);
- param.setSysUserId(Long.valueOf((String)StpUtil.getLoginId()));
- if(param.getBanStatus() !=null && param.getBanStatus() == 0){
- serviceUpTipService.banOther(param.getType());
- }
- serviceUpTipService.saveOrUpdate(param);
- return ResultData.ok();
- }
- @PostMapping("/delete")
- public ResultData delete(@RequestBody ServiceUpTip param){
- if(param.getId() == null){
- throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
- }
- serviceUpTipService.removeById(param.getId());
- return ResultData.ok();
- }
- }
|