用户中心
diff --git a/src/main/java/com/supwisdom/dlpay/api/dao/PersonDao.java b/src/main/java/com/supwisdom/dlpay/api/dao/PersonDao.java
index 9b03661..988afaa 100644
--- a/src/main/java/com/supwisdom/dlpay/api/dao/PersonDao.java
+++ b/src/main/java/com/supwisdom/dlpay/api/dao/PersonDao.java
@@ -1,6 +1,8 @@
 package com.supwisdom.dlpay.api.dao;
 
 import com.supwisdom.dlpay.api.domain.TPerson;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.Query;
 import org.springframework.stereotype.Repository;
@@ -15,4 +17,6 @@
     TPerson findByIdentity(String idtype, String idno);
 
     TPerson findByUserid(String userid);
+
+    Page<TPerson> findAllByNameContaining(String name, Pageable pageable);
 }
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/RoleFunctionDao.java b/src/main/java/com/supwisdom/dlpay/framework/dao/RoleFunctionDao.java
index 565ebe6..a8381a1 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/dao/RoleFunctionDao.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/dao/RoleFunctionDao.java
@@ -18,10 +18,10 @@
 
     List<TRoleFunction> findByRoleId(String roleId);
 
-    @Query(value = " select f.id||'' as id ,f.parentid||'' as pid,f.name,case when rf.id is null then 0 else 1 end as checked from tb_function f " +
-            " left join tb_role_function rf on rf.functionid = f.id and rf.roleid=?1 " +
+    @Query(value = " select f.id||'' as id ,f.parentid||'' as pid,f.name,case when rf.id is null then 0 else 1 end as checked,case when rf.id is null then 1 else 0 end as open from tb_function f " +
+            " left join tb_role_function rf on rf.functionid = f.id and rf.roleid=?1  " +
             " union all " +
-            " select r.id||'_res' as id,r.function_id||'' as pid,r.name,case when p.id is null then 0 else 1 end as checked from tb_resource  r " +
+            " select r.id||'_res' as id,r.function_id||'' as pid,r.name,case when p.id is null then 0 else 1 end as checked,0 as open from tb_resource  r " +
             " left join tb_permission p on p.resid = r.id and p.roleid=?1 " , nativeQuery = true)
     List<NodeData> findByRoleIdNative(String roleId);
 
diff --git a/src/main/java/com/supwisdom/dlpay/framework/data/NodeData.java b/src/main/java/com/supwisdom/dlpay/framework/data/NodeData.java
index 19197d3..8f4975a 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/data/NodeData.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/data/NodeData.java
@@ -7,7 +7,7 @@
 
     String getName();
 
-    boolean getOpen();
+    Integer getOpen();
 
     Integer getChecked();
 }
diff --git a/src/main/java/com/supwisdom/dlpay/system/bean/PersonParamBean.java b/src/main/java/com/supwisdom/dlpay/system/bean/PersonParamBean.java
new file mode 100644
index 0000000..591bb04
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/system/bean/PersonParamBean.java
@@ -0,0 +1,13 @@
+package com.supwisdom.dlpay.system.bean;
+
+public class PersonParamBean extends PageBean {
+    private String name;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/system/controller/UserController.java b/src/main/java/com/supwisdom/dlpay/system/controller/UserController.java
new file mode 100644
index 0000000..087e71c
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/system/controller/UserController.java
@@ -0,0 +1,44 @@
+package com.supwisdom.dlpay.system.controller;
+
+import com.supwisdom.dlpay.api.domain.TPerson;
+import com.supwisdom.dlpay.framework.util.PageResult;
+import com.supwisdom.dlpay.framework.util.WebConstant;
+import com.supwisdom.dlpay.system.bean.PersonParamBean;
+import com.supwisdom.dlpay.system.service.UserDataService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+@Controller
+public class UserController {
+    @Autowired
+    private UserDataService userDataService;
+
+
+    @GetMapping("/user/index")
+    public String sysparaView() {
+        return "system/user/index";
+    }
+    @GetMapping("/user/list")
+    @PreAuthorize("hasPermission('/user/list','')")
+    @ResponseBody
+    public PageResult<TPerson> getDataList(@RequestParam("page") Integer pageNo,
+                                           @RequestParam("limit") Integer pageSize,
+                                           @RequestParam(value = "searchkey", required = false) String searchKey) {
+        try {
+            if (null == pageNo || pageNo < 1) pageNo = WebConstant.PAGENO_DEFAULT;
+            if (null == pageSize || pageSize < 1) pageSize = WebConstant.PAGESIZE_DEFAULT;
+            PersonParamBean searchBean = new PersonParamBean();
+            searchBean.setPageNo(pageNo);
+            searchBean.setName(searchKey);
+            searchBean.setPageSize(pageSize);
+            return userDataService.getPersonsByKey(searchBean);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return new PageResult<>(99, "系统查询错误");
+        }
+    }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/UserDataService.java b/src/main/java/com/supwisdom/dlpay/system/service/UserDataService.java
new file mode 100644
index 0000000..d5a614e
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/system/service/UserDataService.java
@@ -0,0 +1,13 @@
+package com.supwisdom.dlpay.system.service;
+
+import com.supwisdom.dlpay.api.domain.TPerson;
+import com.supwisdom.dlpay.framework.util.PageResult;
+import com.supwisdom.dlpay.system.bean.PersonParamBean;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+
+public interface UserDataService {
+    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true)
+    PageResult<TPerson> getPersonsByKey(PersonParamBean param);
+
+}
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/impl/RoleServiceImpl.java b/src/main/java/com/supwisdom/dlpay/system/service/impl/RoleServiceImpl.java
index ea049e3..c96485c 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/impl/RoleServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/system/service/impl/RoleServiceImpl.java
@@ -154,7 +154,7 @@
             zTreeNode.setId(data.getId());
             zTreeNode.setName(data.getName());
             zTreeNode.setChecked(data.getChecked() == 0 ? false : true);
-            zTreeNode.setOpen(true);
+            zTreeNode.setOpen(data.getOpen() == 0 ? false : true);
             ret.add(zTreeNode);
         }
         return ret;
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/impl/UserDataServiceImpl.java b/src/main/java/com/supwisdom/dlpay/system/service/impl/UserDataServiceImpl.java
new file mode 100644
index 0000000..aab27cf
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/system/service/impl/UserDataServiceImpl.java
@@ -0,0 +1,29 @@
+package com.supwisdom.dlpay.system.service.impl;
+
+import com.supwisdom.dlpay.api.dao.PersonDao;
+import com.supwisdom.dlpay.api.domain.TPerson;
+import com.supwisdom.dlpay.framework.util.PageResult;
+import com.supwisdom.dlpay.framework.util.StringUtil;
+import com.supwisdom.dlpay.system.bean.PersonParamBean;
+import com.supwisdom.dlpay.system.service.UserDataService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Pageable;
+import org.springframework.data.domain.Sort;
+import org.springframework.stereotype.Service;
+
+@Service
+public class UserDataServiceImpl implements UserDataService {
+    @Autowired
+    private PersonDao personDao;
+
+    @Override
+    public PageResult<TPerson> getPersonsByKey(PersonParamBean param) {
+        Pageable pageable = PageRequest.of(param.getPageNo() - 1, param.getPageSize()
+                , Sort.by("id"));
+        if (!StringUtil.isEmpty(param.getName())) {
+            return new PageResult<>(personDao.findAllByNameContaining(param.getName(), pageable));
+        }
+        return new PageResult<>(personDao.findAll(pageable));
+    }
+}
diff --git a/src/main/resources/templates/system/function/subform.html b/src/main/resources/templates/system/function/subform.html
index def716f..479452c 100755
--- a/src/main/resources/templates/system/function/subform.html
+++ b/src/main/resources/templates/system/function/subform.html
@@ -63,7 +63,7 @@
         }

         let parentId = admin.getTempData("parentId");

         if(parentId){

-            form.val('form', {"parentId":parentId});

+            form.val('subform', {"parentId":parentId});

         }

         // 表单提交事件

         form.on('submit(subform-submit)', function (data) {

diff --git a/src/main/resources/templates/system/user/index.html b/src/main/resources/templates/system/user/index.html
new file mode 100644
index 0000000..8035a58
--- /dev/null
+++ b/src/main/resources/templates/system/user/index.html
@@ -0,0 +1,162 @@
+<div class="layui-card">
+    <div class="layui-card-header">
+        <h2 class="header-title">用户管理</h2>
+        <span class="layui-breadcrumb pull-right">
+          <a href="#">用户中心</a>
+          <a><cite>用户管理</cite></a>
+        </span>
+    </div>
+    <div class="layui-card-body">
+        <div class="layui-form toolbar">
+            搜索:
+            <input id="search-value" class="layui-input search-input" type="text" placeholder="输入用户名称"/>&emsp;
+            <button id="btn-search" class="layui-btn icon-btn" data-type="search"><i class="layui-icon">&#xe615;</i>搜索
+            </button>
+            <button id="btn-add" class="layui-btn icon-btn" data-type="add"><i class="layui-icon"></i>添加用户</button>
+        </div>
+        <table class="layui-table" id="usertable" lay-filter="roletable"></table>
+    </div>
+</div>
+<script>
+    layui.use(['form', 'table', 'layer', 'admin', 'element'], function () {
+        let form = layui.form;
+        let table = layui.table;
+        let admin = layui.admin;
+        form.render('select');
+        // 渲染表格
+        table.render({
+            elem: '#usertable',
+            url: '/user/list',
+            page: true,
+            cols: [
+                [
+                    {field: 'name', title: '名称', width: 160,fixed: 'left', sort: true},
+                    {
+                        field: 'sex', title: '性别', sort: true, width: 80, align: 'center', templet: function (item) {
+                            if (item.sex == 'male') {
+                                return '男'
+                            } else if (item.sex == 'female') {
+                                return '女'
+                            } else {
+                                return ''
+                            }
+                        }
+                    },
+                    {field: 'status', align: 'center', title: '状态', fixed: 'right', templet: function (item) {
+                            let html =  '';
+                            if(item.status==='normal'){
+                                html ='正常';
+                            }else if(item.status=='closed'){
+                                html ='注销';
+                            }
+                            return html;
+                        }},
+                    {
+                        field: 'idtype', align: 'center', title: '证件类型', fixed: 'right', templet: function (item) {
+                            if (item.idtype == '1') {
+                                return '身份证'
+                            } else if (item.idtype == '2') {
+                                return '护照'
+                            } else if (item.idtype == '3') {
+                                return '驾照'
+                            } else if (item.idtype == '4') {
+                                return '港澳通行证'
+                            } else if (item.idtype == '5') {
+                                return '学工号'
+                            } else {
+                                return '其他'
+                            }
+                        }
+                    },
+                    {field: 'idno', title: '证件号', width: 160,fixed: 'left', sort: true},
+                    {field: 'country', title: '国籍', width: 160,fixed: 'left', sort: true},
+                    {field: 'nation', title: '民族', width: 160,fixed: 'left', sort: true},
+                    {field: 'email', title: '邮箱', width: 160,fixed: 'left', sort: true},
+                    {field: 'mobile', title: '手机', width: 160,fixed: 'left', sort: true},
+                    {field: 'tel', title: '电话', width: 160,fixed: 'left', sort: true},
+                    {field: 'addr', title: '地址', width: 160,fixed: 'left', sort: true},
+                    {field: 'zipcode', title: '邮编', width: 160,fixed: 'left', sort: true},
+                    {field: 'lastsaved', title: '最后修改时间', width: 160,fixed: 'left', sort: true},
+                    {
+                        field: 'userid', align: 'center', title: '操作', fixed: 'right', templet: function (item) {
+                            let html =  ' <a class="layui-btn  layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a> ';
+                            if(item.editflag===1){
+                                html +='<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>';
+                            }
+                            return html;
+                        }
+                    },
+                ]
+            ]
+        });
+        // 搜索按钮点击事件
+        $('#btn-search').click(function () {
+            let key = $('#search-value').val();
+            table.reload('roletable', {where: {searchkey: key}, page: {curr: 1}});
+        });
+        $('#btn-add').click(function () {
+            showModel();
+        });
+        let showModel = function (data) {
+            let title = data ? '编辑角色' : '添加角色';
+            admin.putTempData('t_func', data);
+            admin.popupCenter({
+                title: title,
+                path: '/role/loadadd',
+                finish: function () {
+                    table.reload('roletable', {});
+                }
+            });
+        };
+        let showFuncModel = function (data) {
+            let title = '分配功能';
+            admin.putTempData('roleId', data.roleId);
+            admin.popupCenter({
+                title: title,
+                path: '/role/loadfunc'
+            });
+        };
+        // 工具条点击事件
+        table.on('tool(roletable)', function (obj) {
+            let data = obj.data;
+            let layEvent = obj.event;
+            console.log(data);
+            if (layEvent === 'edit') {
+                showModel(data);
+            } else if (layEvent === 'addfunc') {
+                showFuncModel(data);
+            } else if (layEvent === 'del') {
+                showDelete(data);
+            }
+        });
+        let showDelete = function (data) {
+            layer.confirm('用户分配的该角色都将被删除,确定删除吗?', function (i) {
+                layer.close(i);
+                layer.load(2);
+                let token = $("meta[name='_csrf_token']").attr("value");
+                admin.go('/role/del', {
+                    roleid: data.roleId,
+                    _csrf: token
+                }, function (data) {
+                    console.log(data.code);
+                    layer.closeAll('loading');
+                    if (data.code == 200) {
+                        layer.msg(data.msg, {icon: 1});
+                    } else if (data.code == 401) {
+                        layer.msg(data.msg, {icon: 2, time: 1500}, function () {
+                            location.replace('/login');
+                        }, 1000);
+                        return;
+                    } else {
+                        layer.msg(data.msg, {icon: 2});
+                    }
+                    table.reload('roletable', {});
+                }, function (ret) {
+                    console.log(ret);
+                    layer.closeAll('loading');
+                    layer.msg('请求失败了,请稍后再试', {icon: 2});
+                });
+            });
+        }
+    });
+</script>
\ No newline at end of file