update 站点白名单

This commit is contained in:
2023-04-20 15:04:46 +08:00
parent 5ec5577a30
commit 582640e5a0
6 changed files with 459 additions and 12 deletions

View File

@@ -0,0 +1,105 @@
package com.jsowell.web.controller.pile;
import com.jsowell.common.annotation.Log;
import com.jsowell.common.core.controller.BaseController;
import com.jsowell.common.core.domain.AjaxResult;
import com.jsowell.common.core.page.TableDataInfo;
import com.jsowell.common.enums.BusinessType;
import com.jsowell.common.util.poi.ExcelUtil;
import com.jsowell.pile.domain.PileStationWhitelist;
import com.jsowell.pile.service.IPileStationWhitelistService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 站点白名单Controller
*
* @author jsowell
* @date 2023-04-20
*/
@RestController
@RequestMapping("/pile/whitelist")
public class PileStationWhitelistController extends BaseController
{
@Autowired
private IPileStationWhitelistService pileStationWhitelistService;
/**
* 查询站点白名单列表
*/
@PreAuthorize("@ss.hasPermi('pile:whitelist:list')")
@GetMapping("/list")
public TableDataInfo list(PileStationWhitelist pileStationWhitelist)
{
startPage();
List<PileStationWhitelist> list = pileStationWhitelistService.selectPileStationWhitelistList(pileStationWhitelist);
return getDataTable(list);
}
/**
* 导出站点白名单列表
*/
@PreAuthorize("@ss.hasPermi('pile:whitelist:export')")
@Log(title = "站点白名单", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, PileStationWhitelist pileStationWhitelist)
{
List<PileStationWhitelist> list = pileStationWhitelistService.selectPileStationWhitelistList(pileStationWhitelist);
ExcelUtil<PileStationWhitelist> util = new ExcelUtil<PileStationWhitelist>(PileStationWhitelist.class);
util.exportExcel(response, list, "站点白名单数据");
}
/**
* 获取站点白名单详细信息
*/
@PreAuthorize("@ss.hasPermi('pile:whitelist:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(pileStationWhitelistService.selectPileStationWhitelistById(id));
}
/**
* 新增站点白名单
*/
@PreAuthorize("@ss.hasPermi('pile:whitelist:add')")
@Log(title = "站点白名单", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody PileStationWhitelist pileStationWhitelist)
{
return toAjax(pileStationWhitelistService.insertPileStationWhitelist(pileStationWhitelist));
}
/**
* 修改站点白名单
*/
@PreAuthorize("@ss.hasPermi('pile:whitelist:edit')")
@Log(title = "站点白名单", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody PileStationWhitelist pileStationWhitelist)
{
return toAjax(pileStationWhitelistService.updatePileStationWhitelist(pileStationWhitelist));
}
/**
* 删除站点白名单
*/
@PreAuthorize("@ss.hasPermi('pile:whitelist:remove')")
@Log(title = "站点白名单", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(pileStationWhitelistService.deletePileStationWhitelistByIds(ids));
}
}

View File

@@ -31,6 +31,12 @@ public class PileStationWhitelist extends BaseEntity {
@Excel(name = "会员id")
private String memberId;
/**
* 手机号
*/
@Excel(name = "手机号")
private String mobileNumber;
/**
* 删除标识0-正常1-删除)
*/
@@ -60,6 +66,14 @@ public class PileStationWhitelist extends BaseEntity {
return memberId;
}
public String getMobileNumber() {
return mobileNumber;
}
public void setMobileNumber(String mobileNumber) {
this.mobileNumber = mobileNumber;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}

View File

@@ -8,6 +8,7 @@
<result property="id" column="id" />
<result property="stationId" column="station_id" />
<result property="memberId" column="member_id" />
<result property="mobileNumber" column="mobile_number" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
@@ -16,7 +17,7 @@
</resultMap>
<sql id="Base_Column_List">
id, station_id, member_id, create_time, create_by, update_time, update_by, del_flag
id, station_id, member_id, mobile_number, create_time, create_by, update_time, update_by, del_flag
</sql>
<sql id="selectPileStationWhitelistVo">
@@ -30,6 +31,7 @@
<where>
<if test="stationId != null and stationId != ''"> and station_id = #{stationId}</if>
<if test="memberId != null and memberId != ''"> and member_id = #{memberId}</if>
<if test="mobileNumber != null and mobileNumber != ''"> and mobile_number = #{mobileNumber}</if>
</where>
</select>
@@ -44,6 +46,7 @@
<if test="id != null">id,</if>
<if test="stationId != null">station_id,</if>
<if test="memberId != null">member_id,</if>
<if test="mobileNumber != null">mobile_number,</if>
<if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateTime != null">update_time,</if>
@@ -54,6 +57,7 @@
<if test="id != null">#{id},</if>
<if test="stationId != null">#{stationId},</if>
<if test="memberId != null">#{memberId},</if>
<if test="mobileNumber != null">#{mobileNumber},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
@@ -67,6 +71,7 @@
<trim prefix="SET" suffixOverrides=",">
<if test="stationId != null">station_id = #{stationId},</if>
<if test="memberId != null">member_id = #{memberId},</if>
<if test="mobileNumber != null">mobile_number = #{mobileNumber},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>

View File

@@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询站点白名单列表
export function listWhitelist(query) {
return request({
url: '/pile/whitelist/list',
method: 'get',
params: query
})
}
// 查询站点白名单详细
export function getWhitelist(id) {
return request({
url: '/pile/whitelist/' + id,
method: 'get'
})
}
// 新增站点白名单
export function addWhitelist(data) {
return request({
url: '/pile/whitelist',
method: 'post',
data: data
})
}
// 修改站点白名单
export function updateWhitelist(data) {
return request({
url: '/pile/whitelist',
method: 'put',
data: data
})
}
// 删除站点白名单
export function delWhitelist(id) {
return request({
url: '/pile/whitelist/' + id,
method: 'delete'
})
}

View File

@@ -44,22 +44,24 @@
<el-button icon="el-icon-setting" size="big" @click="handleCreate" v-has-permi = "['pile:station:edit']">配置参数</el-button>
</el-form-item>
</el-form>
</el-tab-pane>
<el-dialog :title="dialogTitle" :visible.sync="dialogFormVisible">
<el-tab-pane label="站点白名单" name="whitelist">
<whitelist ref="whitelist" :stationId="stationId"/>
</el-tab-pane>
</el-tabs>
<el-dialog :title="dialogTitle" :visible.sync="dialogFormVisible">
<el-form ref="form" :model="form" @submit.native.prevent>
<el-form-item label="二维码前缀:" prop="prefix" label-width="100px">
<el-input v-model="form.prefix" placeholder="请输入二维码前缀" style="width: 300px"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer" align="center">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</el-tabs>
<div slot="footer" class="dialog-footer" align="center">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
@@ -70,16 +72,20 @@ import connectorList from "./connectorList.vue";
import pileList from "./pileList.vue";
import MapContainer from "../../../components/MapContainer/MapContainer.vue";
import stationOrderList from "@/views/pile/station/stationOrderList";
import {updatePlateNumber} from "@/api/member/info";
import stationWhiteList from "@/views/pile/station/stationWhiteList";
import {getStationInfo, updateStationQRCodePrefix} from "@/api/pile/station";
import Whitelist from "@/views/pile/station/stationWhiteList";
export default {
components: {
Whitelist,
SiteInfo,
pileList,
connectorList,
Billing,
MapContainer,
stationOrderList
stationOrderList,
stationWhiteList
},
data() {
return {

View File

@@ -0,0 +1,273 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="手机号" prop="mobileNumber">
<el-input
v-model="queryParams.mobileNumber"
placeholder="请输入手机号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="会员id" prop="memberId">
<el-input
v-model="queryParams.memberId"
placeholder="请输入会员id"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['pile:whitelist:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['pile:whitelist:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['pile:whitelist:remove']"
>删除</el-button>
</el-col>
<!--<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['pile:whitelist:export']"
>导出</el-button>
</el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="whitelistList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<!--<el-table-column label="主键" align="center" prop="id" />-->
<el-table-column label="站点id" align="center" prop="stationId" />
<el-table-column label="会员id" align="center" prop="memberId" />
<el-table-column label="手机号" align="center" prop="mobileNumber" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['pile:whitelist:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['pile:whitelist:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改站点白名单对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<!--<el-form-item label="站点id" prop="stationId">
<el-input v-model="form.stationId" placeholder="请输入站点id" />
</el-form-item>-->
<el-form-item label="会员id" prop="memberId">
<el-input v-model="form.memberId" placeholder="请输入会员id" />
</el-form-item>
<el-form-item label="手机号" prop="mobileNumber">
<el-input v-model="form.mobileNumber" placeholder="请输入手机号" />
</el-form-item>
<!--<el-form-item label="删除标识" prop="delFlag">
<el-input v-model="form.delFlag" placeholder="请输入删除标识" />
</el-form-item>-->
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listWhitelist, getWhitelist, delWhitelist, addWhitelist, updateWhitelist } from "@/api/pile/whitelist";
export default {
name: "Whitelist",
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 站点白名单表格数据
whitelistList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
stationId: null,
memberId: null,
mobileNumber: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询站点白名单列表 */
getList() {
this.loading = true;
listWhitelist(this.queryParams).then(response => {
this.whitelistList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
stationId: null,
memberId: null,
mobileNumber: null,
createTime: null,
createBy: null,
updateTime: null,
updateBy: null,
delFlag: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加站点白名单";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getWhitelist(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改站点白名单";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateWhitelist(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addWhitelist(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除站点白名单编号为"' + ids + '"的数据项?').then(function() {
return delWhitelist(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('pile/whitelist/export', {
...this.queryParams
}, `whitelist_${new Date().getTime()}.xlsx`)
}
}
};
</script>