From 667ba8be67ccdb294da4dc9dbb97ba1bd8ea6161 Mon Sep 17 00:00:00 2001 From: duanledexianxianxian Date: Fri, 20 Mar 2020 17:59:14 +0800 Subject: [PATCH] init --- .gitignore | 2 + .../demo/contoller/MenuController.java | 61 ++++ .../demo/contoller/UserController.java | 101 +++++++ .../demo/dao/MenuDao.java | 16 ++ .../demo/dao/UserDao.java | 29 ++ .../demo/domain/entity/Menu.java | 57 ++++ .../demo/domain/entity/User.java | 54 ++++ .../demo/service/IMenuService.java | 54 ++++ .../demo/service/IUserService.java | 62 ++++ .../demo/service/impl/MenuServiceImpl.java | 58 ++++ .../demo/service/impl/UserServiceImpl.java | 74 +++++ .../main/resources/mapper/test/MenuDao.xml | 5 + .../main/resources/mapper/test/UserDao.xml | 33 +++ .../Spingboot-demo.postman_collection.json | 265 ++++++++++++++++++ postman/dev-local.postman_environment.json | 16 ++ 15 files changed, 887 insertions(+) create mode 100644 demo/src/main/java/com/duanledexianxianxian/demo/contoller/MenuController.java create mode 100644 demo/src/main/java/com/duanledexianxianxian/demo/contoller/UserController.java create mode 100644 demo/src/main/java/com/duanledexianxianxian/demo/dao/MenuDao.java create mode 100644 demo/src/main/java/com/duanledexianxianxian/demo/dao/UserDao.java create mode 100644 demo/src/main/java/com/duanledexianxianxian/demo/domain/entity/Menu.java create mode 100644 demo/src/main/java/com/duanledexianxianxian/demo/domain/entity/User.java create mode 100644 demo/src/main/java/com/duanledexianxianxian/demo/service/IMenuService.java create mode 100644 demo/src/main/java/com/duanledexianxianxian/demo/service/IUserService.java create mode 100644 demo/src/main/java/com/duanledexianxianxian/demo/service/impl/MenuServiceImpl.java create mode 100644 demo/src/main/java/com/duanledexianxianxian/demo/service/impl/UserServiceImpl.java create mode 100644 demo/src/main/resources/mapper/test/MenuDao.xml create mode 100644 demo/src/main/resources/mapper/test/UserDao.xml create mode 100644 postman/Spingboot-demo.postman_collection.json create mode 100644 postman/dev-local.postman_environment.json diff --git a/.gitignore b/.gitignore index 7760bdc..5747be5 100644 --- a/.gitignore +++ b/.gitignore @@ -84,3 +84,5 @@ buildNumber.properties /.idea/.name /.idea/vcs.xml .idea +/demo-parent.iml +/demo/demo.iml diff --git a/demo/src/main/java/com/duanledexianxianxian/demo/contoller/MenuController.java b/demo/src/main/java/com/duanledexianxianxian/demo/contoller/MenuController.java new file mode 100644 index 0000000..f1f02cf --- /dev/null +++ b/demo/src/main/java/com/duanledexianxianxian/demo/contoller/MenuController.java @@ -0,0 +1,61 @@ +package com.duanledexianxianxian.demo.contoller; + + +import com.duanledexianxianxian.demo.domain.model.query.MenuForm; +import com.duanledexianxianxian.demo.service.IMenuService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +/** + * 菜单接口 + * + * @author duanledexianxianxian + * @since 2020 -03-19 + */ +@RestController +@RequestMapping("/api/v1/menus") +@Slf4j +public class MenuController { + /** + * The Menu service. + */ + @Autowired + private IMenuService menuService; + + /** + * 添加菜单 + * + * @param form 菜单表单 + * @return the long + */ + @PostMapping + public Long addMenu(@RequestBody MenuForm form) { + return menuService.addMenu(form); + } + + + /** + * 编辑菜单 + * + * @param form 菜单表单 + * @return the long + */ + @PutMapping + public Boolean editMenu(@RequestBody MenuForm form) { + return menuService.editMenu(form); + } + + + /** + * 编辑菜单 + * + * @param menuId 菜单编码 + * @return the long + */ + @DeleteMapping("/{menuId}") + public Boolean deleteMenu(@PathVariable("menuId") Long menuId) { + return menuService.deleteMenu(menuId); + } +} diff --git a/demo/src/main/java/com/duanledexianxianxian/demo/contoller/UserController.java b/demo/src/main/java/com/duanledexianxianxian/demo/contoller/UserController.java new file mode 100644 index 0000000..742e6f3 --- /dev/null +++ b/demo/src/main/java/com/duanledexianxianxian/demo/contoller/UserController.java @@ -0,0 +1,101 @@ +package com.duanledexianxianxian.demo.contoller; + + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.duanledexianxianxian.demo.common.util.BeanUtils; +import com.duanledexianxianxian.demo.domain.dto.UserDTO; +import com.duanledexianxianxian.demo.domain.model.query.MenuForm; +import com.duanledexianxianxian.demo.domain.model.query.UserForm; +import com.duanledexianxianxian.demo.domain.model.query.UserQuery; +import com.duanledexianxianxian.demo.domain.model.vo.MenuVO; +import com.duanledexianxianxian.demo.domain.model.vo.UserDetailVO; +import com.duanledexianxianxian.demo.domain.model.vo.UserVO; +import com.duanledexianxianxian.demo.service.IMenuService; +import com.duanledexianxianxian.demo.service.IUserService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; + +import java.awt.*; +import java.util.List; + +/** + * 用户接口 + * + * @author duanledexianxianxian + * @since 2020 -03-19 + */ +@RestController +@RequestMapping("/api/v1/users") +@Slf4j +public class UserController { + /** + * The Menu service. + */ + @Autowired + private IUserService userService; + + /** + * 用户分页列表查询 + * + * @param query the query + * @return the long + */ + @GetMapping + public IPage getUserListPage(UserQuery query) { + IPage page = userService.getUserListPage(query); + if (page != null && !CollectionUtils.isEmpty(page.getRecords())) { + page.setRecords(BeanUtils.copyList(page.getRecords(), UserVO.class)); + } + return page; + } + + + /** + * 获取用户详情 + * + * @param userId the user id + * @return the user menu list + */ + @GetMapping("/{userId}") + public UserDetailVO getUserMenuList(@PathVariable("userId")Long userId) { + UserDTO userDTO = userService.getUserDetail(userId); + return BeanUtils.copyObject(userDTO, UserDetailVO.class); + } + + /** + * 添加用户 + * + * @param form 用户表单 + * @return the long + */ + @PostMapping + public Long addUser(@RequestBody UserForm form) { + return userService.addUser(form); + } + + + /** + * 编辑用户 + * + * @param form 用户表单 + * @return the long + */ + @PutMapping + public Boolean editUser(@RequestBody UserForm form) { + return userService.editUser(form); + } + + + /** + * 删除用户 + * + * @param userId 用户编号 + * @return the long + */ + @DeleteMapping("/{userId}") + public Boolean deleteUser(@PathVariable("userId") Long userId) { + return userService.deleteUser(userId); + } +} diff --git a/demo/src/main/java/com/duanledexianxianxian/demo/dao/MenuDao.java b/demo/src/main/java/com/duanledexianxianxian/demo/dao/MenuDao.java new file mode 100644 index 0000000..87cf733 --- /dev/null +++ b/demo/src/main/java/com/duanledexianxianxian/demo/dao/MenuDao.java @@ -0,0 +1,16 @@ +package com.duanledexianxianxian.demo.dao; + +import com.duanledexianxianxian.demo.domain.entity.Menu; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 菜单表 Mapper 接口 + *

+ * + * @author duanledexianxianxian + * @since 2020-03-19 + */ +public interface MenuDao extends BaseMapper { + +} diff --git a/demo/src/main/java/com/duanledexianxianxian/demo/dao/UserDao.java b/demo/src/main/java/com/duanledexianxianxian/demo/dao/UserDao.java new file mode 100644 index 0000000..ff237a0 --- /dev/null +++ b/demo/src/main/java/com/duanledexianxianxian/demo/dao/UserDao.java @@ -0,0 +1,29 @@ +package com.duanledexianxianxian.demo.dao; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.duanledexianxianxian.demo.domain.entity.User; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.duanledexianxianxian.demo.domain.model.query.UserQuery; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 用户表 Mapper 接口 + *

+ * + * @author duanledexianxianxian + * @since 2020 -03-19 + */ +public interface UserDao extends BaseMapper { + + /** + * Gets list. + * + * @param page the page + * @param query the query + * @return the list + */ + List getList(IPage page, @Param("query") UserQuery query); +} diff --git a/demo/src/main/java/com/duanledexianxianxian/demo/domain/entity/Menu.java b/demo/src/main/java/com/duanledexianxianxian/demo/domain/entity/Menu.java new file mode 100644 index 0000000..7e4398e --- /dev/null +++ b/demo/src/main/java/com/duanledexianxianxian/demo/domain/entity/Menu.java @@ -0,0 +1,57 @@ +package com.duanledexianxianxian.demo.domain.entity; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.time.LocalDateTime; +import java.io.Serializable; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 菜单表 + *

+ * + * @author duanledexianxianxian + * @since 2020-03-19 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("test_menu") +public class Menu implements Serializable { + + private static final long serialVersionUID = 1L; + /** + * 用户编号 + */ + private Long userId; + /** + * 菜单编号 + */ + @TableId + private Long menuId; + + /** + * 菜单url + */ + private String menuUrl; + + /** + * 菜单名称 + */ + private String menuName; + + /** + * 菜单编码 + */ + private String menuCode; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + +} diff --git a/demo/src/main/java/com/duanledexianxianxian/demo/domain/entity/User.java b/demo/src/main/java/com/duanledexianxianxian/demo/domain/entity/User.java new file mode 100644 index 0000000..a12d127 --- /dev/null +++ b/demo/src/main/java/com/duanledexianxianxian/demo/domain/entity/User.java @@ -0,0 +1,54 @@ +package com.duanledexianxianxian.demo.domain.entity; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.time.LocalDate; +import java.io.Serializable; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 用户表 + *

+ * + * @author duanledexianxianxian + * @since 2020-03-19 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("test_user") +public class User implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 用户编号 + */ + @TableId + private Long userId; + + /** + * 用户名称 + */ + private String userName; + + /** + * 用户昵称 + */ + private String nickName; + + /** + * 年龄 + */ + private Integer age; + + /** + * 生日 + */ + private LocalDate birthday; + + +} diff --git a/demo/src/main/java/com/duanledexianxianxian/demo/service/IMenuService.java b/demo/src/main/java/com/duanledexianxianxian/demo/service/IMenuService.java new file mode 100644 index 0000000..78237d5 --- /dev/null +++ b/demo/src/main/java/com/duanledexianxianxian/demo/service/IMenuService.java @@ -0,0 +1,54 @@ +package com.duanledexianxianxian.demo.service; + +import com.duanledexianxianxian.demo.domain.dto.MenuDTO; +import com.duanledexianxianxian.demo.domain.entity.Menu; +import com.baomidou.mybatisplus.extension.service.IService; +import com.duanledexianxianxian.demo.domain.model.query.MenuForm; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +/** + *

+ * 菜单表 服务类 + *

+ * + * @author duanledexianxianxian + * @since 2020 -03-19 + */ +public interface IMenuService extends IService { + + /** + * Add menu long. + * + * @param form the form + * @return the long + */ + Long addMenu(MenuForm form); + + /** + * Edit menu boolean. + * + * @param form the form + * @return the boolean + */ + Boolean editMenu(MenuForm form); + + /** + * Delete menu boolean. + * + * @param menuId the menu id + * @return the boolean + */ + Boolean deleteMenu(Long menuId); + + + /** + * Gets user menu list. + * + * @param userId the user id + * @return the user menu list + */ + List getUserMenuList(Long userId); + +} diff --git a/demo/src/main/java/com/duanledexianxianxian/demo/service/IUserService.java b/demo/src/main/java/com/duanledexianxianxian/demo/service/IUserService.java new file mode 100644 index 0000000..9d7aa10 --- /dev/null +++ b/demo/src/main/java/com/duanledexianxianxian/demo/service/IUserService.java @@ -0,0 +1,62 @@ +package com.duanledexianxianxian.demo.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.duanledexianxianxian.demo.dao.UserDao; +import com.duanledexianxianxian.demo.domain.dto.MenuDTO; +import com.duanledexianxianxian.demo.domain.dto.UserDTO; +import com.duanledexianxianxian.demo.domain.entity.User; +import com.baomidou.mybatisplus.extension.service.IService; +import com.duanledexianxianxian.demo.domain.model.query.MenuForm; +import com.duanledexianxianxian.demo.domain.model.query.UserForm; +import com.duanledexianxianxian.demo.domain.model.query.UserQuery; + +import java.util.List; + +/** + * 用户接口 + * + * @author duanledexianxianxian + * @since 2020 -03-19 + */ +public interface IUserService extends IService { + /** + * Add menu long. + * + * @param query the query + * @return the long + */ + IPage getUserListPage(UserQuery query); + + /** + * Gets user menu list. + * + * @param userId the user id + * @return the user menu list + */ + UserDTO getUserDetail(Long userId); + + + /** + * Add menu long. + * + * @param form the form + * @return the long + */ + Long addUser(UserForm form); + + /** + * Edit menu boolean. + * + * @param form the form + * @return the boolean + */ + Boolean editUser(UserForm form); + + /** + * Delete menu boolean. + * + * @param userId the user id + * @return the boolean + */ + Boolean deleteUser(Long userId); +} diff --git a/demo/src/main/java/com/duanledexianxianxian/demo/service/impl/MenuServiceImpl.java b/demo/src/main/java/com/duanledexianxianxian/demo/service/impl/MenuServiceImpl.java new file mode 100644 index 0000000..f250f20 --- /dev/null +++ b/demo/src/main/java/com/duanledexianxianxian/demo/service/impl/MenuServiceImpl.java @@ -0,0 +1,58 @@ +package com.duanledexianxianxian.demo.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; +import com.duanledexianxianxian.demo.common.util.BeanUtils; +import com.duanledexianxianxian.demo.domain.dto.MenuDTO; +import com.duanledexianxianxian.demo.domain.entity.Menu; +import com.duanledexianxianxian.demo.dao.MenuDao; +import com.duanledexianxianxian.demo.domain.model.query.MenuForm; +import com.duanledexianxianxian.demo.service.IMenuService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +/** + * 菜单服务实现类 + * + * @author duanledexianxianxian + * @since 2020 -03-19 + */ +@Service +public class MenuServiceImpl extends ServiceImpl implements IMenuService { + + @Transactional(rollbackFor = Exception.class) + @Override + public Long addMenu(MenuForm form) { + // 做插入前检查 + Menu menu = BeanUtils.copyObject(form, Menu.class); + this.baseMapper.insert(menu); + return menu.getMenuId(); + } + + + @Transactional(rollbackFor = Exception.class) + @Override + public Boolean editMenu(MenuForm form) { + // 做编辑前检查 + Menu menu = BeanUtils.copyObject(form, Menu.class); + int cnt = this.baseMapper.updateById(menu); + return SqlHelper.retBool(cnt); + } + + + @Transactional(rollbackFor = Exception.class) + @Override + public Boolean deleteMenu(Long menuId) { + // 做删除前检查 + return SqlHelper.retBool(this.baseMapper.deleteById(menuId)); + } + + @Override + public List getUserMenuList(Long userId) { + return BeanUtils.copyList(this.baseMapper.selectList(new LambdaQueryWrapper() + .eq(Menu::getUserId, userId)), MenuDTO.class); + } +} diff --git a/demo/src/main/java/com/duanledexianxianxian/demo/service/impl/UserServiceImpl.java b/demo/src/main/java/com/duanledexianxianxian/demo/service/impl/UserServiceImpl.java new file mode 100644 index 0000000..aea52db --- /dev/null +++ b/demo/src/main/java/com/duanledexianxianxian/demo/service/impl/UserServiceImpl.java @@ -0,0 +1,74 @@ +package com.duanledexianxianxian.demo.service.impl; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; +import com.duanledexianxianxian.demo.common.util.BeanUtils; +import com.duanledexianxianxian.demo.dao.MenuDao; +import com.duanledexianxianxian.demo.domain.dto.MenuDTO; +import com.duanledexianxianxian.demo.domain.dto.UserDTO; +import com.duanledexianxianxian.demo.domain.entity.Menu; +import com.duanledexianxianxian.demo.domain.entity.User; +import com.duanledexianxianxian.demo.dao.UserDao; +import com.duanledexianxianxian.demo.domain.model.query.UserForm; +import com.duanledexianxianxian.demo.domain.model.query.UserQuery; +import com.duanledexianxianxian.demo.service.IMenuService; +import com.duanledexianxianxian.demo.service.IUserService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.List; + +/** + * 用户服务接口实现类 + * + * @author duanledexianxianxian + * @since 2020 -03-19 + */ +@Service +public class UserServiceImpl extends ServiceImpl implements IUserService { + @Autowired + IMenuService menuService; + + @Override + public IPage getUserListPage(UserQuery query) { + IPage page = new Page(query.getPageNum(), query.getPageSize()); + List userList = this.baseMapper.getList(page, query); + page.setRecords(BeanUtils.copyList(userList, UserDTO.class)); + return page; + } + + @Override + public UserDTO getUserDetail(Long userId) { + User user = this.baseMapper.selectById(userId); + // 需要检查用户是否存在 + UserDTO userDTO = BeanUtils.copyObject(user, UserDTO.class); + List menuDTOList = menuService.getUserMenuList(userId); + userDTO.setMenuList(menuDTOList); + return userDTO; + } + + + @Override + public Long addUser(UserForm form) { + // 做插入前检查 + User user = BeanUtils.copyObject(form, User.class); + this.baseMapper.insert(user); + return user.getUserId(); + } + + @Override + public Boolean editUser(UserForm form) { + // 做编辑前检查 + User user = BeanUtils.copyObject(form, User.class); + return SqlHelper.retBool(this.baseMapper.updateById(user)); + } + + @Override + public Boolean deleteUser(Long userId) { + // 做删除前检查 + return SqlHelper.retBool(this.baseMapper.deleteById(userId)); + } +} diff --git a/demo/src/main/resources/mapper/test/MenuDao.xml b/demo/src/main/resources/mapper/test/MenuDao.xml new file mode 100644 index 0000000..b22d87c --- /dev/null +++ b/demo/src/main/resources/mapper/test/MenuDao.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/demo/src/main/resources/mapper/test/UserDao.xml b/demo/src/main/resources/mapper/test/UserDao.xml new file mode 100644 index 0000000..4471bbb --- /dev/null +++ b/demo/src/main/resources/mapper/test/UserDao.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + user_id, user_name, nick_name, age, birthday + + + + + diff --git a/postman/Spingboot-demo.postman_collection.json b/postman/Spingboot-demo.postman_collection.json new file mode 100644 index 0000000..9175b58 --- /dev/null +++ b/postman/Spingboot-demo.postman_collection.json @@ -0,0 +1,265 @@ +{ + "info": { + "_postman_id": "3c980dec-3734-42c7-bfbb-f1fb6297506f", + "name": "Spingboot-demo", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + }, + "item": [ + { + "name": "用户-添加", + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"birthday\": \"2020-05-20\",\n \"userName\": \"liubei\",\n \"nickName\": \"刘备\",\n \"age\": 50\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{url}}/users", + "host": [ + "{{url}}" + ], + "path": [ + "users" + ] + } + }, + "response": [] + }, + { + "name": "用户-编辑", + "request": { + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"userId\":\"1240928784692322306\",\n \"birthday\": \"2020-05-20\",\n \"userName\": \"liubei\",\n \"nickName\": \"刘备\",\n \"age\": 60\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{url}}/users", + "host": [ + "{{url}}" + ], + "path": [ + "users" + ] + } + }, + "response": [] + }, + { + "name": "用户-删除", + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{url}}/users/:userId", + "host": [ + "{{url}}" + ], + "path": [ + "users", + ":userId" + ], + "variable": [ + { + "key": "userId", + "value": "1240928784692322306" + } + ] + } + }, + "response": [] + }, + { + "name": "用户-列表分页", + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}/users?pageNum=1&pageSize=10&userName&nickName", + "host": [ + "{{url}}" + ], + "path": [ + "users" + ], + "query": [ + { + "key": "pageNum", + "value": "1" + }, + { + "key": "pageSize", + "value": "10" + }, + { + "key": "userName", + "value": null + }, + { + "key": "nickName", + "value": null + } + ] + } + }, + "response": [] + }, + { + "name": "用户-用户详情", + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}/users/1?", + "host": [ + "{{url}}" + ], + "path": [ + "users", + "1" + ], + "query": [ + { + "key": "pageNum", + "value": "1", + "disabled": true + }, + { + "key": "pageSize", + "value": "10", + "disabled": true + }, + { + "key": "userName", + "value": null, + "disabled": true + }, + { + "key": "nickName", + "value": null, + "disabled": true + } + ] + } + }, + "response": [] + }, + { + "name": "菜单-添加", + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"userId\":\"1\",\n\t\"menuUrl\":\"XXXXXXX\",\n\t\"menuName\":\"菜单名称\",\n\t\"menuCode\":\"MENU_CODE_0001\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{url}}/menus", + "host": [ + "{{url}}" + ], + "path": [ + "menus" + ] + } + }, + "response": [] + }, + { + "name": "菜单-编辑", + "request": { + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"menuId\":\"1240933880494854145\",\n\t\"userId\":\"1\",\n\t\"menuUrl\":\"YYYYYY\",\n\t\"menuName\":\"菜单名称\",\n\t\"menuCode\":\"MENU_CODE_0001\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{url}}/menus", + "host": [ + "{{url}}" + ], + "path": [ + "menus" + ] + } + }, + "response": [] + }, + { + "name": "菜单-删除", + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{url}}/menus/:menuId", + "host": [ + "{{url}}" + ], + "path": [ + "menus", + ":menuId" + ], + "variable": [ + { + "key": "menuId", + "value": "1240933880494854145" + } + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {} +} \ No newline at end of file diff --git a/postman/dev-local.postman_environment.json b/postman/dev-local.postman_environment.json new file mode 100644 index 0000000..3a14380 --- /dev/null +++ b/postman/dev-local.postman_environment.json @@ -0,0 +1,16 @@ +{ + "id": "7d09cb0c-1f32-4fc9-8044-9a73f395fe1e", + "name": "dev:local", + "values": [ + { + "key": "url", + "value": "http://127.0.0.1:8080/api/v1", + "type": "text", + "description": "", + "enabled": true + } + ], + "_postman_variable_scope": "environment", + "_postman_exported_at": "2020-03-20T09:58:03.011Z", + "_postman_exported_using": "Postman/7.16.1" +} \ No newline at end of file -- GitLab