新增会员用户积分流水模块

master
elliott 2 years ago
parent 6e9cc61233
commit 9759a296ee

@ -0,0 +1,123 @@
package com.flossom.common.core.domain.entity;
import com.flossom.common.core.annotation.Excel;
import com.flossom.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* wx_user_integral_log
*
* @author flossom
* @date 2023-12-14
*/
public class WxUserIntegralLog extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 用户昵称 */
@Excel(name = "用户昵称")
private String userName;
/** 用户手机号码 */
@Excel(name = "用户手机号码")
private String userPhone;
/** 1-增加 2-减少 */
@Excel(name = "1-增加 2-减少")
private String source;
/** 浮动分数 */
@Excel(name = "浮动分数")
private Long floatScore;
/** 来源ID */
@Excel(name = "来源ID")
private Long soureId;
/** 说明 */
@Excel(name = "说明")
private String remarkContent;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setUserName(String userName)
{
this.userName = userName;
}
public String getUserName()
{
return userName;
}
public void setUserPhone(String userPhone)
{
this.userPhone = userPhone;
}
public String getUserPhone()
{
return userPhone;
}
public void setSource(String source)
{
this.source = source;
}
public String getSource()
{
return source;
}
public void setFloatScore(Long floatScore)
{
this.floatScore = floatScore;
}
public Long getFloatScore()
{
return floatScore;
}
public void setSoureId(Long soureId)
{
this.soureId = soureId;
}
public Long getSoureId()
{
return soureId;
}
public void setRemarkContent(String remarkContent)
{
this.remarkContent = remarkContent;
}
public String getRemarkContent()
{
return remarkContent;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("userName", getUserName())
.append("userPhone", getUserPhone())
.append("source", getSource())
.append("floatScore", getFloatScore())
.append("soureId", getSoureId())
.append("remarkContent", getRemarkContent())
.append("createTime", getCreateTime())
.append("createBy", getCreateBy())
.toString();
}
}

@ -0,0 +1,62 @@
package com.flossom.common.core.mapper;
import com.flossom.common.core.domain.entity.WxUserIntegralLog;
import java.util.List;
/**
* Mapper
*
* @author flossom
* @date 2023-12-14
*/
public interface WxUserIntegralLogMapper
{
/**
*
*
* @param id
* @return
*/
public WxUserIntegralLog selectWxUserIntegralLogById(Long id);
/**
*
*
* @param wxUserIntegralLog
* @return
*/
public List<WxUserIntegralLog> selectWxUserIntegralLogList(WxUserIntegralLog wxUserIntegralLog);
/**
*
*
* @param wxUserIntegralLog
* @return
*/
public int insertWxUserIntegralLog(WxUserIntegralLog wxUserIntegralLog);
/**
*
*
* @param wxUserIntegralLog
* @return
*/
public int updateWxUserIntegralLog(WxUserIntegralLog wxUserIntegralLog);
/**
*
*
* @param id
* @return
*/
public int deleteWxUserIntegralLogById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteWxUserIntegralLogByIds(Long[] ids);
}

@ -0,0 +1,89 @@
<?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.flossom.common.core.mapper.WxUserIntegralLogMapper">
<resultMap type="WxUserIntegralLog" id="WxUserIntegralLogResult">
<result property="id" column="id" />
<result property="userName" column="user_name" />
<result property="userPhone" column="user_phone" />
<result property="source" column="source" />
<result property="floatScore" column="float_score" />
<result property="soureId" column="soure_id" />
<result property="remarkContent" column="remark_content" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
</resultMap>
<sql id="selectWxUserIntegralLogVo">
select id, user_name, user_phone, source, float_score, soure_id, remark_content, create_time, create_by from wx_user_integral_log
</sql>
<select id="selectWxUserIntegralLogList" parameterType="WxUserIntegralLog" resultMap="WxUserIntegralLogResult">
<include refid="selectWxUserIntegralLogVo"/>
<where>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
<if test="userPhone != null and userPhone != ''"> and user_phone = #{userPhone}</if>
<if test="source != null and source != ''"> and source = #{source}</if>
<if test="floatScore != null "> and float_score = #{floatScore}</if>
<if test="soureId != null "> and soure_id = #{soureId}</if>
<if test="remarkContent != null and remarkContent != ''"> and remark_content = #{remarkContent}</if>
</where>
</select>
<select id="selectWxUserIntegralLogById" parameterType="Long" resultMap="WxUserIntegralLogResult">
<include refid="selectWxUserIntegralLogVo"/>
where id = #{id}
</select>
<insert id="insertWxUserIntegralLog" parameterType="WxUserIntegralLog" useGeneratedKeys="true" keyProperty="id">
insert into wx_user_integral_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userName != null">user_name,</if>
<if test="userPhone != null">user_phone,</if>
<if test="source != null">source,</if>
<if test="floatScore != null">float_score,</if>
<if test="soureId != null">soure_id,</if>
<if test="remarkContent != null">remark_content,</if>
<if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userName != null">#{userName},</if>
<if test="userPhone != null">#{userPhone},</if>
<if test="source != null">#{source},</if>
<if test="floatScore != null">#{floatScore},</if>
<if test="soureId != null">#{soureId},</if>
<if test="remarkContent != null">#{remarkContent},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
</trim>
</insert>
<update id="updateWxUserIntegralLog" parameterType="WxUserIntegralLog">
update wx_user_integral_log
<trim prefix="SET" suffixOverrides=",">
<if test="userName != null">user_name = #{userName},</if>
<if test="userPhone != null">user_phone = #{userPhone},</if>
<if test="source != null">source = #{source},</if>
<if test="floatScore != null">float_score = #{floatScore},</if>
<if test="soureId != null">soure_id = #{soureId},</if>
<if test="remarkContent != null">remark_content = #{remarkContent},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteWxUserIntegralLogById" parameterType="Long">
delete from wx_user_integral_log where id = #{id}
</delete>
<delete id="deleteWxUserIntegralLogByIds" parameterType="String">
delete from wx_user_integral_log where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

@ -0,0 +1,106 @@
package com.flossom.system.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import com.flossom.common.core.domain.entity.WxUserIntegralLog;
import com.flossom.common.core.utils.poi.ExcelUtil;
import com.flossom.common.core.web.controller.BaseController;
import com.flossom.common.core.web.domain.AjaxResult;
import com.flossom.common.core.web.page.TableDataInfo;
import com.flossom.common.log.annotation.Log;
import com.flossom.common.log.enums.BusinessType;
import com.flossom.common.security.annotation.RequiresPermissions;
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.flossom.system.service.IWxUserIntegralLogService;
/**
* Controller
*
* @author flossom
* @date 2023-12-14
*/
@RestController
@RequestMapping("/integralLog")
public class WxUserIntegralLogController extends BaseController
{
@Autowired
private IWxUserIntegralLogService wxUserIntegralLogService;
/**
*
*/
@RequiresPermissions("system:integralLog:list")
@GetMapping("/list")
public TableDataInfo list(WxUserIntegralLog wxUserIntegralLog)
{
startPage();
List<WxUserIntegralLog> list = wxUserIntegralLogService.selectWxUserIntegralLogList(wxUserIntegralLog);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("system:integralLog:export")
@Log(title = "微信用户积分流水", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WxUserIntegralLog wxUserIntegralLog)
{
List<WxUserIntegralLog> list = wxUserIntegralLogService.selectWxUserIntegralLogList(wxUserIntegralLog);
ExcelUtil<WxUserIntegralLog> util = new ExcelUtil<WxUserIntegralLog>(WxUserIntegralLog.class);
util.exportExcel(response, list, "微信用户积分流水数据");
}
/**
*
*/
@RequiresPermissions("system:integralLog:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(wxUserIntegralLogService.selectWxUserIntegralLogById(id));
}
/**
*
*/
@RequiresPermissions("system:integralLog:add")
@Log(title = "微信用户积分流水", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WxUserIntegralLog wxUserIntegralLog)
{
return toAjax(wxUserIntegralLogService.insertWxUserIntegralLog(wxUserIntegralLog));
}
/**
*
*/
@RequiresPermissions("system:integralLog:edit")
@Log(title = "微信用户积分流水", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WxUserIntegralLog wxUserIntegralLog)
{
return toAjax(wxUserIntegralLogService.updateWxUserIntegralLog(wxUserIntegralLog));
}
/**
*
*/
@RequiresPermissions("system:integralLog:remove")
@Log(title = "微信用户积分流水", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(wxUserIntegralLogService.deleteWxUserIntegralLogByIds(ids));
}
}

@ -0,0 +1,62 @@
package com.flossom.system.service;
import com.flossom.common.core.domain.entity.WxUserIntegralLog;
import java.util.List;
/**
* Service
*
* @author flossom
* @date 2023-12-14
*/
public interface IWxUserIntegralLogService
{
/**
*
*
* @param id
* @return
*/
public WxUserIntegralLog selectWxUserIntegralLogById(Long id);
/**
*
*
* @param wxUserIntegralLog
* @return
*/
public List<WxUserIntegralLog> selectWxUserIntegralLogList(WxUserIntegralLog wxUserIntegralLog);
/**
*
*
* @param wxUserIntegralLog
* @return
*/
public int insertWxUserIntegralLog(WxUserIntegralLog wxUserIntegralLog);
/**
*
*
* @param wxUserIntegralLog
* @return
*/
public int updateWxUserIntegralLog(WxUserIntegralLog wxUserIntegralLog);
/**
*
*
* @param ids
* @return
*/
public int deleteWxUserIntegralLogByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteWxUserIntegralLogById(Long id);
}

@ -0,0 +1,96 @@
package com.flossom.system.service.impl;
import java.util.List;
import com.flossom.common.core.domain.entity.WxUserIntegralLog;
import com.flossom.common.core.mapper.WxUserIntegralLogMapper;
import com.flossom.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.flossom.system.service.IWxUserIntegralLogService;
/**
* Service
*
* @author flossom
* @date 2023-12-14
*/
@Service
public class WxUserIntegralLogServiceImpl implements IWxUserIntegralLogService
{
@Autowired
private WxUserIntegralLogMapper wxUserIntegralLogMapper;
/**
*
*
* @param id
* @return
*/
@Override
public WxUserIntegralLog selectWxUserIntegralLogById(Long id)
{
return wxUserIntegralLogMapper.selectWxUserIntegralLogById(id);
}
/**
*
*
* @param wxUserIntegralLog
* @return
*/
@Override
public List<WxUserIntegralLog> selectWxUserIntegralLogList(WxUserIntegralLog wxUserIntegralLog)
{
return wxUserIntegralLogMapper.selectWxUserIntegralLogList(wxUserIntegralLog);
}
/**
*
*
* @param wxUserIntegralLog
* @return
*/
@Override
public int insertWxUserIntegralLog(WxUserIntegralLog wxUserIntegralLog)
{
wxUserIntegralLog.setCreateTime(DateUtils.getNowDate());
return wxUserIntegralLogMapper.insertWxUserIntegralLog(wxUserIntegralLog);
}
/**
*
*
* @param wxUserIntegralLog
* @return
*/
@Override
public int updateWxUserIntegralLog(WxUserIntegralLog wxUserIntegralLog)
{
return wxUserIntegralLogMapper.updateWxUserIntegralLog(wxUserIntegralLog);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteWxUserIntegralLogByIds(Long[] ids)
{
return wxUserIntegralLogMapper.deleteWxUserIntegralLogByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteWxUserIntegralLogById(Long id)
{
return wxUserIntegralLogMapper.deleteWxUserIntegralLogById(id);
}
}

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询微信用户积分流水列表
export function listLog(query) {
return request({
url: '/system/integralLog/list',
method: 'get',
params: query
})
}
// 查询微信用户积分流水详细
export function getLog(id) {
return request({
url: '/system/integralLog/' + id,
method: 'get'
})
}
// 新增微信用户积分流水
export function addLog(data) {
return request({
url: '/system/integralLog',
method: 'post',
data: data
})
}
// 修改微信用户积分流水
export function updateLog(data) {
return request({
url: '/system/integralLog',
method: 'put',
data: data
})
}
// 删除微信用户积分流水
export function delLog(id) {
return request({
url: '/system/integralLog/' + id,
method: 'delete'
})
}

@ -0,0 +1,311 @@
<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="userName">
<el-input
v-model="queryParams.userName"
placeholder="请输入会员昵称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="手机号码" prop="userPhone">
<el-input
v-model="queryParams.userPhone"
placeholder="请输入会员手机号码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="积分类型" prop="source">
<el-select
v-model="queryParams.source"
placeholder="请选择类型"
:style="{ width: '100%' }"
clearable
>
<el-option label="全部" value="" />
<el-option label="增加" value="1" />
<el-option label="减少" value="2" />
</el-select>
</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="['system:integralLog: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="['system:integralLog: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="['system:integralLog: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="['system:integralLog:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="logList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="用户昵称" align="center" prop="userName" />
<el-table-column label="用户手机号码" align="center" prop="userPhone" />
<el-table-column label="类型" align="center" prop="source" >
<template slot-scope="scope">
<span v-show="scope.row.source == 1"></span>
<span v-show="scope.row.source == 2"></span>
</template>
</el-table-column>
<el-table-column label="浮动分数" align="center" prop="floatScore" >
<template slot-scope="scope">
<span v-show="scope.row.source == 1">+{{scope.row.floatScore}}</span>
<span v-show="scope.row.source == 2">-{{scope.row.floatScore}}</span>
</template>
</el-table-column>
<el-table-column label="来源ID" align="center" prop="soureId" />
<el-table-column label="说明" align="center" prop="remarkContent" width="480"/>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<!-- <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="['system:integralLog:edit']"-->
<!-- >修改</el-button>-->
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-delete"-->
<!-- @click="handleDelete(scope.row)"-->
<!-- v-hasPermi="['system:integralLog: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="用户昵称" prop="userName">
<el-input v-model="form.userName" placeholder="请输入用户昵称" />
</el-form-item>
<el-form-item label="用户手机号码" prop="userPhone">
<el-input v-model="form.userPhone" placeholder="请输入用户手机号码" />
</el-form-item>
<el-form-item label="1-增加 2-减少" prop="source">
<el-input v-model="form.source" placeholder="请输入1-增加 2-减少" />
</el-form-item>
<el-form-item label="浮动分数" prop="floatScore">
<el-input v-model="form.floatScore" placeholder="请输入浮动分数" />
</el-form-item>
<el-form-item label="来源ID" prop="soureId">
<el-input v-model="form.soureId" placeholder="请输入来源ID" />
</el-form-item>
<el-form-item label="说明">
<editor v-model="form.remarkContent" :min-height="192"/>
</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 { listLog, getLog, delLog, addLog, updateLog } from "@/api/system/integralLog";
export default {
name: "Log",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
logList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
userName: null,
userPhone: null,
source: null,
floatScore: null,
soureId: null,
remarkContent: null,
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询微信用户积分流水列表 */
getList() {
this.loading = true;
listLog(this.queryParams).then(response => {
this.logList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
userName: null,
userPhone: null,
source: null,
floatScore: null,
soureId: null,
remarkContent: null,
createTime: null,
createBy: 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
getLog(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) {
updateLog(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addLog(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 delLog(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/log/export', {
...this.queryParams
}, `log_${new Date().getTime()}.xlsx`)
}
}
};
</script>
Loading…
Cancel
Save