用户管理
diff --git a/src/main/java/com/supwisdom/dlpay/api/dao/AccountDao.java b/src/main/java/com/supwisdom/dlpay/api/dao/AccountDao.java
index beb4a88..806b049 100644
--- a/src/main/java/com/supwisdom/dlpay/api/dao/AccountDao.java
+++ b/src/main/java/com/supwisdom/dlpay/api/dao/AccountDao.java
@@ -1,6 +1,9 @@
 package com.supwisdom.dlpay.api.dao;
 
 import com.supwisdom.dlpay.api.domain.TAccount;
+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.Lock;
 import org.springframework.data.jpa.repository.Query;
@@ -33,4 +36,6 @@
 
   @Query("select a from TAccount a where a.userid = ?1 and a.subjno=?2")
   TAccount findByUseridAndSubjno(String userid, String subjno);
+
+  Page<TAccount> findAllByAccnameContaining(String accname, Pageable pageable);
 }
diff --git a/src/main/java/com/supwisdom/dlpay/api/domain/TAccount.java b/src/main/java/com/supwisdom/dlpay/api/domain/TAccount.java
index dc98e91..dc97643 100644
--- a/src/main/java/com/supwisdom/dlpay/api/domain/TAccount.java
+++ b/src/main/java/com/supwisdom/dlpay/api/domain/TAccount.java
@@ -69,6 +69,10 @@
   @Column(name = "CLOSEDATE", length = 8)
   private String closedate;
 
+  @OneToOne
+  @JoinColumn(name = "USERID",insertable = false,updatable = false)
+  private TPerson person;
+
   public TAccount() {
   }
 
@@ -277,4 +281,12 @@
     }
     return false;
   }
+
+  public TPerson getPerson() {
+    return person;
+  }
+
+  public void setPerson(TPerson person) {
+    this.person = person;
+  }
 }
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 a8381a1..d1f2d37 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/dao/RoleFunctionDao.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/dao/RoleFunctionDao.java
@@ -18,7 +18,7 @@
 
     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,case when rf.id is null then 1 else 0 end as open from tb_function f " +
+    @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 f.parentid=-1 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,0 as open from tb_resource  r " +
diff --git a/src/main/java/com/supwisdom/dlpay/system/bean/AccountPerson.java b/src/main/java/com/supwisdom/dlpay/system/bean/AccountPerson.java
new file mode 100644
index 0000000..2a870c0
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/system/bean/AccountPerson.java
@@ -0,0 +1,4 @@
+package com.supwisdom.dlpay.system.bean;
+
+public class AccountPerson {
+}
diff --git a/src/main/java/com/supwisdom/dlpay/system/controller/UserController.java b/src/main/java/com/supwisdom/dlpay/system/controller/UserController.java
index 087e71c..718fa53 100644
--- a/src/main/java/com/supwisdom/dlpay/system/controller/UserController.java
+++ b/src/main/java/com/supwisdom/dlpay/system/controller/UserController.java
@@ -1,5 +1,6 @@
 package com.supwisdom.dlpay.system.controller;
 
+import com.supwisdom.dlpay.api.domain.TAccount;
 import com.supwisdom.dlpay.api.domain.TPerson;
 import com.supwisdom.dlpay.framework.util.PageResult;
 import com.supwisdom.dlpay.framework.util.WebConstant;
@@ -17,7 +18,6 @@
     @Autowired
     private UserDataService userDataService;
 
-
     @GetMapping("/user/index")
     public String sysparaView() {
         return "system/user/index";
@@ -41,4 +41,28 @@
             return new PageResult<>(99, "系统查询错误");
         }
     }
+    @GetMapping("/user/acc")
+    public String acc() {
+        return "system/user/account";
+    }
+
+    @GetMapping("/user/account")
+    @PreAuthorize("hasPermission('/user/account','')")
+    @ResponseBody
+    public PageResult<TAccount> getDataAccountList(@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.getAccountsByKey(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
index d5a614e..34748c7 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/UserDataService.java
+++ b/src/main/java/com/supwisdom/dlpay/system/service/UserDataService.java
@@ -1,5 +1,6 @@
 package com.supwisdom.dlpay.system.service;
 
+import com.supwisdom.dlpay.api.domain.TAccount;
 import com.supwisdom.dlpay.api.domain.TPerson;
 import com.supwisdom.dlpay.framework.util.PageResult;
 import com.supwisdom.dlpay.system.bean.PersonParamBean;
@@ -10,4 +11,7 @@
     @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true)
     PageResult<TPerson> getPersonsByKey(PersonParamBean param);
 
+    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true)
+    PageResult<TAccount> getAccountsByKey(PersonParamBean param);
+
 }
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
index aab27cf..315927f 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/impl/UserDataServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/system/service/impl/UserDataServiceImpl.java
@@ -1,6 +1,8 @@
 package com.supwisdom.dlpay.system.service.impl;
 
+import com.supwisdom.dlpay.api.dao.AccountDao;
 import com.supwisdom.dlpay.api.dao.PersonDao;
+import com.supwisdom.dlpay.api.domain.TAccount;
 import com.supwisdom.dlpay.api.domain.TPerson;
 import com.supwisdom.dlpay.framework.util.PageResult;
 import com.supwisdom.dlpay.framework.util.StringUtil;
@@ -16,14 +18,25 @@
 public class UserDataServiceImpl implements UserDataService {
     @Autowired
     private PersonDao personDao;
+    @Autowired
+    private AccountDao accountDao;
 
     @Override
     public PageResult<TPerson> getPersonsByKey(PersonParamBean param) {
         Pageable pageable = PageRequest.of(param.getPageNo() - 1, param.getPageSize()
-                , Sort.by("id"));
+                , Sort.by(Sort.Direction.DESC,"lastsaved"));
         if (!StringUtil.isEmpty(param.getName())) {
             return new PageResult<>(personDao.findAllByNameContaining(param.getName(), pageable));
         }
         return new PageResult<>(personDao.findAll(pageable));
     }
+
+    @Override
+    public PageResult<TAccount> getAccountsByKey(PersonParamBean param) {
+        Pageable pageable = PageRequest.of(param.getPageNo() - 1, param.getPageSize());
+        if (!StringUtil.isEmpty(param.getName())) {
+            return new PageResult<>(accountDao.findAllByAccnameContaining(param.getName(), pageable));
+        }
+        return new PageResult<>(accountDao.findAll(pageable));
+    }
 }
diff --git a/src/main/resources/static/custom/module/index.js b/src/main/resources/static/custom/module/index.js
index 6b49296..992d4d9 100755
--- a/src/main/resources/static/custom/module/index.js
+++ b/src/main/resources/static/custom/module/index.js
@@ -11,7 +11,6 @@
             $('.layui-layout-admin  .layui-nav a[lay-href]').each(function () {
                 var menuName = $(this).text();
                 var menuPath = $(this).attr('lay-href');
-                console.log(menuPath,menuName);
                 if ('javascript:;' != menuPath && '' != menuPath) {
                     var key = menuPath.replace(/[?:=&/]/g, '_');
                     $(this).attr('href', '#!' + key);
diff --git a/src/main/resources/templates/system/role/index.html b/src/main/resources/templates/system/role/index.html
index 5dcd1f7..e2208e0 100644
--- a/src/main/resources/templates/system/role/index.html
+++ b/src/main/resources/templates/system/role/index.html
@@ -22,7 +22,6 @@
         let form = layui.form;
         let table = layui.table;
         let admin = layui.admin;
-
         form.render('select');
 
         // 渲染表格
diff --git a/src/main/resources/templates/system/user/account.html b/src/main/resources/templates/system/user/account.html
new file mode 100644
index 0000000..bd23479
--- /dev/null
+++ b/src/main/resources/templates/system/user/account.html
@@ -0,0 +1,133 @@
+<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>
+        </div>
+        <table class="layui-table" id="accounttable" lay-filter="accounttable"></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: '#accounttable',
+            url: '/user/account',
+            page: true,
+            cols: [
+                [
+                    {field: 'accno', title: '账号',fixed: 'left', width: 100},
+                    {field: 'person', title: '名称', width: 80,fixed: 'left', sort: true, templet: function (item) {
+                            return item.person.name;
+                        }},
+                    {field: 'status', title: '状态',fixed: 'left',width: 80 , templet: function (item) {
+                            if (item.status == 'normal') {
+                                return '正常'
+                            } else if (item.status == 'closed') {
+                                return '注销'
+                            } else if (item.status == 'locked') {
+                                return '锁定'
+                            }  else {
+                                return '异常'
+                            }
+                        }
+                    },
+                    {field: 'availbal', title: '可用余额', width: 100,fixed: 'left', sort: true},
+                    {field: 'balance', title: '总余额', width: 100,fixed: 'left', sort: true},
+                    {field: 'frozebal', title: '冻结余额', width: 100,fixed: 'left', sort: true},
+                    {field: 'lasttransdate', title: '最后交易日期', width: 120,fixed: 'left', sort: true},
+                    {field: 'opendate', title: '开户日期', width: 100,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> ';
+                             html +=  ' <a class="layui-btn  layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></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(accounttable)', 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
diff --git a/src/main/resources/templates/system/user/index.html b/src/main/resources/templates/system/user/index.html
index 8035a58..e2a4921 100644
--- a/src/main/resources/templates/system/user/index.html
+++ b/src/main/resources/templates/system/user/index.html
@@ -14,7 +14,7 @@
             </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>
+        <table class="layui-table" id="usertable" lay-filter="usertable"></table>
     </div>
 </div>
 <script>
@@ -30,29 +30,21 @@
             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: 'name', title: '名称', width: 80,fixed: 'left', sort: true},
+                    {field: 'sex', title: '性别',fixed: 'left', width: 80},
+                    {field: 'status', title: '状态',fixed: 'left',width: 80 , templet: function (item) {
+                            if (item.status == 'normal') {
+                                return '正常'
+                            } else if (item.status == 'closed') {
+                                return '注销'
+                            } else if (item.status == 'locked') {
+                                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) {
+                    {field: 'idtype', align: 'center',width: 100,  title: '证件类型', fixed: 'left', templet: function (item) {
                             if (item.idtype == '1') {
                                 return '身份证'
                             } else if (item.idtype == '2') {
@@ -68,24 +60,23 @@
                             }
                         }
                     },
-                    {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: 'idno', title: '证件号', width: 120,fixed: 'left', sort: true},
+                    {field: 'country', title: '国籍', width: 100,fixed: 'left', sort: true},
+                    {field: 'nation', title: '民族', width: 100,fixed: 'left', sort: true},
+                    {field: 'email', title: '邮箱', width: 100,fixed: 'left', sort: true},
+                    {field: 'mobile', title: '手机', width: 100,fixed: 'left', sort: true},
+                    {field: 'tel', title: '电话', width: 100,fixed: 'left', sort: true},
+                    {field: 'addr', title: '地址', width: 100,fixed: 'left', sort: true},
+                    {field: 'zipcode', title: '邮编', width: 100,fixed: 'left', sort: true},
+                    {field: 'lastsaved', title: '最后修改时间', width: 120,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>';
-                            }
+                            html +=  ' <a class="layui-btn  layui-btn-xs" lay-event="other"><i class="layui-icon layui-icon-edit"></i>绑定关系</a> ';
+                            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;
                         }
-                    },
+                    }
                 ]
             ]
         });
@@ -117,7 +108,7 @@
             });
         };
         // 工具条点击事件
-        table.on('tool(roletable)', function (obj) {
+        table.on('tool(usertable)', function (obj) {
             let data = obj.data;
             let layEvent = obj.event;
             console.log(data);