Commit 2f135272 authored by Quxl's avatar Quxl

管理员权限

parent 17075bfc
...@@ -2,7 +2,6 @@ package com.egolm.film.api.admin; ...@@ -2,7 +2,6 @@ package com.egolm.film.api.admin;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -12,6 +11,7 @@ import org.springframework.util.ResourceUtils; ...@@ -12,6 +11,7 @@ import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSON;
import com.egolm.common.FileUtil; import com.egolm.common.FileUtil;
import com.egolm.common.StringUtil; import com.egolm.common.StringUtil;
import com.egolm.common.bean.Rjx; import com.egolm.common.bean.Rjx;
...@@ -25,6 +25,8 @@ import com.egolm.film.config.XException; ...@@ -25,6 +25,8 @@ import com.egolm.film.config.XException;
import com.egolm.film.util.Common; import com.egolm.film.util.Common;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@Api @Api
...@@ -41,6 +43,12 @@ public class AdminAuthController { ...@@ -41,6 +43,12 @@ public class AdminAuthController {
@ResponseBody @ResponseBody
@RequestMapping("adminList") @RequestMapping("adminList")
@ApiOperation("管理员分页查询") @ApiOperation("管理员分页查询")
@ApiImplicitParams({
@ApiImplicitParam(paramType="query", dataType="string", required=false, name="keyword", value="关键字"),
@ApiImplicitParam(paramType="query", dataType="integer", required=false, name="group_id", value="组ID"),
@ApiImplicitParam(paramType="query", dataType="long", required=true, name="index", value="分页编号"),
@ApiImplicitParam(paramType="query", dataType="long", required=true, name="limit", value="分页大小"),
})
public Object adminList(String keyword, Integer group_id, Long index, Long limit) { public Object adminList(String keyword, Integer group_id, Long index, Long limit) {
index = index == null ? 1 : index; index = index == null ? 1 : index;
limit = limit == null ? 20 : limit; limit = limit == null ? 20 : limit;
...@@ -52,6 +60,12 @@ public class AdminAuthController { ...@@ -52,6 +60,12 @@ public class AdminAuthController {
@ResponseBody @ResponseBody
@RequestMapping("adminSave") @RequestMapping("adminSave")
@ApiOperation("添加管理员") @ApiOperation("添加管理员")
@ApiImplicitParams({
@ApiImplicitParam(paramType="query", dataType="string", required=true, name="realname", value="姓名"),
@ApiImplicitParam(paramType="query", dataType="string", required=true, name="username", value="用户名"),
@ApiImplicitParam(paramType="query", dataType="string", required=true, name="password", value="密码"),
@ApiImplicitParam(paramType="query", dataType="integer", required=true, name="group_id", value="组ID"),
})
public Object adminSave(String realname, String username, String password, Integer group_id) { public Object adminSave(String realname, String username, String password, Integer group_id) {
String remoteIp = WebMvcConfig.getRemoteIp(); String remoteIp = WebMvcConfig.getRemoteIp();
Fc_admin admin = new Fc_admin(); Fc_admin admin = new Fc_admin();
...@@ -73,6 +87,13 @@ public class AdminAuthController { ...@@ -73,6 +87,13 @@ public class AdminAuthController {
@ResponseBody @ResponseBody
@RequestMapping("adminUpdate") @RequestMapping("adminUpdate")
@ApiOperation("修改管理员") @ApiOperation("修改管理员")
@ApiImplicitParams({
@ApiImplicitParam(paramType="query", dataType="string", required=true, name="adminid", value="管理员ID"),
@ApiImplicitParam(paramType="query", dataType="string", required=true, name="realname", value="姓名"),
@ApiImplicitParam(paramType="query", dataType="string", required=true, name="username", value="用户名"),
@ApiImplicitParam(paramType="query", dataType="string", required=false, name="password", value="密码"),
@ApiImplicitParam(paramType="query", dataType="integer", required=true, name="group_id", value="组ID"),
})
public Object adminUpdate(Integer adminid, String realname, String username, String password, Integer group_id) { public Object adminUpdate(Integer adminid, String realname, String username, String password, Integer group_id) {
XException.assertNotBlank("管理员ID不能为空", adminid); XException.assertNotBlank("管理员ID不能为空", adminid);
XException.assertNotBlank("姓名不能为空", realname); XException.assertNotBlank("姓名不能为空", realname);
...@@ -96,6 +117,9 @@ public class AdminAuthController { ...@@ -96,6 +117,9 @@ public class AdminAuthController {
@ResponseBody @ResponseBody
@RequestMapping("adminDilabled") @RequestMapping("adminDilabled")
@ApiOperation("禁用管理员") @ApiOperation("禁用管理员")
@ApiImplicitParams({
@ApiImplicitParam(paramType="query", dataType="integer", required=true, name="adminid", value="管理员ID", allowMultiple=true),
})
public Object adminDilabled(Integer[] adminid) { public Object adminDilabled(Integer[] adminid) {
XException.assertNotBlank("管理员ID不能为空", (Object[])adminid); XException.assertNotBlank("管理员ID不能为空", (Object[])adminid);
service.disableAdmin(adminid); service.disableAdmin(adminid);
...@@ -105,6 +129,11 @@ public class AdminAuthController { ...@@ -105,6 +129,11 @@ public class AdminAuthController {
@ResponseBody @ResponseBody
@RequestMapping("groupList") @RequestMapping("groupList")
@ApiOperation("管理员分组,分页查询") @ApiOperation("管理员分组,分页查询")
@ApiImplicitParams({
@ApiImplicitParam(paramType="query", dataType="string", required=false, name="keyword", value="关键字"),
@ApiImplicitParam(paramType="query", dataType="long", required=true, name="index", value="分页编号"),
@ApiImplicitParam(paramType="query", dataType="long", required=true, name="limit", value="分页大小"),
})
public Object groupList(String keyword, Long index, Long limit) { public Object groupList(String keyword, Long index, Long limit) {
index = index == null ? 1 : index; index = index == null ? 1 : index;
limit = limit == null ? 20 : limit; limit = limit == null ? 20 : limit;
...@@ -114,12 +143,23 @@ public class AdminAuthController { ...@@ -114,12 +143,23 @@ public class AdminAuthController {
} }
@ResponseBody @ResponseBody
@RequestMapping("groupAuth") @RequestMapping("allAuth")
@ApiOperation("管理组权限查询") @ApiOperation("全部权限查询")
public Object groupAuth(Integer gorupid) throws FileNotFoundException { public Object allAuth() throws FileNotFoundException {
File file = ResourceUtils.getFile("classpath:auth_admin.json"); File file = ResourceUtils.getFile("classpath:auth_admin.json");
String json = FileUtil.fileToString(file); String json = FileUtil.fileToString(file);
return Rjx.jsonOk().setData(json); return Rjx.jsonOk().setData(JSON.parseArray(json));
}
@ResponseBody
@RequestMapping("groupAuth")
@ApiOperation("管理组权限查询")
@ApiImplicitParams({
@ApiImplicitParam(paramType="query", dataType="integer", required=true, name="group_id", value="组ID"),
})
public Object groupAuth(Integer group_id) throws FileNotFoundException {
String json = service.queryGroupAuth(group_id);
return Rjx.jsonOk().setData(JSON.parseArray(json));
} }
@ResponseBody @ResponseBody
......
...@@ -21,4 +21,6 @@ public interface AdminAuthService { ...@@ -21,4 +21,6 @@ public interface AdminAuthService {
void mergeAdmin(Fc_admin admin); void mergeAdmin(Fc_admin admin);
String queryGroupAuth(Integer group_id);
} }
...@@ -58,4 +58,10 @@ public class AdminAuthServiceImpl implements AdminAuthService { ...@@ -58,4 +58,10 @@ public class AdminAuthServiceImpl implements AdminAuthService {
jdbcTemplate.merge(admin); jdbcTemplate.merge(admin);
} }
@Override
public String queryGroupAuth(Integer group_id) {
String sql = "select group_power from fc_admin_group where group_id = ?";
return jdbcTemplate.queryForString(sql, group_id);
}
} }
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