门店用户

This commit is contained in:
19173159168
2025-07-29 00:25:02 +08:00
parent 826973265e
commit 5c99499084
14 changed files with 629 additions and 33 deletions

View File

@ -11,6 +11,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="password" column="password" />
<result property="phoneNumber" column="phone_number" />
<result property="roleId" column="role_id" />
<result property="isStore" column="is_store" />
<result property="nickName" column="nick_name" />
<result property="wechatOpenid" column="wechat_openid" />
<result property="alipayUserid" column="alipay_userid" />
@ -19,8 +20,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" />
</resultMap>
<resultMap id="ZcBaseUserZcBaseUserStoreResult" type="ZcBaseUser" extends="ZcBaseUserResult">
<collection property="zcBaseUserStoreList" notNullColumn="sub_id" javaType="java.util.List" resultMap="ZcBaseUserStoreResult" />
</resultMap>
<resultMap type="ZcBaseUserStore" id="ZcBaseUserStoreResult">
<result property="id" column="sub_id" />
<result property="userId" column="sub_user_id" />
<result property="operatorId" column="sub_operator_id" />
<result property="storeId" column="sub_store_id" />
<result property="delFlag" column="sub_del_flag" />
<result property="createBy" column="sub_create_by" />
<result property="createTime" column="sub_create_time" />
<result property="updateBy" column="sub_update_by" />
<result property="updateTime" column="sub_update_time" />
</resultMap>
<sql id="selectZcBaseUserVo">
select id, user_name, avatar_url, password, phone_number, role_id, nick_name, wechat_openid, alipay_userid, del_flag, create_time, update_time from zc_base_user
select id, user_name, avatar_url, password, phone_number, role_id, is_store, nick_name, wechat_openid, alipay_userid, del_flag, create_time, update_time from zc_base_user
</sql>
<select id="selectZcBaseUserList" parameterType="ZcBaseUser" resultMap="ZcBaseUserResult">
@ -32,15 +49,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="password != null and password != ''"> and password = #{password}</if>
<if test="phoneNumber != null and phoneNumber != ''"> and phone_number = #{phoneNumber}</if>
<if test="roleId != null "> and role_id = #{roleId}</if>
<if test="isStore != null "> and is_store = #{isStore}</if>
<if test="nickName != null and nickName != ''"> and nick_name like concat('%', #{nickName}, '%')</if>
<if test="wechatOpenid != null and wechatOpenid != ''"> and wechat_openid = #{wechatOpenid}</if>
<if test="alipayUserid != null and alipayUserid != ''"> and alipay_userid = #{alipayUserid}</if>
</where>
</select>
<select id="selectZcBaseUserById" parameterType="Long" resultMap="ZcBaseUserResult">
<include refid="selectZcBaseUserVo"/>
where id = #{id}
<select id="selectZcBaseUserById" parameterType="Long" resultMap="ZcBaseUserZcBaseUserStoreResult">
select a.id, a.user_name, a.avatar_url, a.password, a.phone_number, a.role_id, a.is_store, a.nick_name, a.wechat_openid, a.alipay_userid, a.del_flag, a.create_time, a.update_time,
b.id as sub_id, b.user_id as sub_user_id, b.operator_id as sub_operator_id, b.store_id as sub_store_id
from zc_base_user a
left join zc_base_user_store b on b.user_id = a.id
where a.del_flag = '0' and a.id = #{id}
</select>
<insert id="insertZcBaseUser" parameterType="ZcBaseUser" useGeneratedKeys="true" keyProperty="id">
@ -51,6 +72,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="password != null and password != ''">password,</if>
<if test="phoneNumber != null and phoneNumber != ''">phone_number,</if>
<if test="roleId != null">role_id,</if>
<if test="isStore != null">is_store,</if>
<if test="nickName != null">nick_name,</if>
<if test="wechatOpenid != null">wechat_openid,</if>
<if test="alipayUserid != null">alipay_userid,</if>
@ -64,6 +86,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="password != null and password != ''">#{password},</if>
<if test="phoneNumber != null and phoneNumber != ''">#{phoneNumber},</if>
<if test="roleId != null">#{roleId},</if>
<if test="isStore != null">#{isStore},</if>
<if test="nickName != null">#{nickName},</if>
<if test="wechatOpenid != null">#{wechatOpenid},</if>
<if test="alipayUserid != null">#{alipayUserid},</if>
@ -81,6 +104,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="password != null and password != ''">password = #{password},</if>
<if test="phoneNumber != null and phoneNumber != ''">phone_number = #{phoneNumber},</if>
<if test="roleId != null">role_id = #{roleId},</if>
<if test="isStore != null">is_store = #{isStore},</if>
<if test="nickName != null">nick_name = #{nickName},</if>
<if test="wechatOpenid != null">wechat_openid = #{wechatOpenid},</if>
<if test="alipayUserid != null">alipay_userid = #{alipayUserid},</if>
@ -101,5 +125,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
<delete id="deleteZcBaseUserStoreByUserIds" parameterType="String">
delete from zc_base_user_store where user_id in
<foreach item="userId" collection="array" open="(" separator="," close=")">
#{userId}
</foreach>
</delete>
<delete id="deleteZcBaseUserStoreByUserId" parameterType="Long">
delete from zc_base_user_store where user_id = #{userId}
</delete>
<insert id="batchZcBaseUserStore">
insert into zc_base_user_store( id, user_id, operator_id, store_id, del_flag, create_by, create_time, update_by, update_time) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.id}, #{item.userId}, #{item.operatorId}, #{item.storeId}, #{item.delFlag}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime})
</foreach>
</insert>
</mapper>

View File

@ -6,6 +6,7 @@
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-user-add">
<h4 class="form-header h4">租车用户信息信息</h4>
<div class="form-group">
<label class="col-sm-3 control-label is-required">用户名:</label>
<div class="col-sm-8">
@ -13,6 +14,12 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">头像:</label>
<div class="col-sm-8">
<textarea name="avatarUrl" class="form-control"></textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">密码:</label>
<div class="col-sm-8">
<input name="password" class="form-control" type="text" required>
@ -43,6 +50,22 @@
<input name="alipayUserid" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">删除标志:</label>
<div class="col-sm-8">
<input name="delFlag" class="form-control" type="text">
</div>
</div>
<h4 class="form-header h4">用户与门店信息信息</h4>
<div class="row">
<div class="col-sm-12">
<button type="button" class="btn btn-white btn-sm" onclick="addRow()"><i class="fa fa-plus"> 增加</i></button>
<button type="button" class="btn btn-white btn-sm" onclick="sub.delRow()"><i class="fa fa-minus"> 删除</i></button>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
@ -57,6 +80,116 @@
$.operate.save(prefix + "/add", $('#form-user-add').serialize());
}
}
$(function() {
var options = {
pagination: false,
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
sidePagination: "client",
columns: [{
checkbox: true
},
{
field: 'index',
align: 'center',
title: "序号",
formatter: function (value, row, index) {
var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
return columnIndex + $.table.serialNumber(index);
}
},
{
field: 'operatorId',
align: 'center',
title: '${comment}',
formatter: function(value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='zcBaseUserStoreList[%s].operatorId' value='%s'>", index, value);
return html;
}
},
{
field: 'storeId',
align: 'center',
title: '${comment}',
formatter: function(value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='zcBaseUserStoreList[%s].storeId' value='%s'>", index, value);
return html;
}
},
{
field: 'delFlag',
align: 'center',
title: '删除标志',
formatter: function(value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='zcBaseUserStoreList[%s].delFlag' value='%s'>", index, value);
return html;
}
},
{
field: 'createBy',
align: 'center',
title: '${comment}',
formatter: function(value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='zcBaseUserStoreList[%s].createBy' value='%s'>", index, value);
return html;
}
},
{
field: 'createTime',
align: 'center',
title: '创建时间',
formatter: function(value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='zcBaseUserStoreList[%s].createTime' value='%s'>", index, value);
return html;
}
},
{
field: 'updateBy',
align: 'center',
title: '${comment}',
formatter: function(value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='zcBaseUserStoreList[%s].updateBy' value='%s'>", index, value);
return html;
}
},
{
field: 'updateTime',
align: 'center',
title: '更新时间',
formatter: function(value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='zcBaseUserStoreList[%s].updateTime' value='%s'>", index, value);
return html;
}
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var value = $.common.isNotEmpty(row.index) ? row.index : $.table.serialNumber(index);
return '<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="sub.delRowByIndex(\'' + value + '\')"><i class="fa fa-remove"></i>删除</a>';
}
}]
};
$.table.init(options);
});
function addRow() {
var count = $("#" + table.options.id).bootstrapTable('getData').length;
var row = {
index: $.table.serialNumber(count),
operatorId: "",
storeId: "",
delFlag: "",
createBy: "",
createTime: "",
updateBy: "",
updateTime: "",
}
sub.addRow(row);
}
</script>
</body>
</html>

View File

@ -6,6 +6,7 @@
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-user-edit" th:object="${zcBaseUser}">
<h4 class="form-header h4">租车用户信息信息</h4>
<input name="id" th:field="*{id}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label is-required">用户名:</label>
@ -14,13 +15,7 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">密码:</label>
<div class="col-sm-8">
<input name="password" th:field="*{password}" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<div class="form-group">
<label class="col-sm-3 control-label is-required">手机号:</label>
<div class="col-sm-8">
<input name="phoneNumber" th:field="*{phoneNumber}" class="form-control" type="text" required>
@ -33,6 +28,22 @@
<input name="nickName" th:field="*{nickName}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">门店用户:</label>
<div class="col-sm-8">
<select name="roleId" class="form-control m-b" th:with="type=${@dict.getType('key_yes_no')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{roleId}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">门店用户:</label>
<div class="col-sm-8">
<select name="isStore" class="form-control m-b" th:with="type=${@dict.getType('key_yes_no')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{isStore}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">微信小程序openid</label>
<div class="col-sm-8">
@ -45,6 +56,16 @@
<input name="alipayUserid" th:field="*{alipayUserid}" class="form-control" type="text">
</div>
</div>
<h4 class="form-header h4">用户门店信息</h4>
<div class="row">
<div class="col-sm-12">
<!-- <button type="button" class="btn btn-white btn-sm" onclick="addRow()"><i class="fa fa-plus"> 增加</i></button>-->
<!-- <button type="button" class="btn btn-white btn-sm" onclick="sub.delRow()"><i class="fa fa-minus"> 删除</i></button>-->
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
@ -59,6 +80,85 @@
$.operate.save(prefix + "/edit", $('#form-user-edit').serialize());
}
}
$(function() {
var options = {
data: [[${zcBaseUser.zcBaseUserStoreList}]],
pagination: false,
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
sidePagination: "client",
columns: [{
checkbox: true
},
{
field: 'index',
align: 'center',
title: "序号",
formatter: function (value, row, index) {
var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
return columnIndex + $.table.serialNumber(index);
}
},
{
field: 'storeName',
align: 'center',
title: '关联门店',
formatter: function(value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='zcBaseUserStoreList[%s].storeId' value='%s'>", index, value);
return html;
}
},
{
field: 'operatorName',
align: 'center',
title: '门店所属运营商',
formatter: function(value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='zcBaseUserStoreList[%s].operatorId' value='%s'>", index, value);
return html;
}
},
{
field: 'createTime',
align: 'center',
title: '创建时间',
formatter: function(value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='zcBaseUserStoreList[%s].createTime' value='%s'>", index, value);
return html;
}
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var value = $.common.isNotEmpty(row.index) ? row.index : $.table.serialNumber(index);
return '<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="sub.delRowByIndex(\'' + value + '\')"><i class="fa fa-remove"></i>删除</a>';
}
}]
};
$.table.init(options);
});
function addRow() {
var count = $("#" + table.options.id).bootstrapTable('getData').length;
var row = {
index: $.table.serialNumber(count),
operatorId: "",
storeId: "",
delFlag: "",
createBy: "",
createTime: "",
updateBy: "",
updateTime: "",
}
sub.addRow(row);
}
</script>
</body>
</html>

View File

@ -21,10 +21,19 @@
</li>
<li>
<label>昵称</label>
<input type="text" name="nickName"/>
<label>门店用户</label>
<select name="roleId" th:with="type=${@dict.getType('key_yes_no')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<label>租车用户:</label>
<select name="isStore" th:with="type=${@dict.getType('key_yes_no')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
@ -35,9 +44,9 @@
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<!-- <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="baseUser:user:add">-->
<!-- <i class="fa fa-plus"></i> 添加-->
<!-- </a>-->
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="baseUser:user:add">
<i class="fa fa-plus"></i> 添加
</a>
<!-- <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="baseUser:user:edit">-->
<!-- <i class="fa fa-edit"></i> 修改-->
<!-- </a>-->
@ -57,6 +66,7 @@
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('baseUser:user:edit')}]];
var removeFlag = [[${@permission.hasPermi('baseUser:user:remove')}]];
var yesNoDatas = [[${@dict.getType('key_yes_no')}]];
var prefix = ctx + "baseUser/user";
$(function() {
@ -95,12 +105,26 @@
field: 'alipayUserid',
title: '支付宝小程序'
},
{
field: 'roleId',
title: '租车用户',
formatter: function(value, row, index) {
return $.table.selectDictLabel(yesNoDatas, value);
}
},
{
field: 'isStore',
title: '门店用户',
formatter: function(value, row, index) {
return $.table.selectDictLabel(yesNoDatas, value);
}
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
// actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><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.id + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}

View File

@ -122,7 +122,7 @@
// 检查初始选中项
if(currentRentalType === '1') {
$overdueFeeGroup.hide().find('input').val('');
//$overdueFeeGroup.hide().find('input').val('');
}else if(currentRentalType === '3') {
$rentalDaysGroup.show();
}
@ -140,11 +140,11 @@
currentRentalType = newRentalType;
// 处理逾期金额显示/隐藏
if(newRentalType === '1') {
$overdueFeeGroup.hide().find('input').val('');
} else {
$overdueFeeGroup.show();
}
// if(newRentalType === '1') {
// $overdueFeeGroup.hide().find('input').val('');
// } else {
// $overdueFeeGroup.show();
// }
// 处理租赁天数显示/隐藏
if(newRentalType === '3') {
$rentalDaysGroup.show();

View File

@ -0,0 +1,64 @@
<!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-add">
<input class='form-control' type='text' name='zcBaseUserStoreList[0].operatorId' th:value='${companyStore.operatingCompanyId}'>
<input class='form-control' type='text' name='zcBaseUserStoreList[0].storeId' th:value="${companyStore.id}" >
<div class="form-group">
<label class="col-sm-3 control-label is-required">用户名:</label>
<div class="col-sm-8">
<input name="userName" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">密码:</label>
<div class="col-sm-8">
<input name="password" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">手机号:</label>
<div class="col-sm-8">
<input name="phoneNumber" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">昵称:</label>
<div class="col-sm-8">
<input name="nickName" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">微信小程序openid</label>
<div class="col-sm-8">
<input name="wechatOpenid" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">支付宝小程序userid</label>
<div class="col-sm-8">
<input name="alipayUserid" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "baseUser/user"
$("#form-user-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-user-add').serialize());
}
}
</script>
</body>
</html>

View File

@ -194,6 +194,7 @@
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + ' btnOption" href="javascript:void(0)" onclick="assStoreUser(\'' + row.id + '\')"><i class="fa fa-edit"></i>门店用户</a> ');
actions.push('<a class="btn btn-success btn-xs ' + editFlag + ' btnOption" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + ' btnOption" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
if (row.status == 1) {
@ -221,6 +222,10 @@
$.operate.post(prefix + "/changeStatus", { "id": id, "status": 0 });
})
}
function assStoreUser(id){
$.modal.open("添加门店用户", prefix + "/addStoreUser/" + id);
}
</script>
</body>
</html>