Skip to content

Commit

Permalink
change 删除功能对swagger测试友好性调整
Browse files Browse the repository at this point in the history
  • Loading branch information
enilu committed Jun 4, 2019
1 parent 84c4554 commit 0e9ff5f
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 25 deletions.
Binary file removed docs/demo.gif
Binary file not shown.
Binary file modified docs/quickstart/index.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/quickstart/login.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Expand Up @@ -82,7 +82,7 @@ public Object save(@ModelAttribute Cfg cfg){
}
@RequestMapping(method = RequestMethod.DELETE)
@BussinessLog(value = "删除参数", key = "id",dict= CfgDict.class)
public Object remove(Long id){
public Object remove(@RequestParam Long id){
logger.info("id:{}",id);
if (ToolUtil.isEmpty(id)) {
throw new GunsException(BizExceptionEnum.REQUEST_NULL);
Expand Down
Expand Up @@ -15,10 +15,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;

import java.util.List;

Expand Down Expand Up @@ -56,7 +53,7 @@ public Object save(@ModelAttribute Dept dept){
}
@RequestMapping(method = RequestMethod.DELETE)
@BussinessLog(value = "删除部门", key = "id", dict = DeptDict.class)
public Object remove(Long id){
public Object remove(@RequestParam Long id){
logger.info("id:{}",id);
if (ToolUtil.isEmpty(id)) {
throw new GunsException(BizExceptionEnum.REQUEST_NULL);
Expand Down
@@ -1,8 +1,8 @@
package cn.enilu.flash.api.controller.system;

import cn.enilu.flash.api.controller.BaseController;
import cn.enilu.flash.bean.core.BussinessLog;
import cn.enilu.flash.bean.constant.state.MenuStatus;
import cn.enilu.flash.bean.core.BussinessLog;
import cn.enilu.flash.bean.dictmap.MenuDict;
import cn.enilu.flash.bean.entity.system.Menu;
import cn.enilu.flash.bean.enumeration.BizExceptionEnum;
Expand All @@ -21,10 +21,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;

import java.util.List;

Expand Down Expand Up @@ -70,7 +67,7 @@ public Object save(@ModelAttribute Menu menu) {

@RequestMapping(method = RequestMethod.DELETE)
@BussinessLog(value = "删除菜单", key = "id", dict = MenuDict.class)
public Object remove(Long id) {
public Object remove(@RequestParam Long id) {
logger.info("id:{}", id);
if (ToolUtil.isEmpty(id)) {
throw new GunsException(BizExceptionEnum.REQUEST_NULL);
Expand Down
@@ -1,8 +1,8 @@
package cn.enilu.flash.api.controller.system;

import cn.enilu.flash.api.controller.BaseController;
import cn.enilu.flash.bean.core.BussinessLog;
import cn.enilu.flash.bean.constant.Const;
import cn.enilu.flash.bean.core.BussinessLog;
import cn.enilu.flash.bean.dictmap.RoleDict;
import cn.enilu.flash.bean.entity.system.Role;
import cn.enilu.flash.bean.entity.system.User;
Expand Down Expand Up @@ -31,6 +31,7 @@
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
Expand Down Expand Up @@ -75,7 +76,7 @@ public Object save(@Valid Role role, BindingResult result){
}
@RequestMapping(method = RequestMethod.DELETE)
@BussinessLog(value = "删除角色", key = "roleId", dict = RoleDict.class)
public Object remove(Long roleId){
public Object remove(@RequestParam Long roleId){
logger.info("id:{}",roleId);
if (ToolUtil.isEmpty(roleId)) {
throw new GunsException(BizExceptionEnum.REQUEST_NULL);
Expand Down
@@ -1,8 +1,8 @@
package cn.enilu.flash.api.controller.system;

import cn.enilu.flash.api.controller.BaseController;
import cn.enilu.flash.bean.core.BussinessLog;
import cn.enilu.flash.bean.constant.factory.PageFactory;
import cn.enilu.flash.bean.core.BussinessLog;
import cn.enilu.flash.bean.dictmap.TaskDict;
import cn.enilu.flash.bean.entity.system.Task;
import cn.enilu.flash.bean.entity.system.TaskLog;
Expand All @@ -14,7 +14,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.query.Param;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
Expand Down Expand Up @@ -96,7 +95,7 @@ public Object enable(@RequestParam Long taskId ) {


@RequestMapping(value="/logList")
public Object logList(@Param("taskId") Long taskId) {
public Object logList(@RequestParam Long taskId) {
Page<TaskLog> page = new PageFactory<TaskLog>().defaultPage();
page = taskService.getTaskLogs(page,taskId);
return Rets.success(page);
Expand Down
@@ -1,25 +1,24 @@
package cn.enilu.flash.api.controller.system;

import cn.enilu.flash.api.controller.BaseController;
import cn.enilu.flash.bean.core.BussinessLog;
import cn.enilu.flash.bean.constant.Const;
import cn.enilu.flash.bean.constant.factory.PageFactory;
import cn.enilu.flash.bean.constant.state.ManagerStatus;
import cn.enilu.flash.bean.core.BussinessLog;
import cn.enilu.flash.bean.dictmap.UserDict;
import cn.enilu.flash.bean.dto.UserDto;
import cn.enilu.flash.bean.entity.system.User;
import cn.enilu.flash.bean.enumeration.BizExceptionEnum;
import cn.enilu.flash.bean.exception.GunsException;
import cn.enilu.flash.bean.vo.front.Rets;
import cn.enilu.flash.dao.system.UserRepository;
import cn.enilu.flash.core.factory.UserFactory;
import cn.enilu.flash.dao.system.UserRepository;
import cn.enilu.flash.service.system.UserService;
import cn.enilu.flash.utils.BeanUtil;
import cn.enilu.flash.utils.MD5;
import cn.enilu.flash.utils.ToolUtil;
import cn.enilu.flash.utils.factory.Page;
import cn.enilu.flash.warpper.UserWarpper;
import com.alibaba.fastjson.JSON;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -63,9 +62,6 @@ public Object list(@RequestParam(required = false) String account,
@RequestMapping(method = RequestMethod.POST)
@BussinessLog(value = "编辑管理员", key = "name", dict = UserDict.class)
public Object save( @Valid UserDto user,BindingResult result){
logger.info(JSON.toJSONString(user));


if(user.getId()==null) {
// 判断账号是否重复
User theUser = userRepository.findByAccount(user.getAccount());
Expand All @@ -86,8 +82,7 @@ public Object save( @Valid UserDto user,BindingResult result){

@BussinessLog(value = "删除管理员", key = "userId", dict = UserDict.class)
@RequestMapping(method = RequestMethod.DELETE)
public Object remove(Long userId){
logger.info("id:{}",userId);
public Object remove(@RequestParam Long userId){
if (ToolUtil.isEmpty(userId)) {
throw new GunsException(BizExceptionEnum.REQUEST_NULL);
}
Expand Down

0 comments on commit 0e9ff5f

Please sign in to comment.