Skip to content

Commit

Permalink
✨ 集成 magic-api。
Browse files Browse the repository at this point in the history
  • Loading branch information
icodelife committed Jul 14, 2021
2 parents 97b877a + c4b33d3 commit 5cf9335
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 10 deletions.
15 changes: 6 additions & 9 deletions docs/mysql.sql

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@
<groupId>net.dreamlu</groupId>
<artifactId>mica-ip2region</artifactId>
</dependency>
<dependency>
<groupId>net.dreamlu</groupId>
<artifactId>mica-swagger</artifactId>
</dependency>
<!-- mica end -->
<dependency>
<groupId>org.ssssssss</groupId>
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/net/dreamlu/system/web/AdminController.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package net.dreamlu.system.web;

import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import net.dreamlu.common.annotation.SysLog;
import net.dreamlu.common.base.BaseController;
Expand All @@ -38,6 +39,7 @@
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import springfox.documentation.annotations.ApiIgnore;

import javax.validation.Valid;
import java.util.ArrayList;
Expand All @@ -54,11 +56,13 @@
@Controller
@RequestMapping("/admin")
@RequiredArgsConstructor
@Api(tags = "管理员::管理")
public class AdminController extends BaseController {
private final IAdminService adminService;
private final PasswordEncoder passwordEncoder;
private final IRoleService roleService;

@ApiIgnore
@GetMapping("/editPwdPage")
@PreAuthorize("@sec.hasPermission('admin:edit:pwd')")
public String editPwdPage() {
Expand All @@ -84,6 +88,7 @@ public R<Object> editUserPwd(AuthUser user, String oldPwd, String pwd) {
return status(adminService.updateById(entity));
}

@ApiIgnore
@GetMapping("/manager")
public String manager() {
return "system/admin/adminList";
Expand All @@ -96,6 +101,7 @@ public EasyPage<AdminVO> dataGrid(AdminVO adminVO, PageVO pageVO) {
return EasyPage.of(adminVOIPage);
}

@ApiIgnore
@GetMapping("/addPage")
public String addPage() {
return "system/admin/adminAdd";
Expand Down Expand Up @@ -123,6 +129,7 @@ public R<Object> delete(Admin admin) {
return status(adminService.removeById(admin));
}

@ApiIgnore
@GetMapping("/editPage")
public String editPage(Model model, Integer id) {
Admin admin = adminService.getById(id);
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/net/dreamlu/system/web/CommonController.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package net.dreamlu.system.web;

import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import net.dreamlu.common.DreamConstants;
import net.dreamlu.common.base.BaseController;
Expand All @@ -24,9 +25,11 @@
import net.dreamlu.mica.core.utils.WebUtil;
import net.dreamlu.secrity.auth.AuthUser;
import org.springframework.core.io.Resource;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import springfox.documentation.annotations.ApiIgnore;

import javax.servlet.http.HttpServletResponse;

Expand All @@ -37,14 +40,17 @@
*/
@Controller
@RequiredArgsConstructor
@Api(tags = "公共::管理")
public class CommonController extends BaseController {
private final ICaptchaService captchaService;

@ApiIgnore
@GetMapping({"/", "main"})
public String index() {
return "system/main";
}

@ApiIgnore
@GetMapping("login")
public String loginView(AuthUser user) {
if (user == null) {
Expand All @@ -53,18 +59,20 @@ public String loginView(AuthUser user) {
return redirect("/main");
}

@ApiIgnore
@GetMapping("accessDenied")
public String accessDenied() {
return "system/error/accessDenied";
}

@GetMapping("captcha.jpg")
@GetMapping(value = "captcha.jpg", produces = MediaType.IMAGE_JPEG_VALUE)
public ResponseEntity<Resource> captcha(HttpServletResponse response) {
String uuid = StringUtil.getUUID();
WebUtil.setCookie(response, DreamConstants.CAPTCHA_COOKIE_NAME, uuid, -1);
return captchaService.generateResponseEntity(uuid);
}

@ApiIgnore
@GetMapping("icons.html")
public String icons() {
return "system/common/icons";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package net.dreamlu.system.web;

import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import net.dreamlu.common.annotation.SysLog;
import net.dreamlu.common.base.BaseController;
Expand All @@ -30,6 +31,7 @@
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import springfox.documentation.annotations.ApiIgnore;

import javax.validation.Valid;
import java.util.List;
Expand All @@ -45,9 +47,11 @@
@Controller
@RequestMapping("/organization")
@RequiredArgsConstructor
@Api(tags = "组织::管理")
public class OrganizationController extends BaseController {
private final IOrganizationService organizationService;

@ApiIgnore
@GetMapping("/manager")
public String manager() {
return "system/organization/organizationList";
Expand All @@ -71,6 +75,7 @@ public List<Tree> tree() {
/**
* 添加页面
*/
@ApiIgnore
@GetMapping("/addPage")
public String addPage() {
return "system/organization/organizationAdd";
Expand Down Expand Up @@ -100,6 +105,7 @@ public R<Object> delete(Organization organization) {
/**
* 编辑
*/
@ApiIgnore
@GetMapping("/editPage")
public String editPage(Model model, Long id) {
Organization organization = organizationService.getById(id);
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/net/dreamlu/system/web/ResourceController.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package net.dreamlu.system.web;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import net.dreamlu.common.annotation.SysLog;
import net.dreamlu.common.base.BaseController;
Expand All @@ -32,6 +33,7 @@
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import springfox.documentation.annotations.ApiIgnore;

import javax.validation.Valid;
import java.util.List;
Expand All @@ -47,9 +49,11 @@
@Controller
@RequestMapping("/resource")
@RequiredArgsConstructor
@Api(tags = "资源::管理")
public class ResourceController extends BaseController {
private final IResourceService resourceService;

@ApiIgnore
@GetMapping("/manager")
public String manager() {
return "system/resource/resourceList";
Expand Down Expand Up @@ -98,6 +102,7 @@ public List<Tree> tree(AuthUser authUser) {
* @param model 数据绑定
* @param pid 选中的id
*/
@ApiIgnore
@GetMapping("/addPage")
public String addPage(Model model, Long pid) {
model.addAttribute("pid", pid);
Expand Down Expand Up @@ -128,6 +133,7 @@ public R<Object> delete(Resource resource) {
/**
* 编辑页
*/
@ApiIgnore
@GetMapping("/editPage")
public String editPage(Model model, Long id) {
Resource resource = resourceService.getById(id);
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/net/dreamlu/system/web/RoleController.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import net.dreamlu.common.annotation.SysLog;
import net.dreamlu.common.base.BaseController;
Expand All @@ -34,6 +35,7 @@
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import springfox.documentation.annotations.ApiIgnore;

import javax.validation.Valid;
import java.util.List;
Expand All @@ -49,9 +51,11 @@
@Controller
@RequestMapping("/role")
@RequiredArgsConstructor
@Api(tags = "角色::管理")
public class RoleController extends BaseController {
private final IRoleService roleService;

@ApiIgnore
@GetMapping("/manager")
public String manager() {
return "system/role/roleList";
Expand All @@ -78,6 +82,7 @@ public List<Tree> tree() {
/**
* 添加页面
*/
@ApiIgnore
@GetMapping("/addPage")
public String addPage() {
return "system/role/roleAdd";
Expand Down Expand Up @@ -108,6 +113,7 @@ public R<Object> delete(Role role) {
/**
* 编辑
*/
@ApiIgnore
@GetMapping("/editPage")
public String editPage(Model model, Long id) {
Role role = roleService.getById(id);
Expand All @@ -129,6 +135,7 @@ public R<Object> edit(@Valid Role role) {
/**
* 授权页面
*/
@ApiIgnore
@GetMapping("/grantPage")
public String grantPage(Model model, Long id) {
model.addAttribute("id", id);
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/net/dreamlu/system/web/SysDictController.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import net.dreamlu.common.base.BaseController;
import net.dreamlu.common.result.EasyPage;
Expand All @@ -34,6 +35,7 @@
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import springfox.documentation.annotations.ApiIgnore;

import javax.validation.Valid;
import java.time.LocalDateTime;
Expand All @@ -50,9 +52,11 @@
@Controller
@RequestMapping("/sysDict")
@RequiredArgsConstructor
@Api(tags = "字典::管理")
public class SysDictController extends BaseController {
private final ISysDictService sysDictService;

@ApiIgnore
@GetMapping("/manager")
@PreAuthorize("@sec.hasPermission('sysDict:manager')")
public String manager() {
Expand Down Expand Up @@ -87,6 +91,7 @@ public List<SysDict> list() {
/**
* 添加页面-字典
*/
@ApiIgnore
@GetMapping("/addPage")
public String addPage() {
return "system/sysDict/sysDictAdd";
Expand All @@ -106,6 +111,7 @@ public R<Object> add(@Valid SysDict sysDict) {
/**
* 编辑-字典
*/
@ApiIgnore
@GetMapping("/editPage")
public String editPage(Model model, Integer id) {
SysDict sysDict = sysDictService.getById(id);
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/net/dreamlu/system/web/SysLogController.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package net.dreamlu.system.web;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import net.dreamlu.common.result.EasyPage;
import net.dreamlu.common.result.PageVO;
Expand All @@ -27,6 +28,7 @@
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import springfox.documentation.annotations.ApiIgnore;

/**
* <p>
Expand All @@ -39,9 +41,11 @@
@Controller
@RequestMapping("/sysLog")
@RequiredArgsConstructor
@Api(tags = "日志::管理")
public class SysLogController {
private final ISysLogService sysLogService;

@ApiIgnore
@GetMapping("/manager")
public String manager() {
return "system/sysLog/sysLogList";
Expand Down

0 comments on commit 5cf9335

Please sign in to comment.