package com.e3.library.api;
import com.e3.library.model.library.Model;
import com.e3.library.util.Field;
import com.e3.library.util.FileField;
import com.e3.library.util.ImageField;
import com.e3.library.util.Option;
import com.e3.library.util.menus.Menu;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
public class AdminApi extends BaseApi{
@RequestMapping(value = "/system.api", method = RequestMethod.GET)
public Result index() {
Map<String, Object> data = new HashMap<>();
List<Menu> menus = new ArrayList<>();
//
Menu adminMenu = new Menu("管理员管理", "el-icon-s-custom", "/", false);
adminMenu.addChildMenu(new Menu("管理员列表", "/admin", "list","admin", false));
// adminMenu.addChildMenu(new Menu("角色列表", "/role", "list","role", false));
// adminMenu.addChildMenu(new Menu("普通用户列表", "/user", "list","user", false));
// adminMenu.addChildMenu(new Menu("用户组列表", "/group", "list","group", false));
menus.add(adminMenu);
Menu userMenu = new Menu("学生管理", "el-icon-s-custom", "/", false);
userMenu.addChildMenu(new Menu("学生列表", "/member", "list","member", false));
userMenu.addChildMenu(new Menu("学生课程列表", "/user_plain_course", "list","user_plain_course", false));
menus.add(userMenu);
Menu majorMenu = new Menu("专业管理", "el-icon-s-shop", "/", false);
majorMenu.addChildMenu(new Menu("专业列表", "/major", "list","major", false));
menus.add(majorMenu);
Menu classMenu = new Menu("班级管理", "el-icon-s-flag", "/", false);
classMenu.addChildMenu(new Menu("班级列表", "/classes", "list","class", false));
classMenu.addChildMenu(new Menu("课程列表", "/course", "list","course", false));
classMenu.addChildMenu(new Menu("课表列表", "/plain_course", "list","plain_course", false));
menus.add(classMenu);
Menu fileMenu = new Menu("考试管理", "el-icon-s-order", "/", false);
fileMenu.addChildMenu(new Menu("考场列表", "/plain_exam", "list","plain_exam", false));
fileMenu.addChildMenu(new Menu("成绩列表", "/exam_result", "list","exam_result", false));
fileMenu.addChildMenu(new Menu("普通话成绩列表", "/m_exam_result", "list","m_exam_result", false));
menus.add(fileMenu);
// Menu resultMenu = new Menu("成绩管理", "el-icon-s-order", "/", false);
// resultMenu.addChildMenu(new Menu("成绩列表", "/exam_result", "list","exam_result", false));
// menus.add(resultMenu);
Menu setMenu = new Menu("系统管理", "el-icon-s-shop", "/", false);
setMenu.addChildMenu(new Menu("系统设置", "/setting", "setting","setting", false));
// menus.add(setMenu);
data.put("menus", menus);
// Login Type
List<Option> loginTypes = new ArrayList<>();
loginTypes.add(new Option("管理员", "admin"));
// loginTypes.add(new Option("用户", "user"));
data.put("loginTypes", loginTypes);
data.put("title", "学生信息管理系统");
return this.ok(data);
}
@RequestMapping(value = "/login.api", method = RequestMethod.POST)
public Result index(HttpServletRequest request, @RequestBody Map<String, Object> data) {
Map<String, Object> query = new HashMap<>();
query.put("username", data.get("username"));
query.put("password", data.get("password"));
String table = (String) data.get("type");
Map<String,Object> admin = this.getModel(table).findByWhere(query);
if (admin != null) {
request.getSession().setAttribute("admin", admin);
// 以下字段为登录必须的
data.put("id", admin.get("id"));
data.put("username", admin.get("username"));
data.put("resource", table);
data.put("password", admin.get("password")+"xxx");
// 默认1为超级管理员
if (table.equals("admin")) {
data.put("is_super", true);
data.put("auth_id", 0);
data.put("name", admin.get("username") + "(管理员)");
} else {
data.put("name", admin.get("username"));
data.put("is_super", false);
// 认证ID 以这个ID来获取权限
data.put("auth_id", admin.get("group_id"));
}
data.put("avatar", "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=2180936608,1480355193&fm=26&gp=0.jpg");
return this.ok(data);
} else {
return this.fail(401, "用户名或密码错误");
}
}
@RequestMapping(value = "/{table}/list.api", method = RequestMethod.GET)
public Result index(@PathVariable String table, HttpServletRequest request) {
int page = 1;
if (request.getParameter("page") != null) {
page = Integer.parseInt(request.getParameter("page"));
}
Model model = this.getModel(table, request);
if (!model.validate(request)) {
return fail(401, "认证未通过");
}
Map<String, Object> queries = new HashMap<>();
if (request.getParameter("name") != null && !request.getParameter("name").equals("")) {
queries.put("name", request.getParameter("name"));
}
Map<String, Object> data = new HashMap<>();
// fields
data.put("fields", model.getFields());
// addFields
data.put("addFields", model.getAddFields());
// editFields
data.put("editFields", model.getEditFields());
// searchFields
data.put("searchFields", model.getSearchFields());
// fullActions
data.put("fullActions", model.getFullActions());
// partActions
data.put("partActions", model.getPartActions());
// 数据
data.put("list", model.getVisitData(model.getByPage(queries, page)));
// 总数
data.put("total", model.countByWhere(queries));
return this.ok(data);
}
@RequestMapping(value = "/{table}/{id}.api", method = RequestMethod.GET)
public Result show(@PathVariable String table,@PathVariable Integer id,HttpServletRequest request) {
Model model = this.getModel(table, request);
if (!model.validate(request)) {
return fail(401, "认证未通过");
}
Map<String, Object> data = new HashMap<>();
data.put("fields", model.getAddFields());
data.put("data", model.find(id));
return this.ok(data);
}
@RequestMapping(value = "/{table}.api", method = RequestMethod.POST)
public Result store(@PathVariable String table, HttpServletRequest request, @RequestBody Map<String, Object> data) {
Model model = this.getModel(table, request);
if (!model.validate(request)) {
return fail(401, "认证未通过");
}
System.out.println(data);
model.create(this.getModel(table).getAddData(data));
return this.ok(data);
}
@RequestMapping(value = "/{table}/{id}.api", method = RequestMethod.POST)
public Result update(@PathVariable String table,@PathVariable Integer id, HttpServletRequest request, @RequestBody Map<String, Object> data) {
Model model = this.getModel(table, request);
if (!model.validate(request)) {
return fail(401, "认证未通过");
}
model.updateById(id, this.getModel(table).getEditData(data));
return this
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
源码是经过本地编译可运行的,下载完成之后配置相应环境即可使用。源码功能都是经过老师肯定的,都能满足要求,有需要放心下载即可。源码是经过本地编译可运行的,下载完成之后配置相应环境即可使用。源码功能都是经过老师肯定的,都能满足要求,有需要放心下载即可。源码是经过本地编译可运行的,下载完成之后配置相应环境即可使用。源码功能都是经过老师肯定的,都能满足要求,有需要放心下载即可。源码是经过本地编译可运行的,下载完成之后配置相应环境即可使用。源码功能都是经过老师肯定的,都能满足要求,有需要放心下载即可。源码是经过本地编译可运行的,下载完成之后配置相应环境即可使用。源码功能都是经过老师肯定的,都能满足要求,有需要放心下载即可。源码是经过本地编译可运行的,下载完成之后配置相应环境即可使用。源码功能都是经过老师肯定的,都能满足要求,有需要放心下载即可。源码是经过本地编译可运行的,下载完成之后配置相应环境即可使用。源码功能都是经过老师肯定的,都能满足要求,有需要放心下载即可。源码是经过本地编译可运行的,下载完成之后配置相应环境即可使用。源码功能都是经过老师肯定的,都能满足要求,有需要放心下载即可。源码是经
资源推荐
资源详情
资源评论
收起资源包目录
微信小程序学生信息管理平台源码数据库.zip (1679个子文件)
0014a4b06eee3d0c0d54402a47ab2601b2862b 96KB
00288e9ef0873c340371091cba9e409c322493 1KB
006622124dabd7d01f2f4b2b512d33113ece59 49B
007f3af36dcf6a78a086c212e0687e172e7088 970B
00cbd3c8911c420f61b90496763798691fb28d 835B
0181c304696495142c87263686f21d8e348d17 1KB
0199f46e232e2129487f70cd508663df2cb625 117B
01ac65367817afc7f582dfbb63631995c3015b 135B
025dbeb05eebb85ac2120be8edc7cda530c6f2 268B
02add20b581be471b8d17f887b8e8337070546 194B
03b1227c20f70f30275ce54151b8fff80692d5 261B
0409aaa2e2f4bbc35fe79e602f0e6e5b8edf3d 734B
046640cd85e35a2863b5ebf7942709ac8a9822 4KB
04a7e9b8af15a316ddac67fc8dcb22ec7f1535 326B
04dc5d8fa00437f7d6b23fb58b1bd5a69e1b1d 216B
0570802134691ae10500ad55f5a22a6382ece3 535B
065087d4720326776b26c7b9d2482c9e467bca 2KB
07e2f472e25b38c5c6b217e354c2bcd01c60b9 337B
07fdaef8d453290119594e89eeec125d8f3968 2KB
080764f32287cefed77b6cddeda8d8adc323ef 1KB
083d817208d5078a91c61337851eeaff69104b 518B
084e6b7e601de033beae3f7d45ac8155fe3c40 728B
08710e2757cd03a281986c2ba567c452ad122e 2KB
0924bedcf375bc9c3dbf766d80df830f1b3f0c 69B
098314460265cc54e9a139e1dd904f3c177ca3 1KB
09ef4c3b5afd69129a0b16ebc3386ec7a50e31 62B
0a168fd2df5d17b1264a3c8410a57cb53d6f56 867B
0a37d9916d3bf471c4a7b9ac2c80f9bdb5a5dc 56B
0a57307441c609e448d560b84b215a01d92904 129B
0a591def9355cef54255baa416e2d8e36467f2 10KB
0aa1f3b5d584472fcff7d2772681b4083d9dce 591B
0ac77388e78b58e1ff948ff3b66cbc3d84feeb 114B
0b700850553a3d7be8d33cf6622c5a832cb1f0 2KB
0bbc2a0384e5654525e7581017364dd9ceb59c 3KB
0bc3211ba0c05fb6c0331fec8a6595414a07ae 339B
0bc8c8d5c264e12468e130769a8fbcf00e11f3 1KB
0bd8b0023c25e74fac444bfecd6c5d7a0dc448 2KB
0c59bdd2aa9ec308d40fcf4a8fccd4ec8bdb73 49B
0caf3fb513605e4d46bb395429321ab79bbbdd 259B
0d0987c2b0de093a2644eb22135f255ce9e4d3 5KB
0d1f97816f22a7e670d08ed9e75f1a052ec26e 1KB
0da442e9a796cad2c66a4077c24d0aa7877f78 112B
0dc4da3df110ef54992804ee158dca2e94c65f 314B
0dd10e292cfeca622d7f7f4ba9cee0ec66ba8d 2KB
0e0437647eccae9bbd922ea66f30e7fe71a03b 402B
0ed35126c6ce991d8b01021e90d3f2308c4191 1KB
0effc43623f62e370f124fa17eef2fe97318a2 149B
0fa723f284730b155b8d5b0ec17b964043b5c1 129B
1005f64907298081f51cf27d440fa60067bd43 715B
105c778278e9481286f1d39f719fb4fd96033b 374B
10d88e15c0a15f9c1c4308b4651bb86c9c05cc 62KB
111a38c849fa06175a318fa98625c38d717398 2KB
111ece891c5cfbefc11cc68e26a636457d64d0 1KB
11630d7038b2691a0d4629d5b05ca22a9ff64c 129B
119966f58b845b6949141b3af4b694e89d458e 342B
11cdfa4576ad0ec17b0a7979c3931629239657 209B
1242b121790e8f60f7250f895950998d49f348 1001B
125895a91a379b1fc9c482b5596de75418ee4b 63B
13246e8d0128e3ad1fe707029928260212a41d 409B
13fc60404b91e398a37200c4a77b645cfd9586 75KB
142fad1413e2969c3fc314b4e024d1d36db164 1KB
15447b2c2404f5a50285edd024ab62847de5c3 306B
15f89d79ed82cdb1f53aed2378d887915528f3 3KB
16b7f97f94c4513267e8b4d91608dbd6ee2abb 191B
173f5d512eb466bc7d8a3fca8919d414d31668 145B
17a13c3352391adda9e799e195fdd8ac680cd5 12KB
17b6c497f5738f3a21471e56b6b6c38f5ef8ea 939B
17da8b1aaae2935e19ac97d9015f0fe24e8770 11KB
17fffbd7c90544ae2662f6ccb4d5f2881e1af7 49B
1805a3ebe9d4c430faea75426e6b62fb153186 993B
182909fdb21691a176c70e239b9ff7f35e57c1 338B
182eb12bc439ea1e30cf4aef2a636346e83bc5 73KB
18e9d6c1f36df198864839d75a3398764bdc50 28KB
18f16cdc5e9c6b4b5fe9d988cc349c22abeaeb 74B
19348537e7b85ced6e8076027a4b093f19d270 885B
19450735430d2e0e2f20824751d1a6845f4171 484B
197792c2a1e0c0770edfabc411afd1f5bda61a 541B
1a6d838096ad19c8f348f8202049aa620cbe95 2KB
1ac575155adf99713dc243c64bb1b572a2dec0 49B
1accf3b8775229fdea255ade8bfd25a9f46208 2KB
1ba1edcc1413408d1224b03bb871d5fa13e056 5KB
1bb513bf3431152acb6453d280500e316c5e18 674B
1bed76bd45a281ebb622a05559165b8cf6ea5f 113B
1c51cf710508467a3e7bba337a161d0e4e8ce9 727B
1c88a3e8658cde7b25b6e063d23d010f7ed86a 3KB
1d53ce58bf74d7c73486a07029b9527aff003b 135B
1d89830e8b8adec9c1c6787a8ac302ee6bd847 145B
1d9e54e3ccc7b5b73bdcc019cb0ac6e65e20b5 2KB
1e703c7711601ff5bf812199c409b4cbbdafd7 114B
1eca6e7db6e251d8d1d63dc512af512d8c3b94 3KB
1f37cc8c4c637900e3d43745ce433712f70ea1 149B
1f4fdd223639486136a0f33adeac7463ccbc7d 377B
1f5334512bb878a32aeffa26b1c9c1daf2b7a6 50B
1f9d7e6fe1031d07feb84b9769a54869aeda29 46B
1fe75a7694731fcdc2b1f660eda251a22b06d3 74B
211e703547c767768c4ca368de1b9c12392077 777B
217db674f6cd688b62f498b8409e79fc92239f 12KB
21d615d70d678340d317f19064d28d901461e7 2KB
2200c51ee924f0b91132e5cd3737fadcf40ef8 3KB
22132dbb7d558e6b9c6540ab29628a0195eed7 134B
共 1679 条
- 1
- 2
- 3
- 4
- 5
- 6
- 17
资源评论
老歪不歪
- 粉丝: 44
- 资源: 4368
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 离线安装包 Adobe Flash Player 32.0.0.156 for Linux 32-bit PPAPI
- javaweb作业jsp内置对象作业:简单购物车功能
- 【java毕业设计】野生动物公益保护系统源码(ssm+mysql+说明文档+LW).zip
- 离线安装包 Adobe Flash Player 32.0.0.156 for Linux 64-bit NPAPI
- 单片机测频率DSN
- 【java毕业设计】学习交流平台源码(ssm+mysql+说明文档+LW).zip
- Jsp内置对象作业:Session、Cookie实现登录功能,记住用户密码功能等
- 【java毕业设计】融资租赁管理系统源码(ssm+mysql+说明文档+LW).zip
- 离线安装包 Adobe Flash Player 32.0.0.156 for Linux 64-bit PPAPI
- 黑客与渗透测试编程之道.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功