消费者模块

This commit is contained in:
clunt 2022-05-02 16:31:54 +08:00
parent 9fc238b20a
commit 64d87f54bc
5 changed files with 67 additions and 28 deletions

View File

@ -7,10 +7,8 @@ import com.ghy.customer.service.CustomerService;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List; import java.util.List;
@ -44,4 +42,13 @@ public class CustomerController extends BaseController {
return getDataTable(list); return getDataTable(list);
} }
@RequiresPermissions("customer:customer:resetPwd")
@GetMapping("/resetPwd/{customerId}")
public String resetPwd(@PathVariable("customerId") Long customerId, ModelMap mmap)
{
mmap.put("customer", customerService.selectByCustomerId(customerId));
return prefix + "/resetPwd";
}
} }

View File

@ -17,10 +17,10 @@
<div class="select-list"> <div class="select-list">
<ul> <ul>
<li> <li>
登录名称:<input type="text" name="loginName"/> 登录名称:<input type="text" name="name"/>
</li> </li>
<li> <li>
手机号码:<input type="text" name="phonenumber"/> 手机号码:<input type="text" name="phone"/>
</li> </li>
<li> <li>
用户状态:<select name="status" th:with="type=${@dict.getType('sys_normal_disable')}"> 用户状态:<select name="status" th:with="type=${@dict.getType('sys_normal_disable')}">
@ -44,12 +44,6 @@
</div> </div>
<div class="btn-group-sm" id="toolbar" role="group"> <div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.addTab()" shiro:hasPermission="customer:customer:add">
<i class="fa fa-plus"></i> 新增
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.editTab()" shiro:hasPermission="customer:customer:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="customer:customer:remove"> <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="customer:customer:remove">
<i class="fa fa-remove"></i> 删除 <i class="fa fa-remove"></i> 删除
</a> </a>
@ -97,8 +91,6 @@
function queryUserList() { function queryUserList() {
var options = { var options = {
url: prefix + "/list", url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove", removeUrl: prefix + "/remove",
exportUrl: prefix + "/export", exportUrl: prefix + "/export",
importUrl: prefix + "/importData", importUrl: prefix + "/importData",
@ -154,12 +146,8 @@
formatter: function(value, row, index) { formatter: function(value, row, index) {
if (row.customerId != 1) { if (row.customerId != 1) {
var actions = []; var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.customerId + '\')"><i class="fa fa-edit"></i>编辑</a> '); actions.push("<a class='btn btn-success btn-xs " + resetPwdFlag + "' href='javascript:void(0)' onclick='resetPwd(" + row.customerId + ")'><i class='fa fa-edit'></i>重置密码</a> ");
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.customerId + '\')"><i class="fa fa-remove"></i>删除</a> '); actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.customerId + '\')"><i class="fa fa-remove"></i>删除</a> ');
var more = [];
more.push("<a class='btn btn-default btn-xs " + resetPwdFlag + "' href='javascript:void(0)' onclick='resetPwd(" + row.customerId + ")'><i class='fa fa-key'></i>重置密码</a> ");
more.push("<a class='btn btn-default btn-xs " + editFlag + "' href='javascript:void(0)' onclick='authRole(" + row.customerId + ")'><i class='fa fa-check-square-o'></i>分配角色</a>");
actions.push('<a tabindex="0" class="btn btn-info btn-xs" role="button" data-container="body" data-placement="left" data-toggle="popover" data-html="true" data-trigger="hover" data-content="' + more.join('') + '"><i class="fa fa-chevron-circle-right"></i>更多操作</a>');
return actions.join(''); return actions.join('');
} else { } else {
return ""; return "";
@ -172,16 +160,11 @@
/* 用户管理-重置密码 */ /* 用户管理-重置密码 */
function resetPwd(userId) { function resetPwd(customerId) {
var url = prefix + '/resetPwd/' + userId; var url = prefix + '/resetPwd/' + customerId;
$.modal.open("重置密码", url, '800', '300'); $.modal.open("重置密码", url, '800', '300');
} }
/* 用户管理-分配角色 */
function authRole(userId) {
var url = prefix + '/authRole/' + userId;
$.modal.openTab("用户分配角色", url);
}
/* 用户状态显示 */ /* 用户状态显示 */
function statusTools(row) { function statusTools(row) {

View File

@ -0,0 +1,45 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改密码')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-user-resetPwd">
<input name="customerId" type="hidden" th:value="${customer.customerId}" />
<div class="form-group">
<label class="col-sm-3 control-label">登录名称:</label>
<div class="col-sm-8">
<input class="form-control" type="text" readonly="true" name="name" th:value="${customer.name}"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">输入密码:</label>
<div class="col-sm-8">
<input class="form-control" type="password" name="password" id="password" th:value="${@config.getKey('sys.user.initPassword')}">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script type="text/javascript">
$("#form-user-resetPwd").validate({
rules:{
password:{
required:true,
minlength: 5,
maxlength: 20
},
},
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(ctx + "customer/resetPwd", $('#form-user-resetPwd').serialize());
}
}
</script>
</body>
</html>

View File

@ -28,6 +28,9 @@ public class Customer extends BaseEntity {
@Excel(name = "微信open_id", cellType = Excel.ColumnType.STRING) @Excel(name = "微信open_id", cellType = Excel.ColumnType.STRING)
private String openId; private String openId;
@Excel(name = "密码", cellType = Excel.ColumnType.STRING)
private String password;
@Excel(name = "用户状态 0生效 1冻结 2删除", readConverterExp = "0=生效,1=冻结,2=删除") @Excel(name = "用户状态 0生效 1冻结 2删除", readConverterExp = "0=生效,1=冻结,2=删除")
private Integer status; private Integer status;

View File

@ -8,6 +8,7 @@
<result property="account" column="account" /> <result property="account" column="account" />
<result property="phone" column="phone" /> <result property="phone" column="phone" />
<result property="openId" column="open_id" /> <result property="openId" column="open_id" />
<result property="password" column="password" />
<result property="status" column="status" /> <result property="status" column="status" />
<result property="customerLogoUrl" column="customer_logo_url" /> <result property="customerLogoUrl" column="customer_logo_url" />
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by" />
@ -18,7 +19,7 @@
</resultMap> </resultMap>
<sql id="selectCustomer"> <sql id="selectCustomer">
SELECT customer_id, name, account, phone, open_id, status, SELECT customer_id, name, account, phone, open_id, password, status,
customer_logo_url, create_by, create_time, remark customer_logo_url, create_by, create_time, remark
FROM customer FROM customer
</sql> </sql>
@ -42,7 +43,7 @@
<include refid="selectCustomer"/> <include refid="selectCustomer"/>
<where> <where>
<if test="customerId != null and customerId != 0"> <if test="customerId != null and customerId != 0">
AND customer = #{customerId} AND customer_id = #{customerId}
</if> </if>
</where> </where>
</select> </select>