消费者模块首页
This commit is contained in:
parent
bb5612143d
commit
9fc238b20a
|
|
@ -85,6 +85,12 @@
|
||||||
<artifactId>ghy-payment</artifactId>
|
<artifactId>ghy-payment</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 财务模块 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ghy</groupId>
|
||||||
|
<artifactId>ghy-custom</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,47 @@
|
||||||
|
package com.ghy.web.controller.customer;
|
||||||
|
|
||||||
|
import com.ghy.common.core.controller.BaseController;
|
||||||
|
import com.ghy.common.core.page.TableDataInfo;
|
||||||
|
import com.ghy.customer.domain.Customer;
|
||||||
|
import com.ghy.customer.service.CustomerService;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author clunt
|
||||||
|
* 消费者Controller
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/customer")
|
||||||
|
public class CustomerController extends BaseController {
|
||||||
|
|
||||||
|
private String prefix = "customer";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CustomerService customerService;
|
||||||
|
|
||||||
|
@RequiresPermissions("customer:customer:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String customer()
|
||||||
|
{
|
||||||
|
return prefix + "/customer";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("customer:customer:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(Customer customer)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<Customer> list = customerService.getCustomerList(customer);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,225 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
|
||||||
|
<head>
|
||||||
|
<th:block th:include="include :: header('消费者列表')" />
|
||||||
|
<th:block th:include="include :: layout-latest-css" />
|
||||||
|
<th:block th:include="include :: ztree-css" />
|
||||||
|
</head>
|
||||||
|
<body class="gray-bg">
|
||||||
|
|
||||||
|
<div class="ui-layout-center">
|
||||||
|
<div class="container-div">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-12 search-collapse">
|
||||||
|
<form id="user-form">
|
||||||
|
<input type="hidden" id="deptId" name="deptId">
|
||||||
|
<input type="hidden" id="parentId" name="parentId">
|
||||||
|
<div class="select-list">
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
登录名称:<input type="text" name="loginName"/>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
手机号码:<input type="text" name="phonenumber"/>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
用户状态:<select name="status" th:with="type=${@dict.getType('sys_normal_disable')}">
|
||||||
|
<option value="">所有</option>
|
||||||
|
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
||||||
|
</select>
|
||||||
|
</li>
|
||||||
|
<li class="select-time">
|
||||||
|
<label>创建时间: </label>
|
||||||
|
<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginTime]"/>
|
||||||
|
<span>-</span>
|
||||||
|
<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]"/>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a>
|
||||||
|
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i> 重置</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<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">
|
||||||
|
<i class="fa fa-remove"></i> 删除
|
||||||
|
</a>
|
||||||
|
<a class="btn btn-info" onclick="$.table.importExcel()" shiro:hasPermission="customer:customer:import">
|
||||||
|
<i class="fa fa-upload"></i> 导入
|
||||||
|
</a>
|
||||||
|
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="customer:customer:export">
|
||||||
|
<i class="fa fa-download"></i> 导出
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-sm-12 select-table table-striped">
|
||||||
|
<table id="bootstrap-table"></table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<th:block th:include="include :: footer" />
|
||||||
|
<th:block th:include="include :: layout-latest-js" />
|
||||||
|
<th:block th:include="include :: ztree-js" />
|
||||||
|
<script th:inline="javascript">
|
||||||
|
var editFlag = [[${@permission.hasPermi('customer:customer:edit')}]];
|
||||||
|
var removeFlag = [[${@permission.hasPermi('customer:customer:remove')}]];
|
||||||
|
var resetPwdFlag = [[${@permission.hasPermi('customer:customer:resetPwd')}]];
|
||||||
|
var prefix = ctx + "customer";
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
var panehHidden = false;
|
||||||
|
if ($(this).width() < 769) {
|
||||||
|
panehHidden = true;
|
||||||
|
}
|
||||||
|
$('body').layout({ initClosed: panehHidden, west__size: 185 });
|
||||||
|
// 回到顶部绑定
|
||||||
|
if ($.fn.toTop !== undefined) {
|
||||||
|
var opt = {
|
||||||
|
win:$('.ui-layout-center'),
|
||||||
|
doc:$('.ui-layout-center')
|
||||||
|
};
|
||||||
|
$('#scroll-up').toTop(opt);
|
||||||
|
}
|
||||||
|
queryUserList();
|
||||||
|
});
|
||||||
|
|
||||||
|
function queryUserList() {
|
||||||
|
var options = {
|
||||||
|
url: prefix + "/list",
|
||||||
|
createUrl: prefix + "/add",
|
||||||
|
updateUrl: prefix + "/edit/{id}",
|
||||||
|
removeUrl: prefix + "/remove",
|
||||||
|
exportUrl: prefix + "/export",
|
||||||
|
importUrl: prefix + "/importData",
|
||||||
|
importTemplateUrl: prefix + "/importTemplate",
|
||||||
|
sortName: "createTime",
|
||||||
|
sortOrder: "desc",
|
||||||
|
modalName: "消费者",
|
||||||
|
columns: [{
|
||||||
|
checkbox: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'customerId',
|
||||||
|
title: '消费者ID'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'name',
|
||||||
|
title: '昵称',
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'account',
|
||||||
|
title: '账户'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'phone',
|
||||||
|
title: '手机号'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'openId',
|
||||||
|
title: '微信唯一id',
|
||||||
|
visible: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'customerLogoUrl',
|
||||||
|
title: '头像'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
visible: editFlag == 'hidden' ? false : true,
|
||||||
|
title: '消费者状态',
|
||||||
|
align: 'center',
|
||||||
|
formatter: function (value, row, index) {
|
||||||
|
return statusTools(row);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'createTime',
|
||||||
|
title: '创建时间',
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
align: 'center',
|
||||||
|
formatter: function(value, row, index) {
|
||||||
|
if (row.customerId != 1) {
|
||||||
|
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-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('');
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
$.table.init(options);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* 用户管理-重置密码 */
|
||||||
|
function resetPwd(userId) {
|
||||||
|
var url = prefix + '/resetPwd/' + userId;
|
||||||
|
$.modal.open("重置密码", url, '800', '300');
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 用户管理-分配角色 */
|
||||||
|
function authRole(userId) {
|
||||||
|
var url = prefix + '/authRole/' + userId;
|
||||||
|
$.modal.openTab("用户分配角色", url);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 用户状态显示 */
|
||||||
|
function statusTools(row) {
|
||||||
|
if (row.status == 0) {
|
||||||
|
return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="enable(\'' + row.customerId + '\')"></i> ';
|
||||||
|
} else {
|
||||||
|
return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="disable(\'' + row.customerId + '\')"></i> ';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 用户管理-停用 */
|
||||||
|
function disable(userId) {
|
||||||
|
$.modal.confirm("确认要停用用户吗?", function() {
|
||||||
|
$.operate.post(prefix + "/changeStatus", { "userId": userId, "status": 1 });
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 用户管理启用 */
|
||||||
|
function enable(userId) {
|
||||||
|
$.modal.confirm("确认要启用用户吗?", function() {
|
||||||
|
$.operate.post(prefix + "/changeStatus", { "userId": userId, "status": 0 });
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
<!-- 导入区域 -->
|
||||||
|
<script id="importTpl" type="text/template">
|
||||||
|
<form enctype="multipart/form-data" class="mt20 mb10">
|
||||||
|
<div class="col-xs-offset-1">
|
||||||
|
<input type="file" id="file" name="file"/>
|
||||||
|
<div class="mt10 pt5">
|
||||||
|
<input type="checkbox" id="updateSupport" name="updateSupport" title="如果登录账户已经存在,更新这条数据。"> 是否更新已经存在的用户数据
|
||||||
|
<a onclick="$.table.importTemplate()" class="btn btn-default btn-xs"><i class="fa fa-file-excel-o"></i> 下载模板</a>
|
||||||
|
</div>
|
||||||
|
<font color="red" class="pull-left mt10">
|
||||||
|
提示:仅允许导入“xls”或“xlsx”格式文件!
|
||||||
|
</font>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</script>
|
||||||
|
</html>
|
||||||
|
|
@ -2,12 +2,20 @@ package com.ghy.customer.mapper;
|
||||||
|
|
||||||
import com.ghy.customer.domain.Customer;
|
import com.ghy.customer.domain.Customer;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author clunt
|
* @author clunt
|
||||||
* 消费者Mapper
|
* 消费者Mapper
|
||||||
*/
|
*/
|
||||||
public interface CustomerMapper {
|
public interface CustomerMapper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param customer 消费者筛选条件
|
||||||
|
* @return 符合结果消费者
|
||||||
|
*/
|
||||||
|
List<Customer> getCustomerList(Customer customer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param customerId 消费者id
|
* @param customerId 消费者id
|
||||||
* @return 消费者信息
|
* @return 消费者信息
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,20 @@ package com.ghy.customer.service;
|
||||||
|
|
||||||
import com.ghy.customer.domain.Customer;
|
import com.ghy.customer.domain.Customer;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author clunt
|
* @author clunt
|
||||||
* 消费者service层
|
* 消费者service层
|
||||||
*/
|
*/
|
||||||
public interface CustomerService {
|
public interface CustomerService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param customer 消费者筛选条件
|
||||||
|
* @return 消费者列表
|
||||||
|
*/
|
||||||
|
List<Customer> getCustomerList(Customer customer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param customerId 消费者id
|
* @param customerId 消费者id
|
||||||
* @return 消费者信息
|
* @return 消费者信息
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,11 @@ import com.ghy.common.exception.ServiceException;
|
||||||
import com.ghy.customer.domain.Customer;
|
import com.ghy.customer.domain.Customer;
|
||||||
import com.ghy.customer.mapper.CustomerMapper;
|
import com.ghy.customer.mapper.CustomerMapper;
|
||||||
import com.ghy.customer.service.CustomerService;
|
import com.ghy.customer.service.CustomerService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author clunt
|
* @author clunt
|
||||||
|
|
@ -16,7 +18,7 @@ import javax.annotation.Resource;
|
||||||
@Service
|
@Service
|
||||||
public class CustomerServiceImpl implements CustomerService {
|
public class CustomerServiceImpl implements CustomerService {
|
||||||
|
|
||||||
@Resource
|
@Autowired
|
||||||
private CustomerMapper customerMapper;
|
private CustomerMapper customerMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -24,6 +26,11 @@ public class CustomerServiceImpl implements CustomerService {
|
||||||
return customerMapper.selectByCustomerId(customerId);
|
return customerMapper.selectByCustomerId(customerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Customer> getCustomerList(Customer customer) {
|
||||||
|
return customerMapper.getCustomerList(customer);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int deleteByIds(String ids) {
|
public int deleteByIds(String ids) {
|
||||||
Long [] customerIds = Convert.toLongArray(ids);
|
Long [] customerIds = Convert.toLongArray(ids);
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.ghy.customer.mapper.CustomerMapper">
|
<mapper namespace="com.ghy.customer.mapper.CustomerMapper">
|
||||||
|
|
||||||
<resultMap id="GoodsImgsResult" type="com.ghy.customer.domain.Customer">
|
<resultMap id="CustomerResult" type="com.ghy.customer.domain.Customer">
|
||||||
<result property="customerId" column="customer_id" />
|
<result property="customerId" column="customer_id" />
|
||||||
<result property="name" column="name" />
|
<result property="name" column="name" />
|
||||||
<result property="account" column="account" />
|
<result property="account" column="account" />
|
||||||
|
|
@ -22,6 +22,10 @@
|
||||||
customer_logo_url, create_by, create_time, remark
|
customer_logo_url, create_by, create_time, remark
|
||||||
FROM customer
|
FROM customer
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
<select id="getCustomerList" resultMap="CustomerResult">
|
||||||
|
<include refid="selectCustomer" />
|
||||||
|
</select>
|
||||||
|
|
||||||
<delete id="deleteByIds">
|
<delete id="deleteByIds">
|
||||||
DELETE FROM customer WHERE customer_id IN
|
DELETE FROM customer WHERE customer_id IN
|
||||||
Loading…
Reference in New Issue