This commit is contained in:
Machengtianjiang 2020-12-17 17:50:57 +08:00
parent f44ff8477f
commit 49c1a18e93
12 changed files with 704 additions and 4 deletions

27
hope-winery/pom.xml Normal file
View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>ruoyi</artifactId>
<groupId>com.ruoyi</groupId>
<version>3.3.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>hope-winery</artifactId>
<description>
葡萄酒模块
</description>
<dependencies>
<!-- 通用工具-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,125 @@
package com.ruoyi.winery.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import java.util.List;
import java.util.Arrays;
import com.ruoyi.common.utils.StringUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.winery.domain.WineryMauser;
import com.ruoyi.winery.service.IWineryMauserService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 小程序用户Controller
*
* @author ruoyi
* @date 2020-12-17
*/
@RequiredArgsConstructor(onConstructor_ = @Autowired)
@RestController
@RequestMapping("/winery/winery_mauser" )
public class WineryMauserController extends BaseController {
private final IWineryMauserService iWineryMauserService;
/**
* 查询小程序用户列表
*/
@PreAuthorize("@ss.hasPermi('winery:winery_mauser:list')")
@GetMapping("/list")
public TableDataInfo list(WineryMauser wineryMauser)
{
startPage();
LambdaQueryWrapper<WineryMauser> lqw = Wrappers.lambdaQuery(wineryMauser);
if (StringUtils.isNotBlank(wineryMauser.getStatus())){
lqw.eq(WineryMauser::getStatus ,wineryMauser.getStatus());
}
if (StringUtils.isNotBlank(wineryMauser.getMobile())){
lqw.eq(WineryMauser::getMobile ,wineryMauser.getMobile());
}
if (StringUtils.isNotBlank(wineryMauser.getNickName())){
lqw.like(WineryMauser::getNickName ,wineryMauser.getNickName());
}
if (StringUtils.isNotBlank(wineryMauser.getUnionId())){
lqw.eq(WineryMauser::getUnionId ,wineryMauser.getUnionId());
}
if (wineryMauser.getCreateTime() != null){
lqw.eq(WineryMauser::getCreateTime ,wineryMauser.getCreateTime());
}
if (StringUtils.isNotBlank(wineryMauser.getTenantId())){
lqw.eq(WineryMauser::getTenantId ,wineryMauser.getTenantId());
}
List<WineryMauser> list = iWineryMauserService.list(lqw);
return getDataTable(list);
}
/**
* 导出小程序用户列表
*/
@PreAuthorize("@ss.hasPermi('winery:winery_mauser:export')" )
@Log(title = "小程序用户" , businessType = BusinessType.EXPORT)
@GetMapping("/export" )
public AjaxResult export(WineryMauser wineryMauser) {
LambdaQueryWrapper<WineryMauser> lqw = new LambdaQueryWrapper<WineryMauser>(wineryMauser);
List<WineryMauser> list = iWineryMauserService.list(lqw);
ExcelUtil<WineryMauser> util = new ExcelUtil<WineryMauser>(WineryMauser. class);
return util.exportExcel(list, "winery_mauser" );
}
/**
* 获取小程序用户详细信息
*/
@PreAuthorize("@ss.hasPermi('winery:winery_mauser:query')" )
@GetMapping(value = "/{openId}" )
public AjaxResult getInfo(@PathVariable("openId" ) String openId) {
return AjaxResult.success(iWineryMauserService.getById(openId));
}
/**
* 新增小程序用户
*/
@PreAuthorize("@ss.hasPermi('winery:winery_mauser:add')" )
@Log(title = "小程序用户" , businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WineryMauser wineryMauser) {
return toAjax(iWineryMauserService.save(wineryMauser) ? 1 : 0);
}
/**
* 修改小程序用户
*/
@PreAuthorize("@ss.hasPermi('winery:winery_mauser:edit')" )
@Log(title = "小程序用户" , businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WineryMauser wineryMauser) {
return toAjax(iWineryMauserService.updateById(wineryMauser) ? 1 : 0);
}
/**
* 删除小程序用户
*/
@PreAuthorize("@ss.hasPermi('winery:winery_mauser:remove')" )
@Log(title = "小程序用户" , businessType = BusinessType.DELETE)
@DeleteMapping("/{openIds}" )
public AjaxResult remove(@PathVariable String[] openIds) {
return toAjax(iWineryMauserService.removeByIds(Arrays.asList(openIds)) ? 1 : 0);
}
}

View File

@ -0,0 +1,67 @@
package com.ruoyi.winery.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import com.ruoyi.common.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import java.io.Serializable;
import java.util.Date;
import java.math.BigDecimal;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 小程序用户对象 winery_mauser
*
* @author ruoyi
* @date 2020-12-17
*/
@Data
@ToString
@EqualsAndHashCode
@NoArgsConstructor
@Accessors(chain = true)
@TableName("winery_mauser")
public class WineryMauser implements Serializable {
private static final long serialVersionUID=1L;
/** 小程序userid */
@Excel(name = "小程序userid")
@TableId(value = "open_id")
private String openId;
/** 状态 */
@Excel(name = "状态")
private String status;
/** 手机号 */
@Excel(name = "手机号")
private String mobile;
/** 昵称 */
@Excel(name = "昵称")
private String nickName;
/** unionid */
@Excel(name = "unionid")
private String unionId;
/** 创建时间 */
@Excel(name = "创建时间" , width = 30, dateFormat = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/** 更新时间 */
private Date updateTime;
/** 租户id */
@Excel(name = "租户id")
private String tenantId;
}

View File

@ -0,0 +1,14 @@
package com.ruoyi.winery.mapper;
import com.ruoyi.winery.domain.WineryMauser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 小程序用户Mapper接口
*
* @author ruoyi
* @date 2020-12-17
*/
public interface WineryMauserMapper extends BaseMapper<WineryMauser> {
}

View File

@ -0,0 +1,14 @@
package com.ruoyi.winery.service;
import com.ruoyi.winery.domain.WineryMauser;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* 小程序用户Service接口
*
* @author ruoyi
* @date 2020-12-17
*/
public interface IWineryMauserService extends IService<WineryMauser> {
}

View File

@ -0,0 +1,18 @@
package com.ruoyi.winery.service.impl;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.winery.mapper.WineryMauserMapper;
import com.ruoyi.winery.domain.WineryMauser;
import com.ruoyi.winery.service.IWineryMauserService;
/**
* 小程序用户Service业务层处理
*
* @author ruoyi
* @date 2020-12-17
*/
@Service
public class WineryMauserServiceImpl extends ServiceImpl<WineryMauserMapper, WineryMauser> implements IWineryMauserService {
}

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.winery.mapper.WineryMauserMapper">
<resultMap type="WineryMauser" id="WineryMauserResult">
<result property="openId" column="open_id" />
<result property="status" column="status" />
<result property="mobile" column="mobile" />
<result property="nickName" column="nick_name" />
<result property="unionId" column="union_id" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="tenantId" column="tenant_id" />
</resultMap>
</mapper>

10
pom.xml
View File

@ -14,6 +14,7 @@
<properties>
<ruoyi.version>3.3.0</ruoyi.version>
<winery.version>1.0.0</winery.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
@ -218,6 +219,14 @@
<version>${ruoyi.version}</version>
</dependency>
<!-- 葡萄酒庄-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>hope-winery</artifactId>
<version>${ruoyi.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
@ -228,6 +237,7 @@
<module>ruoyi-quartz</module>
<module>ruoyi-generator</module>
<module>ruoyi-common</module>
<module>hope-winery</module>
</modules>
<packaging>pom</packaging>

View File

@ -73,6 +73,12 @@
<artifactId>ruoyi-generator</artifactId>
</dependency>
<!-- 酒庄-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>hope-winery</artifactId>
</dependency>
</dependencies>
<build>

View File

@ -6,9 +6,9 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:mysql://192.168.0.222:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true
url: jdbc:mysql://175.24.17.162:3306/ruoyi?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true
username: root
password: root
password: 26616494
# 从库数据源
slave:
# 从数据源开关/默认关闭
@ -58,11 +58,11 @@ spring:
# redis 配置
redis:
# 地址
host: 192.168.0.222
host: 175.24.17.162
# 端口默认为6379
port: 6379
# 密码
password:
password: 26616494
# 连接超时时间
timeout: 10s
lettuce:

View File

@ -0,0 +1,53 @@
import request from '@/utils/request'
// 查询小程序用户列表
export function listWinery_mauser(query) {
return request({
url: '/winery/winery_mauser/list',
method: 'get',
params: query
})
}
// 查询小程序用户详细
export function getWinery_mauser(openId) {
return request({
url: '/winery/winery_mauser/' + openId,
method: 'get'
})
}
// 新增小程序用户
export function addWinery_mauser(data) {
return request({
url: '/winery/winery_mauser',
method: 'post',
data: data
})
}
// 修改小程序用户
export function updateWinery_mauser(data) {
return request({
url: '/winery/winery_mauser',
method: 'put',
data: data
})
}
// 删除小程序用户
export function delWinery_mauser(openId) {
return request({
url: '/winery/winery_mauser/' + openId,
method: 'delete'
})
}
// 导出小程序用户
export function exportWinery_mauser(query) {
return request({
url: '/winery/winery_mauser/export',
method: 'get',
params: query
})
}

View File

@ -0,0 +1,347 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small">
<el-option
v-for="dict in statusOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item label="手机号" prop="mobile">
<el-input
v-model="queryParams.mobile"
placeholder="请输入手机号"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="昵称" prop="nickName">
<el-input
v-model="queryParams.nickName"
placeholder="请输入昵称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="unionid" prop="unionId">
<el-input
v-model="queryParams.unionId"
placeholder="请输入unionid"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="创建时间" prop="createTime">
<el-date-picker clearable size="small" style="width: 200px"
v-model="queryParams.createTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择创建时间">
</el-date-picker>
</el-form-item>
<el-form-item label="租户id" prop="tenantId">
<el-input
v-model="queryParams.tenantId"
placeholder="请输入租户id"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="cyan" 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"
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['winery:winery_mauser:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['winery:winery_mauser:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['winery:winery_mauser:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['winery:winery_mauser:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="winery_mauserList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="小程序userid" align="center" prop="openId" v-if="true"/>
<el-table-column label="状态" align="center" prop="status" :formatter="statusFormat" />
<el-table-column label="手机号" align="center" prop="mobile" />
<el-table-column label="昵称" align="center" prop="nickName" />
<el-table-column label="unionid" align="center" prop="unionId" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="租户id" align="center" prop="tenantId" />
<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="['winery:winery_mauser:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['winery:winery_mauser: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="状态">
<el-radio-group v-model="form.status">
<el-radio
v-for="dict in statusOptions"
:key="dict.dictValue"
:label="dict.dictValue"
>{{dict.dictLabel}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="手机号" prop="mobile">
<el-input v-model="form.mobile" placeholder="请输入手机号" />
</el-form-item>
<el-form-item label="昵称" prop="nickName">
<el-input v-model="form.nickName" placeholder="请输入昵称" />
</el-form-item>
<el-form-item label="unionid" prop="unionId">
<el-input v-model="form.unionId" placeholder="请输入unionid" :disabled="true" />
</el-form-item>
<el-form-item label="租户id" prop="tenantId">
<el-input v-model="form.tenantId" placeholder="请输入租户id" />
</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 { listWinery_mauser, getWinery_mauser, delWinery_mauser, addWinery_mauser, updateWinery_mauser, exportWinery_mauser } from "@/api/winery/winery_mauser";
export default {
name: "Winery_mauser",
components: {
},
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
winery_mauserList: [],
//
title: "",
//
open: false,
//
statusOptions: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
status: undefined,
mobile: undefined,
nickName: undefined,
unionId: undefined,
createTime: undefined,
tenantId: undefined
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
this.getDicts("sys_normal_disable").then(response => {
this.statusOptions = response.data;
});
},
methods: {
/** 查询小程序用户列表 */
getList() {
this.loading = true;
listWinery_mauser(this.queryParams).then(response => {
this.winery_mauserList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
statusFormat(row, column) {
return this.selectDictLabel(this.statusOptions, row.status);
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
openId: undefined,
status: "0",
mobile: undefined,
nickName: undefined,
unionId: undefined,
createTime: undefined,
updateTime: undefined,
tenantId: undefined
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.openId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加小程序用户";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const openId = row.openId || this.ids
getWinery_mauser(openId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改小程序用户";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.openId != null) {
updateWinery_mauser(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addWinery_mauser(this.form).then(response => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const openIds = row.openId || this.ids;
this.$confirm('是否确认删除小程序用户编号为"' + openIds + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delWinery_mauser(openIds);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
})
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有小程序用户数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return exportWinery_mauser(queryParams);
}).then(response => {
this.download(response.msg);
})
}
}
};
</script>