Commit a01da4cb by whl

修改bug,调整部分接口展示

parent 153db53e
......@@ -11,10 +11,12 @@
<groupId>com.bsoft</groupId>
<artifactId>bsoft-api</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>bsoft-api</name>
<description>Demo project for Spring Boot</description>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<java.version>1.8</java.version>
</properties>
......@@ -22,6 +24,12 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
......@@ -64,6 +72,14 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<!--打包的时候可以不用包进去,别的设施会提供。事实上该依赖理论上可以参与编译,测试,运行等周期。
相当于compile,但是打包阶段做了exclude操作-->
<scope>provided</scope>
</dependency>
</dependencies>
<build>
......
package com.bsoft.api;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
public class ServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
//Application的类名
return application.sources(BsoftApiApplication.class);
}
}
package com.bsoft.api.common;
import io.swagger.annotations.ApiModelProperty;
/**
* 请求统一返回结果
*/
public class Result {
public class Result<T> {
@ApiModelProperty("code")
private int code;
private String msg;
private Object data;
@ApiModelProperty("返回的数据")
private T data;
private Result(int code, String msg, Object data) {
private Result(int code, String msg, T data) {
this.code = code;
this.msg = msg;
this.data = data;
......@@ -43,7 +48,7 @@ public class Result {
return data;
}
public void setData(Object data) {
public void setData(T data) {
this.data = data;
}
......
......@@ -22,7 +22,8 @@ public class CurrentUserMethodArgumentResolver implements HandlerMethodArgumentR
NativeWebRequest nativeWebRequest, WebDataBinderFactory webDataBinderFactory) {
String token = nativeWebRequest.getHeader(Constants.TOKEN_KEY);
if(TokenUtil.checkToken(token)){
return RedisUtil.get(token);
SysUser user = (SysUser) RedisUtil.get(token);
return user.getId();
}
return null;
}
......
......@@ -25,14 +25,14 @@ public class LoginController {
@ApiImplicitParams({
@ApiImplicitParam(value = "登录名", name="loginName", required=true,paramType="query"),
@ApiImplicitParam(value = "密码", name="password", required = true,paramType="query")})
public Object login(String loginName, String password){
public Result<LoginService.LoginInfo> login(String loginName, String password){
LoginService.LoginInfo loginInfo = loginServiceImpl.login(loginName, password);
return Result.success(loginInfo);
}
@GetMapping("token")
@ApiOperation("刷新TOKEN")
public Object refresh(@ApiIgnore HttpServletRequest request){
public Result<String> refresh(@ApiIgnore HttpServletRequest request){
String oldToken = request.getHeader("Authorization");
String token = loginServiceImpl.refreshToken(oldToken);
return Result.success(token);
......
......@@ -36,9 +36,9 @@ public class UserController {
* @param userId 用户id
* @return
*/
@GetMapping("getRole")
@GetMapping("roles")
@Token
public Object getRoleListByUser(@ApiIgnore Long userId)throws Exception{
public Object getRoleListByUser(@ApiIgnore@CurrentUser Long userId)throws Exception{
return Result.success(sysUserRoleRsService.getRoleListByUser(userId));
}
......@@ -47,9 +47,9 @@ public class UserController {
* @param userId 用户id
* @return
*/
@GetMapping("getMenu")
// @Token
public Object getMenuByUser(Long userId)throws Exception{
@GetMapping("menus")
@Token
public Object getMenuByUser(@ApiIgnore@CurrentUser Long userId)throws Exception{
return Result.success(sysMenuService.getMenu(userId));
}
}
package com.bsoft.api.model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
@ApiModel("用户信息")
public class SysUser {
/**
*
......@@ -10,6 +14,7 @@ public class SysUser {
*
* @mbggenerated Tue Oct 22 14:44:12 CST 2019
*/
@ApiModelProperty("用户ID")
private Long id;
/**
......
package com.bsoft.api.service;
import com.bsoft.api.model.SysUser;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
public interface LoginService {
......@@ -9,8 +11,11 @@ public interface LoginService {
String refreshToken(String oldToken);
@ApiModel("登录信息")
class LoginInfo {
@ApiModelProperty("token")
private String token;
@ApiModelProperty("用户信息")
private SysUser user;
public LoginInfo() {
......
package com.bsoft.api.controller;
package com.bsoft.api.unusecontroller;
import com.bsoft.api.common.Result;
import com.bsoft.api.common.base.RequestResult;
import com.bsoft.api.common.enums.RequestResultType;
import com.bsoft.api.model.DicDim;
......@@ -14,7 +13,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@Api(tags = {"维度操作"})
@Api(tags = {"维度操作"}, hidden = true)
@RequestMapping("dim")
@RestController
public class DicDimController {
......
package com.bsoft.api.controller;
package com.bsoft.api.unusecontroller;
import com.bsoft.api.common.base.RequestResult;
import com.bsoft.api.common.enums.RequestResultType;
......@@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@Api(tags = {"指标库"})
@Api(tags = {"指标库"}, hidden = true)
@RequestMapping("ind")
@RestController
public class DicIndController {
......
package com.bsoft.api.controller;
package com.bsoft.api.unusecontroller;
import com.bsoft.api.common.base.RequestResult;
import com.bsoft.api.common.enums.RequestResultType;
......@@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@Api(tags = {"机构"})
@Api(tags = {"机构"}, hidden = true)
@RequestMapping("org")
@RestController
public class DicOrgController {
......
package com.bsoft.api.controller;
package com.bsoft.api.unusecontroller;
import com.bsoft.api.common.base.RequestResult;
import com.bsoft.api.common.enums.RequestResultType;
......@@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@Api(tags = {"菜单"})
@Api(tags = {"菜单"}, hidden = true)
@RequestMapping("menu")
@RestController
public class SysMenuController {
......
package com.bsoft.api.controller;
package com.bsoft.api.unusecontroller;
import com.bsoft.api.common.base.RequestResult;
import com.bsoft.api.common.enums.RequestResultType;
......@@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@Api(tags = {"角色"})
@Api(tags = {"角色"}, hidden = true)
@RequestMapping("role")
@RestController
public class SysRoleController {
......
package com.bsoft.api.controller;
package com.bsoft.api.unusecontroller;
import com.bsoft.api.common.base.RequestResult;
import com.bsoft.api.common.enums.RequestResultType;
......@@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@Api(tags = {"角色菜单关系"})
@Api(tags = {"角色菜单关系"}, hidden = true)
@RequestMapping("roleMenu")
@RestController
public class SysRoleMenuRsController {
......
package com.bsoft.api.controller;
package com.bsoft.api.unusecontroller;
import com.bsoft.api.common.base.RequestResult;
import com.bsoft.api.common.enums.RequestResultType;
......@@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@Api(tags = {"用户菜单关系"})
@Api(tags = {"用户菜单关系"}, hidden = true)
@RequestMapping("userMenu")
@RestController
public class SysUserMenuRsController {
......
package com.bsoft.api.controller;
package com.bsoft.api.unusecontroller;
import com.bsoft.api.common.base.RequestResult;
import com.bsoft.api.common.enums.RequestResultType;
......@@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@Api(tags = {"用户机构关系"})
@Api(tags = {"用户机构关系"}, hidden = true)
@RequestMapping("userOrg")
@RestController
public class SysUserOrgController {
......
package com.bsoft.api.controller;
package com.bsoft.api.unusecontroller;
import com.bsoft.api.common.base.RequestResult;
import com.bsoft.api.common.enums.RequestResultType;
......@@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@Api(tags = {"用户角色关系"})
@Api(tags = {"用户角色关系"}, hidden = true)
@RequestMapping("userRole")
@RestController
public class SysUserRoleRsController {
......
spring.profiles.active=dev
server.servlet.context-path=/api
#server.port=8080
#server.servlet.context-path=/api
mybatis.mapper-locations=classpath:mapper/*.xml
mybatis.type-aliases-package=com.bsoft.api.model
......
......@@ -11,6 +11,7 @@
<result column="MENU_IMAGE" jdbcType="VARCHAR" property="menuImage" />
<result column="PARENT_ID" jdbcType="DECIMAL" property="parentId" />
</resultMap>
<resultMap id="sysMenuResultMap" type="com.bsoft.api.model.respmodel.SysMenuList" extends="BaseResultMap"/>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from LL.SYS_MENU
where ID = #{id,jdbcType=DECIMAL}
......@@ -46,7 +47,7 @@
select ID, CREATE_DATA, CREATE_USERID, STATE, MENU_NAME, MENU_URL, MENU_IMAGE, PARENT_ID
from LL.SYS_MENU
</select>
<select id="selectMenuByUser" resultMap="BaseResultMap">
<select id="selectMenuByUser" resultMap="sysMenuResultMap">
select DISTINCT m.ID,m.CREATE_DATA,m.CREATE_USERID,m.STATE,m.MENU_NAME,m.MENU_URL,m.MENU_IMAGE,m.PARENT_ID
from
SYS_ROLE_MENU_RS rmr
......
......@@ -90,7 +90,7 @@
select ID, CREATE_DATE, CREATE_USERID, STATE, USER_CODE, USER_NAME, PASSWORD, IDCARD,
SEX, MOBILE, PAGE_COUNT, ERROR_COUNT, ERROR_TIME, LAST_TIME, LAST_IP
from LL.SYS_USER
where USER_CODE=#{code,jdbcType=VARCHAR}
where USER_CODE=#{userCode,jdbcType=VARCHAR}
and STATE != 0
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0">
</web-app>
\ No newline at end of file
......@@ -2,15 +2,14 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.bsoft</groupId>
<artifactId>bsoft</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.bsoft</groupId>
<artifactId>bsoft-common</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment