From 77ad3d99678062a3daf44fd02d297d5f933ae5a6 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期二, 19 十二月 2023 16:54:50 +0800
Subject: [PATCH] #

---
 zy-asrs-common/src/main/java/com/zy/asrs/common/sys/controller/OperateLogController.java |   99 +++++++++
 zy-asrs-common/src/main/java/com/zy/asrs/common/sys/controller/ResourceController.java   |  127 +++++++++++
 zy-asrs-common/src/main/java/com/zy/asrs/common/sys/controller/UserController.java       |  138 ++++++++++++
 zy-asrs-common/src/main/java/com/zy/asrs/common/sys/controller/UserLoginController.java  |   97 ++++++++
 zy-asrs-common/src/main/java/com/zy/asrs/common/sys/controller/RoleController.java       |  161 ++++++++++++++
 5 files changed, 622 insertions(+), 0 deletions(-)

diff --git a/zy-asrs-common/src/main/java/com/zy/asrs/common/sys/controller/OperateLogController.java b/zy-asrs-common/src/main/java/com/zy/asrs/common/sys/controller/OperateLogController.java
new file mode 100644
index 0000000..63fd845
--- /dev/null
+++ b/zy-asrs-common/src/main/java/com/zy/asrs/common/sys/controller/OperateLogController.java
@@ -0,0 +1,99 @@
+package com.zy.asrs.common.sys.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.zy.asrs.common.sys.entity.OperateLog;
+import com.zy.asrs.common.sys.service.OperateLogService;
+import com.zy.asrs.common.web.BaseController;
+import com.zy.asrs.framework.annotations.ManagerAuth;
+import com.zy.asrs.framework.common.Cools;
+import com.zy.asrs.framework.common.R;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.*;
+
+@RestController
+public class OperateLogController extends BaseController {
+
+    @Autowired
+    private OperateLogService operateLogService;
+
+    @RequestMapping(value = "/operateLog/{id}/auth")
+    @ManagerAuth
+    public R get(@PathVariable("id") Long id) {
+        return R.ok(operateLogService.getById(String.valueOf(id)));
+    }
+
+    @RequestMapping(value = "/operateLog/list/auth")
+    @ManagerAuth
+    public R list(@RequestParam(defaultValue = "1")Integer curr,
+                  @RequestParam(defaultValue = "10")Integer limit,
+                  @RequestParam(required = false)String orderByField,
+                  @RequestParam(required = false)String orderByType,
+                  @RequestParam Map<String, Object> param){
+        LambdaQueryWrapper<OperateLog> wrapper = new LambdaQueryWrapper<>();
+        return R.ok(operateLogService.page(new Page<>(curr, limit), wrapper));
+    }
+
+    @RequestMapping(value = "/operateLog/edit/auth")
+    @ManagerAuth
+    public R edit(OperateLog operateLog) {
+        if (Cools.isEmpty(operateLog)){
+            return R.error();
+        }
+        if (null == operateLog.getId()){
+            operateLogService.save(operateLog);
+        } else {
+            operateLogService.updateById(operateLog);
+        }
+        return R.ok();
+    }
+
+    @RequestMapping(value = "/operateLog/add/auth")
+    @ManagerAuth
+    public R add(OperateLog operateLog) {
+        operateLogService.save(operateLog);
+        return R.ok();
+    }
+
+	@RequestMapping(value = "/operateLog/update/auth")
+    @ManagerAuth
+    public R update(OperateLog operateLog){
+        if (Cools.isEmpty(operateLog) || null==operateLog.getId()){
+            return R.error();
+        }
+        operateLogService.updateById(operateLog);
+        return R.ok();
+    }
+
+    @RequestMapping(value = "/operateLog/delete/auth")
+    @ManagerAuth
+    public R delete(Integer[] ids){
+        if (Cools.isEmpty(ids)){
+            return R.error();
+        }
+        operateLogService.removeByIds(Arrays.asList(ids));
+        return R.ok();
+    }
+
+    @RequestMapping(value = "/operateLogQuery/auth")
+    @ManagerAuth
+    public R query(String condition) {
+        LambdaQueryWrapper<OperateLog> wrapper = new LambdaQueryWrapper<>();
+        wrapper.like(OperateLog::getAction, condition);
+        Page<OperateLog> page = operateLogService.page(new Page<>(0, 10), wrapper);
+        List<Map<String, Object>> result = new ArrayList<>();
+        for (OperateLog operateLog : page.getRecords()){
+            Map<String, Object> map = new HashMap<>();
+            map.put("id", operateLog.getId());
+            map.put("value", operateLog.getId());
+            result.add(map);
+        }
+        return R.ok(result);
+    }
+
+}
diff --git a/zy-asrs-common/src/main/java/com/zy/asrs/common/sys/controller/ResourceController.java b/zy-asrs-common/src/main/java/com/zy/asrs/common/sys/controller/ResourceController.java
new file mode 100644
index 0000000..dd9bdba
--- /dev/null
+++ b/zy-asrs-common/src/main/java/com/zy/asrs/common/sys/controller/ResourceController.java
@@ -0,0 +1,127 @@
+package com.zy.asrs.common.sys.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.zy.asrs.common.sys.entity.Resource;
+import com.zy.asrs.common.sys.service.ResourceService;
+import com.zy.asrs.common.web.BaseController;
+import com.zy.asrs.framework.annotations.ManagerAuth;
+import com.zy.asrs.framework.common.Cools;
+import com.zy.asrs.framework.common.R;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@RestController
+public class ResourceController extends BaseController {
+
+    @Autowired
+    private ResourceService resourceService;
+
+    @RequestMapping(value = "/resource/{id}/auth")
+    @ManagerAuth
+    public R get(@PathVariable("id") Long id) {
+        return R.ok(resourceService.getById(String.valueOf(id)));
+    }
+
+    @RequestMapping(value = "/resource/list/auth")
+    @ManagerAuth
+    public R list(@RequestParam(defaultValue = "1")Integer curr,
+                  @RequestParam(defaultValue = "10")Integer limit,
+                  @RequestParam(required = false)String orderByField,
+                  @RequestParam(required = false)String orderByType,
+                  @RequestParam Map<String, Object> param){
+        LambdaQueryWrapper<Resource> wrapper = new LambdaQueryWrapper<>();
+        return R.ok(resourceService.page(new Page<>(curr, limit), wrapper));
+    }
+
+    @RequestMapping(value = "/resource/tree/auth")
+    @ManagerAuth
+    public R tree(@RequestParam(defaultValue = "1")Integer curr,
+                  @RequestParam(defaultValue = "10")Integer limit,
+                  @RequestParam(required = false)String orderByField,
+                  @RequestParam(required = false)String orderByType,
+                  @RequestParam Map<String, Object> param){
+        LambdaQueryWrapper<Resource> wrapper = new LambdaQueryWrapper<>();
+        wrapper.orderByAsc(Resource::getSort);
+        return R.parse("0-鎿嶄綔鎴愬姛").add(resourceService.list(wrapper));
+    }
+
+    @RequestMapping(value = "/resource/edit/auth")
+    @ManagerAuth(memo = "鑿滃崟缂栬緫")
+    public R edit(Resource resource) {
+        if (Cools.isEmpty(resource)){
+            return R.error();
+        }
+        if (null == resource.getId()){
+            if (resource.getSort() == null){
+                resource.setSort(999);
+            }
+            resourceService.save(resource);
+        } else {
+            resourceService.updateById(resource);
+        }
+        return R.ok();
+    }
+
+    @RequestMapping(value = "/resource/add/auth")
+    @ManagerAuth(memo = "鑿滃崟娣诲姞")
+    public R add(Resource resource) {
+        resourceService.save(resource);
+        return R.ok();
+    }
+
+    @RequestMapping(value = "/resource/update/auth")
+    @ManagerAuth(memo = "鑿滃崟淇敼")
+    public R update(Resource resource){
+        if (Cools.isEmpty(resource) || null==resource.getId()){
+            return R.error();
+        }
+        resourceService.updateById(resource);
+        return R.ok();
+    }
+
+//    @RequestMapping(value = "/resource/delete/auth")
+//    @ManagerAuth(memo = "鑿滃崟鍒犻櫎")
+//    public R delete(Integer[] ids){
+//        if (Cools.isEmpty(ids)){
+//            return R.error();
+//        }
+//        resourceService.deleteBatchIds(Arrays.asList(ids));
+//        return R.ok();
+//    }
+
+    @RequestMapping(value = "/resource/delete/auth")
+    @ManagerAuth
+    public R delete(@RequestParam(value="ids[]") Long[] ids){
+        for (Long id : ids){
+            resourceService.removeById(id);
+        }
+        return R.ok();
+    }
+
+
+    @RequestMapping(value = "/resourceQuery/auth")
+    @ManagerAuth
+    public R query(String condition) {
+        LambdaQueryWrapper<Resource> wrapper = new LambdaQueryWrapper<>();
+        wrapper.like(Resource::getName, condition);
+        Page<Resource> page = resourceService.page(new Page<>(0, 10), wrapper);
+        List<Map<String, Object>> result = new ArrayList<>();
+        for (Resource resource : page.getRecords()){
+            Map<String, Object> map = new HashMap<>();
+            map.put("id", resource.getId());
+            map.put("value", resource.getName().concat("(").concat(resource.getLevel$().substring(0, 2).concat(")")));
+            result.add(map);
+        }
+        return R.ok(result);
+    }
+
+}
diff --git a/zy-asrs-common/src/main/java/com/zy/asrs/common/sys/controller/RoleController.java b/zy-asrs-common/src/main/java/com/zy/asrs/common/sys/controller/RoleController.java
new file mode 100644
index 0000000..737c7ca
--- /dev/null
+++ b/zy-asrs-common/src/main/java/com/zy/asrs/common/sys/controller/RoleController.java
@@ -0,0 +1,161 @@
+package com.zy.asrs.common.sys.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.zy.asrs.common.sys.entity.Role;
+import com.zy.asrs.common.sys.service.RoleService;
+import com.zy.asrs.common.web.BaseController;
+import com.zy.asrs.framework.annotations.ManagerAuth;
+import com.zy.asrs.framework.common.Cools;
+import com.zy.asrs.framework.common.R;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.*;
+
+@RestController
+public class RoleController extends BaseController {
+
+    @Autowired
+    private RoleService roleService;
+
+    @RequestMapping(value = "/role/{id}/auth")
+    @ManagerAuth
+    public R get(@PathVariable("id") Long id) {
+        return R.ok(roleService.getById(String.valueOf(id)));
+    }
+
+    @RequestMapping(value = "/role/list/auth")
+    @ManagerAuth
+    public R list(@RequestParam(defaultValue = "1")Integer curr,
+                  @RequestParam(defaultValue = "10")Integer limit,
+                  @RequestParam(required = false)String orderByField,
+                  @RequestParam(required = false)String orderByType,
+                  @RequestParam Map<String, Object> param){
+        excludeTrash(param);
+        EntityWrapper<Role> wrapper = new EntityWrapper<>();
+        convert(param, wrapper);
+        wrapper.orderBy("id", false);
+
+        if (9527 == getUserId()) {
+            return R.ok(roleService.selectPage(new Page<>(curr, limit), wrapper));
+        }
+        Long roleId = getUser().getRoleId();
+        Role role = roleService.selectById(roleId);
+        Long leaderId = role.getLeader();
+        if (null != leaderId) {
+            List<Long> leaderIds = new ArrayList<>();
+            leaderIds.add(roleId);
+            while (leaderId != null) {
+                Role leader = roleService.selectById(leaderId);
+                leaderIds.add(leader.getId());
+                leaderId = leader.getLeader();
+            }
+            wrapper.notIn("id", leaderIds);
+        }
+//        if (null != role.getLevel()) {
+//            wrapper.gt("level", role.getLevel());
+//        }
+        return R.ok(roleService.selectPage(new Page<>(curr, limit), wrapper));
+    }
+
+    private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){
+        for (Map.Entry<String, Object> entry : map.entrySet()){
+            String val = String.valueOf(entry.getValue());
+            if (val.contains(RANGE_TIME_LINK)){
+                String[] dates = val.split(RANGE_TIME_LINK);
+                wrapper.ge(entry.getKey(), DateUtils.convert(dates[0]));
+                wrapper.le(entry.getKey(), DateUtils.convert(dates[1]));
+            } else {
+                wrapper.like(entry.getKey(), val);
+            }
+        }
+    }
+
+    @RequestMapping(value = "/role/edit/auth")
+    @ManagerAuth(memo = "瑙掕壊缂栬緫")
+    public R edit(Role role) {
+        if (Cools.isEmpty(role)){
+            return R.error();
+        }
+        if (null == role.getId()){
+            roleService.save(role);
+        } else {
+            roleService.updateById(role);
+        }
+        return R.ok();
+    }
+
+    @RequestMapping(value = "/role/add/auth")
+    @ManagerAuth(memo = "瑙掕壊娣诲姞")
+    public R add(Role role) {
+        roleService.insert(role);
+        return R.ok();
+    }
+
+	@RequestMapping(value = "/role/update/auth")
+    @ManagerAuth(memo = "瑙掕壊淇敼")
+    public R update(Role role){
+        if (Cools.isEmpty(role) || null==role.getId()){
+            return R.error();
+        }
+        roleService.updateById(role);
+        return R.ok();
+    }
+
+    @RequestMapping(value = "/role/delete/auth")
+    @ManagerAuth(memo = "瑙掕壊鍒犻櫎")
+    public R delete(Integer[] ids){
+        if (Cools.isEmpty(ids)){
+            return R.error();
+        }
+        roleService.deleteBatchIds(Arrays.asList(ids));
+        return R.ok();
+    }
+
+    @RequestMapping(value = "/role/export/auth")
+    @ManagerAuth(memo = "瑙掕壊瀵煎嚭")
+    public R export(@RequestBody JSONObject param){
+        List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class);
+        EntityWrapper<Role> wrapper = new EntityWrapper<>();
+        Map<String, Object> map = excludeTrash(param.getJSONObject("role"));
+        convert(map, wrapper);
+        List<Role> list = roleService.selectList(wrapper);
+        return R.ok(exportSupport(list, fields));
+    }
+
+    @RequestMapping(value = "/roleQuery/auth")
+    @ManagerAuth
+    public R query(String condition) {
+        EntityWrapper<Role> wrapper = new EntityWrapper<>();
+        wrapper.like("name", condition);
+        // 涓婁笅绾х鐞�
+        if (9527 != getUserId()) {
+            Long roleId = getUser().getRoleId();
+            Role role = roleService.selectById(roleId);
+            Long leaderId = role.getLeader();
+            if (null != leaderId) {
+                List<Long> leaderIds = new ArrayList<>();
+                while (leaderId != null) {
+                    Role leader = roleService.selectById(leaderId);
+                    leaderIds.add(leader.getId());
+                    leaderId = leader.getLeader();
+                }
+                wrapper.notIn("id", leaderIds);
+            }
+//            if (null != role.getLevel()) {
+//                wrapper.ge("level", role.getLevel());
+//            }
+        }
+
+        Page<Role> page = roleService.selectPage(new Page<>(0, 10), wrapper);
+        List<Map<String, Object>> result = new ArrayList<>();
+        for (Role role : page.getRecords()){
+            Map<String, Object> map = new HashMap<>();
+            map.put("id", role.getId());
+            map.put("value", role.getName());
+            result.add(map);
+        }
+        return R.ok(result);
+    }
+
+}
diff --git a/zy-asrs-common/src/main/java/com/zy/asrs/common/sys/controller/UserController.java b/zy-asrs-common/src/main/java/com/zy/asrs/common/sys/controller/UserController.java
new file mode 100644
index 0000000..11f370d
--- /dev/null
+++ b/zy-asrs-common/src/main/java/com/zy/asrs/common/sys/controller/UserController.java
@@ -0,0 +1,138 @@
+package com.zy.asrs.common.sys.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.zy.asrs.common.sys.entity.Role;
+import com.zy.asrs.common.sys.entity.User;
+import com.zy.asrs.common.sys.service.RoleService;
+import com.zy.asrs.common.sys.service.UserService;
+import com.zy.asrs.common.web.BaseController;
+import com.zy.asrs.framework.annotations.ManagerAuth;
+import com.zy.asrs.framework.common.Cools;
+import com.zy.asrs.framework.common.R;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.*;
+
+@RestController
+public class UserController extends BaseController {
+
+    @Autowired
+    private UserService userService;
+    @Autowired
+    private RoleService roleService;
+
+    @RequestMapping(value = "/user/{id}/auth")
+    @ManagerAuth
+    public R get(@PathVariable("id") Long id) {
+        return R.ok(userService.getById(String.valueOf(id)));
+    }
+
+    @RequestMapping(value = "/user/list/auth")
+    @ManagerAuth
+    public R list(@RequestParam(defaultValue = "1")Integer curr,
+                  @RequestParam(defaultValue = "10")Integer limit,
+                  @RequestParam(required = false)String orderByField,
+                  @RequestParam(required = false)String orderByType,
+                  @RequestParam Map<String, Object> param){
+        excludeTrash(param);
+        LambdaQueryWrapper<User> wrapper = new LambdaQueryWrapper<>();
+        wrapper.orderByDesc(User::getId);
+        if (9527 == getUserId()) {
+            return R.ok(userService.page(new Page<>(curr, limit), wrapper));
+        }
+
+        Long roleId = getUser().getRoleId();
+        Role role = roleService.getById(roleId);
+        Long leaderId = role.getLeader();
+        if (null != leaderId) {
+            List<Long> leaderIds = new ArrayList<>();
+            leaderIds.add(role.getId());
+            while (leaderId != null) {
+                Role leader = roleService.getById(leaderId);
+                leaderIds.add(leader.getId());
+                leaderId = leader.getLeader();
+            }
+            wrapper.notIn(User::getRoleId, leaderIds);
+        }
+
+        return R.ok(userService.page(new Page<>(curr, limit), wrapper));
+    }
+
+
+    @RequestMapping(value = "/user/edit/auth")
+    @ManagerAuth(memo = "绯荤粺鐢ㄦ埛缂栬緫")
+    public R edit(User user) {
+        if (Cools.isEmpty(user)){
+            return R.error();
+        }
+        if (null == user.getId()){
+            user.setStatus(1);
+            user.setCreateTime(new Date());
+            userService.save(user);
+        } else {
+            userService.updateById(user);
+        }
+        return R.ok();
+    }
+
+    @RequestMapping(value = "/user/add/auth")
+    @ManagerAuth(memo = "绯荤粺鐢ㄦ埛娣诲姞")
+    public R add(User user) {
+        user.setStatus(1);
+        user.setCreateTime(new Date());
+        userService.save(user);
+        return R.ok();
+    }
+
+	@RequestMapping(value = "/user/update/auth")
+    @ManagerAuth(memo = "绯荤粺鐢ㄦ埛淇敼")
+    public R update(User user){
+        if (Cools.isEmpty(user) || null==user.getId()){
+            return R.error();
+        }
+        User entity = userService.getById(user.getId());
+        if (user.getPassword()!=null) {
+            entity.setPassword(user.getPassword());
+        }
+        if (user.getUsername()!=null) {
+            entity.setUsername(user.getUsername());
+        }
+        if (user.getMobile()!=null) {
+            entity.setMobile(user.getMobile());
+        }
+        userService.updateById(entity);
+        return R.ok();
+    }
+
+    @RequestMapping(value = "/user/delete/auth")
+    @ManagerAuth(memo = "绯荤粺鐢ㄦ埛鍒犻櫎")
+    public R delete(@RequestParam(value="ids[]") Long[] ids){
+        for (Long id : ids){
+            userService.removeById(id);
+        }
+        return R.ok();
+    }
+
+
+    @RequestMapping(value = "/userQuery/auth")
+    @ManagerAuth
+    public R query(String condition) {
+        LambdaQueryWrapper<User> wrapper = new LambdaQueryWrapper<>();
+        wrapper.like(User::getUsername, condition);
+        Page<User> page = userService.page(new Page<>(0, 10), wrapper);
+        List<Map<String, Object>> result = new ArrayList<>();
+        for (User user : page.getRecords()){
+            Map<String, Object> map = new HashMap<>();
+            map.put("id", user.getId());
+            map.put("value", user.getUsername());
+            result.add(map);
+        }
+        return R.ok(result);
+    }
+
+}
diff --git a/zy-asrs-common/src/main/java/com/zy/asrs/common/sys/controller/UserLoginController.java b/zy-asrs-common/src/main/java/com/zy/asrs/common/sys/controller/UserLoginController.java
new file mode 100644
index 0000000..8b159f2
--- /dev/null
+++ b/zy-asrs-common/src/main/java/com/zy/asrs/common/sys/controller/UserLoginController.java
@@ -0,0 +1,97 @@
+package com.zy.asrs.common.sys.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.zy.asrs.common.sys.entity.UserLogin;
+import com.zy.asrs.common.sys.service.UserLoginService;
+import com.zy.asrs.common.web.BaseController;
+import com.zy.asrs.framework.annotations.ManagerAuth;
+import com.zy.asrs.framework.common.Cools;
+import com.zy.asrs.framework.common.R;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.*;
+
+@RestController
+public class UserLoginController extends BaseController {
+
+    @Autowired
+    private UserLoginService userLoginService;
+
+    @RequestMapping(value = "/userLogin/{id}/auth")
+    @ManagerAuth
+    public R get(@PathVariable("id") Long id) {
+        return R.ok(userLoginService.getById(String.valueOf(id)));
+    }
+
+    @RequestMapping(value = "/userLogin/list/auth")
+    @ManagerAuth
+    public R list(@RequestParam(defaultValue = "1")Integer curr,
+                  @RequestParam(defaultValue = "10")Integer limit,
+                  @RequestParam Map<String, Object> param){
+        LambdaQueryWrapper<UserLogin> wrapper = new LambdaQueryWrapper<>();
+        return R.ok(userLoginService.page(new Page<>(curr, limit), wrapper));
+    }
+
+    @RequestMapping(value = "/userLogin/edit/auth")
+    @ManagerAuth
+    public R edit(UserLogin userLogin) {
+        if (Cools.isEmpty(userLogin)){
+            return R.error();
+        }
+        if (null == userLogin.getId()){
+            userLoginService.save(userLogin);
+        } else {
+            userLoginService.updateById(userLogin);
+        }
+        return R.ok();
+    }
+
+    @RequestMapping(value = "/userLogin/add/auth")
+    @ManagerAuth
+    public R add(UserLogin userLogin) {
+        userLoginService.save(userLogin);
+        return R.ok();
+    }
+
+	@RequestMapping(value = "/userLogin/update/auth")
+    @ManagerAuth
+    public R update(UserLogin userLogin){
+        if (Cools.isEmpty(userLogin) || null==userLogin.getId()){
+            return R.error();
+        }
+        userLoginService.updateById(userLogin);
+        return R.ok();
+    }
+
+    @RequestMapping(value = "/userLogin/delete/auth")
+    @ManagerAuth
+    public R delete(Integer[] ids){
+        if (Cools.isEmpty(ids)){
+            return R.error();
+        }
+        userLoginService.removeByIds(Arrays.asList(ids));
+        return R.ok();
+    }
+
+    @RequestMapping(value = "/userLoginQuery/auth")
+    @ManagerAuth
+    public R query(String condition) {
+        LambdaQueryWrapper<UserLogin> wrapper = new LambdaQueryWrapper<>();
+        wrapper.like(UserLogin::getToken, condition);
+        Page<UserLogin> page = userLoginService.page(new Page<>(0, 10), wrapper);
+        List<Map<String, Object>> result = new ArrayList<>();
+        for (UserLogin userLogin : page.getRecords()){
+            Map<String, Object> map = new HashMap<>();
+            map.put("id", userLogin.getId());
+            map.put("value", userLogin.getToken());
+            result.add(map);
+        }
+        return R.ok(result);
+    }
+
+}

--
Gitblit v1.9.1