Commit 47148483 by Suvalue

返回类型修改

parent 226631ad
......@@ -3,6 +3,7 @@ package com.bsoft.api.controller;
import com.bsoft.api.common.Result;
import com.bsoft.api.common.annotations.CurrentUser;
import com.bsoft.api.common.annotations.Token;
import com.bsoft.api.model.SysRole;
import com.bsoft.api.model.SysUser;
import com.bsoft.api.service.SysMenuService;
import com.bsoft.api.service.SysUserRoleRsService;
......@@ -15,6 +16,8 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
@Api(tags = "用户API",produces="produces",consumes="consumes",protocols="protocols")
@RequestMapping("/user")
......@@ -42,7 +45,8 @@ public class UserController {
@Token
@ApiOperation("查询用户角色")
public Object getRoleListByUser(@ApiIgnore@CurrentUser Long userId)throws Exception{
return Result.success(sysUserRoleRsService.getRoleListByUser(userId));
List<SysRole> list = sysUserRoleRsService.getRoleListByUser(userId);
return Result.success(list);
}
/**
......
......@@ -9,6 +9,14 @@
<result column="USER_ID" jdbcType="DECIMAL" property="userId" />
<result column="ROLE_ID" jdbcType="DECIMAL" property="roleId" />
</resultMap>
<resultMap id="RoleMap" type="com.bsoft.api.model.SysRole">
<id column="ID" jdbcType="DECIMAL" property="id" />
<result column="CREATE_DATE" jdbcType="TIMESTAMP" property="createDate" />
<result column="CREATE_USERID" jdbcType="DECIMAL" property="createUserid" />
<result column="STATE" jdbcType="DECIMAL" property="state" />
<result column="ROLE_NAME" jdbcType="VARCHAR" property="roleName" />
<result column="ROLE_CODE" jdbcType="DECIMAL" property="roleCode" />
</resultMap>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from LL.SYS_USER_ROLE_RS
where ID = #{id,jdbcType=DECIMAL}
......@@ -40,9 +48,10 @@
select ID, CREATE_DATE, CREATE_USERID, STATE, USER_ID, ROLE_ID
from LL.SYS_USER_ROLE_RS
</select>
<select id="selectRoleByUser" resultMap="BaseResultMap">
select ID, CREATE_DATE, CREATE_USERID, STATE, USER_ID, ROLE_ID
from LL.SYS_USER_ROLE_RS
where USER_ID=#{userId,jdbcType=DECIMAL}
<select id="selectRoleByUser" resultMap="RoleMap">
select R.*
from LL.SYS_USER_ROLE_RS ur
left join SYS_ROLE r ON ur.role_ID = r.ID
where ur.USER_ID=#{userId,jdbcType=DECIMAL}
</select>
</mapper>
\ No newline at end of file
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