膜布管理

master
382696293@qq.com 2 years ago
parent 9d624206db
commit b23b037f0e

@ -0,0 +1,157 @@
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_lining
*
* @author flossom
* @date 2024-03-26
*/
public class WxLining extends BaseEntity {
private static final long serialVersionUID = 1L;
private Long id;
/**
*
*/
@Excel(name = "膜布编码")
private String code;
/**
*
*/
@Excel(name = "膜布名称")
private String name;
/**
*
*/
@Excel(name = "膜布描述")
private String desc;
/**
* 1/0
*/
@Excel(name = "购买入口是否显示", readConverterExp = "1=是/0否")
private Long isShowBuy;
/**
* appid
*/
@Excel(name = "购买商城appid")
private String skipAppid;
/**
* PATH
*/
@Excel(name = "购买商城PATH")
private String skipPath;
/**
*
*/
@Excel(name = "膜布图标")
private String icon;
/**
* 0 1
*/
@Excel(name = "状态", readConverterExp = "0=正常,1=禁用")
private Long status;
public void setId(Long id) {
this.id = id;
}
public Long getId() {
return id;
}
public void setCode(String code) {
this.code = code;
}
public String getCode() {
return code;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setDesc(String desc) {
this.desc = desc;
}
public String getDesc() {
return desc;
}
public void setIsShowBuy(Long isShowBuy) {
this.isShowBuy = isShowBuy;
}
public Long getIsShowBuy() {
return isShowBuy;
}
public void setSkipAppid(String skipAppid) {
this.skipAppid = skipAppid;
}
public String getSkipAppid() {
return skipAppid;
}
public void setSkipPath(String skipPath) {
this.skipPath = skipPath;
}
public String getSkipPath() {
return skipPath;
}
public void setIcon(String icon) {
this.icon = icon;
}
public String getIcon() {
return icon;
}
public void setStatus(Long status) {
this.status = status;
}
public Long getStatus() {
return status;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("code", getCode())
.append("name", getName())
.append("desc", getDesc())
.append("isShowBuy", getIsShowBuy())
.append("skipAppid", getSkipAppid())
.append("skipPath", getSkipPath())
.append("icon", getIcon())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

@ -0,0 +1,61 @@
package com.flossom.common.core.mapper;
import com.flossom.common.core.domain.entity.WxLining;
import java.util.List;
/**
* Mapper
*
* @author flossom
* @date 2024-03-26
*/
public interface WxLiningMapper {
/**
*
*
* @param id
* @return
*/
public WxLining selectWxLiningById(Long id);
/**
*
*
* @param wxLining
* @return
*/
public List<WxLining> selectWxLiningList(WxLining wxLining);
/**
*
*
* @param wxLining
* @return
*/
public int insertWxLining(WxLining wxLining);
/**
*
*
* @param wxLining
* @return
*/
public int updateWxLining(WxLining wxLining);
/**
*
*
* @param id
* @return
*/
public int deleteWxLiningById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteWxLiningByIds(Long[] ids);
}

@ -0,0 +1,109 @@
<?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.WxLiningMapper">
<resultMap type="WxLining" id="WxLiningResult">
<result property="id" column="id" />
<result property="code" column="code" />
<result property="name" column="name" />
<result property="desc" column="desc" />
<result property="isShowBuy" column="is_show_buy" />
<result property="skipAppid" column="skip_appid" />
<result property="skipPath" column="skip_path" />
<result property="icon" column="icon" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectWxLiningVo">
select id, code, name, `desc`, is_show_buy, skip_appid, skip_path, icon, status, create_by, create_time, update_by, update_time from wx_lining
</sql>
<select id="selectWxLiningList" parameterType="WxLining" resultMap="WxLiningResult">
<include refid="selectWxLiningVo"/>
<where>
<if test="code != null and code != ''"> and code = #{code}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="desc != null and desc != ''"> and `desc` = #{desc}</if>
<if test="isShowBuy != null "> and is_show_buy = #{isShowBuy}</if>
<if test="skipAppid != null and skipAppid != ''"> and skip_appid = #{skipAppid}</if>
<if test="skipPath != null and skipPath != ''"> and skip_path = #{skipPath}</if>
<if test="icon != null and icon != ''"> and icon = #{icon}</if>
<if test="status != null "> and status = #{status}</if>
</where>
</select>
<select id="selectWxLiningById" parameterType="Long" resultMap="WxLiningResult">
<include refid="selectWxLiningVo"/>
where id = #{id}
</select>
<insert id="insertWxLining" parameterType="WxLining">
insert into wx_lining
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="code != null">code,</if>
<if test="name != null">name,</if>
<if test="desc != null">`desc`,</if>
<if test="isShowBuy != null">is_show_buy,</if>
<if test="skipAppid != null">skip_appid,</if>
<if test="skipPath != null">skip_path,</if>
<if test="icon != null">icon,</if>
<if test="status != null">status,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="code != null">#{code},</if>
<if test="name != null">#{name},</if>
<if test="desc != null">#{desc},</if>
<if test="isShowBuy != null">#{isShowBuy},</if>
<if test="skipAppid != null">#{skipAppid},</if>
<if test="skipPath != null">#{skipPath},</if>
<if test="icon != null">#{icon},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateWxLining" parameterType="WxLining">
update wx_lining
<trim prefix="SET" suffixOverrides=",">
<if test="code != null">code = #{code},</if>
<if test="name != null">name = #{name},</if>
<if test="desc != null">`desc` = #{desc},</if>
<if test="isShowBuy != null">is_show_buy = #{isShowBuy},</if>
<if test="skipAppid != null">skip_appid = #{skipAppid},</if>
<if test="skipPath != null">skip_path = #{skipPath},</if>
<if test="icon != null">icon = #{icon},</if>
<if test="status != null">status = #{status},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteWxLiningById" parameterType="Long">
delete from wx_lining where id = #{id}
</delete>
<delete id="deleteWxLiningByIds" parameterType="String">
delete from wx_lining where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

@ -0,0 +1,100 @@
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.WxLining;
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.IWxLiningService;
/**
* Controller
*
* @author flossom
* @date 2024-03-26
*/
@RestController
@RequestMapping("/lining")
public class WxLiningController extends BaseController {
@Autowired
private IWxLiningService wxLiningService;
/**
*
*/
@RequiresPermissions("system:lining:list")
@GetMapping("/list")
public TableDataInfo list(WxLining wxLining) {
List<WxLining> list = wxLiningService.selectWxLiningList(wxLining);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("system:lining:export")
@Log(title = "膜布", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WxLining wxLining) {
List<WxLining> list = wxLiningService.selectWxLiningList(wxLining);
ExcelUtil<WxLining> util = new ExcelUtil<WxLining>(WxLining.class);
util.exportExcel(response, list, "膜布数据");
}
/**
*
*/
@RequiresPermissions("system:lining:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(wxLiningService.selectWxLiningById(id));
}
/**
*
*/
@RequiresPermissions("system:lining:add")
@Log(title = "膜布", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WxLining wxLining) {
return toAjax(wxLiningService.insertWxLining(wxLining));
}
/**
*
*/
@RequiresPermissions("system:lining:edit")
@Log(title = "膜布", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WxLining wxLining) {
return toAjax(wxLiningService.updateWxLining(wxLining));
}
/**
*
*/
@RequiresPermissions("system:lining:remove")
@Log(title = "膜布", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(wxLiningService.deleteWxLiningByIds(ids));
}
}

@ -0,0 +1,63 @@
package com.flossom.system.service;
import com.flossom.common.core.domain.entity.WxLining;
import java.util.List;
/**
* Service
*
* @author flossom
* @date 2024-03-26
*/
public interface IWxLiningService {
/**
*
*
* @param id
* @return
*/
public WxLining selectWxLiningById(Long id);
/**
*
*
* @param wxLining
* @return
*/
public List<WxLining> selectWxLiningList(WxLining wxLining);
/**
*
*
* @param wxLining
* @return
*/
public int insertWxLining(WxLining wxLining);
/**
*
*
* @param wxLining
* @return
*/
public int updateWxLining(WxLining wxLining);
/**
*
*
* @param ids
* @return
*/
public int deleteWxLiningByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteWxLiningById(Long id);
}

@ -0,0 +1,91 @@
package com.flossom.system.service.impl;
import java.util.List;
import com.flossom.common.core.domain.entity.WxLining;
import com.flossom.common.core.mapper.WxLiningMapper;
import com.flossom.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.flossom.system.service.IWxLiningService;
/**
* Service
*
* @author flossom
* @date 2024-03-26
*/
@Service
public class WxLiningServiceImpl implements IWxLiningService {
@Autowired
private WxLiningMapper wxLiningMapper;
/**
*
*
* @param id
* @return
*/
@Override
public WxLining selectWxLiningById(Long id) {
return wxLiningMapper.selectWxLiningById(id);
}
/**
*
*
* @param wxLining
* @return
*/
@Override
public List<WxLining> selectWxLiningList(WxLining wxLining) {
return wxLiningMapper.selectWxLiningList(wxLining);
}
/**
*
*
* @param wxLining
* @return
*/
@Override
public int insertWxLining(WxLining wxLining) {
wxLining.setCreateTime(DateUtils.getNowDate());
return wxLiningMapper.insertWxLining(wxLining);
}
/**
*
*
* @param wxLining
* @return
*/
@Override
public int updateWxLining(WxLining wxLining) {
wxLining.setUpdateTime(DateUtils.getNowDate());
return wxLiningMapper.updateWxLining(wxLining);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteWxLiningByIds(Long[] ids) {
return wxLiningMapper.deleteWxLiningByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteWxLiningById(Long id) {
return wxLiningMapper.deleteWxLiningById(id);
}
}

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询膜布列表
export function listLining(query) {
return request({
url: '/system/lining/list',
method: 'get',
params: query
})
}
// 查询膜布详细
export function getLining(id) {
return request({
url: '/system/lining/' + id,
method: 'get'
})
}
// 新增膜布
export function addLining(data) {
return request({
url: '/system/lining',
method: 'post',
data: data
})
}
// 修改膜布
export function updateLining(data) {
return request({
url: '/system/lining',
method: 'put',
data: data
})
}
// 删除膜布
export function delLining(id) {
return request({
url: '/system/lining/' + id,
method: 'delete'
})
}

@ -0,0 +1,293 @@
<template>
<div class="app-container">
<el-tabs v-model="activeName" @tab-click="handleClick" type="border-card">
<el-tab-pane :label="item.code" :name="item.code" v-for="(item, index) of liningList">
<div style="width: 200px; float: left;">
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<!-- 左侧表单项 -->
<div class="form-top">
<div class="form-top--left">
<el-form-item label="膜布名称" prop="name" style="width: 500px">
<el-input v-model="item.name" placeholder="请输入膜布名称"/>
</el-form-item>
<el-form-item label="购买入口是否显示" label-width="150px" prop="name" style="width: 500px">
<el-switch
v-model="item.isShowBuy == 1"
active-color="#13ce66"
inactive-color="#ff4949">
</el-switch>
</el-form-item>
<el-form-item label="购买商城appid" label-width="150px" prop="skipAppid" style="width: 500px">
<el-input v-model="item.skipAppid" placeholder="请输入购买商城appid"/>
</el-form-item>
<el-form-item label="膜布图标" prop="icon" width="150px">
<template>
<!-- 膜布图标 -->
<el-upload
ref="upload"
:action="uploadUrl"
:headers="headers"
:file-list="item.fileList"
list-type="picture-card"
accept=".jpg,.png"
:limit="1"
:class="{ hide: item.uploadHide }"
:on-remove="iconUploadRemove"
:on-success="iconUploadSuccess"
:on-error="uploadError"
:before-upload="handleBeforeUploadImage"
>
<i slot="default" class="el-icon-plus"></i>
<div slot="file" slot-scope="{ file }">
<img :src="file.url" class="el-upload-list__item-thumbnail" alt=""/>
<span class="el-upload-list__item-actions">
<span @click="iconPicturePreview(file)" class="el-upload-list__item-preview">
<i class="el-icon-zoom-in"></i>
</span>
<span v-if="!disabled" @click="iconUploadRemove(file)" class="el-upload-list__item-delete">
<i class="el-icon-delete"></i>
</span>
</span>
</div>
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件</div>
</el-upload>
<!-- 预览窗口 -->
<el-dialog :visible.sync="dialogVisible" append-to-body>
<img width="100%" :src="dialogImageUrl" alt=""/>
</el-dialog>
</template>
</el-form-item>
</div>
<!-- 右侧表单项 -->
<div class="form-top--right">
<el-form-item label="膜布描述" prop="desc" style="width: 500px">
<el-input v-model="item.desc" placeholder="请输入膜布描述"/>
</el-form-item>
<el-form-item style="height: 36px"/>
<el-form-item label="购买商城PATH" label-width="150px" prop="skipPath" style="width: 500px">
<el-input v-model="item.skipPath" placeholder="请输入购买商城PATH"/>
</el-form-item>
</div>
</div>
</el-form>
<div slot="footer" class="dialog-footer" style="margin-left: 90%;">
<el-button type="primary" @click="submitForm(item)"> </el-button>
</div>
</div>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import {listLining, getLining, delLining, addLining, updateLining} from "@/api/system/lining";
import {getToken} from "@/utils/auth";
export default {
name: "Lining",
data() {
return {
//
activeName: "M01",
/* 文件上传地址 */
uploadUrl: process.env.VUE_APP_BASE_API + '/file/upload',
headers: {
Authorization: 'Bearer ' + getToken(),
},
fileList: [
[], []
],
//
// uploadHide: false,
disabled: false,
dialogImageUrl: '',
dialogVisible: false,
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
liningList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
code: null,
name: null,
desc: null,
isShowBuy: null,
skipAppid: null,
skipPath: null,
icon: null,
status: null,
},
//
form: {},
//
rules: {},
};
},
created() {
this.getList();
},
methods: {
/** 查询膜布列表 */
getList() {
this.loading = true;
listLining().then(response => {
response?.rows?.forEach(item => {
this.liningList.push({
...item,
//
uploadHide: item?.icon != null,
fileList: [{
name: item?.icon,
url: item?.icon
}]
})
})
console.log(this.liningList);
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
code: null,
name: null,
desc: null,
isShowBuy: null,
skipAppid: null,
skipPath: null,
icon: null,
status: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getLining(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改膜布";
});
},
/** 提交按钮 */
submitForm(item) {
this.form = item;
this.form.icon = item.fileList[0].url;
if (this.form.id != null) {
updateLining(this.form).then(response => {
if (response.code == 200) {
this.$modal.msgSuccess("修改成功");
} else {
this.$modal.msgError("修改失败");
}
});
} else {
addLining(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
},
iconUploadRemove(file, fileList) {
this.liningList.forEach(e => {
if (this.activeName === e.code) {
e.fileList = [];
e.uploadHide = false;
}
})
},
iconUploadSuccess(response, file) {
if (response.code == 200) {
this.form.banner = response.data.url
this.liningList.forEach(e => {
if (this.activeName === e.code) {
e.fileList = [{
name: response.data.url,
url: response.data.url
}];
e.uploadHide = true;
}
})
} else {
this.$message.error('图片插入失败')
}
},
handleBeforeUploadImage(file) {
let fileType = ['jpg', 'png', 'JPG', 'PNG']
const fileName = file.name.split('.')
const fileExt = fileName[fileName.length - 1]
const isTypeOk = fileType.indexOf(fileExt) >= 0
if (!isTypeOk) {
this.$modal.msgError(`文件类型只能为jpg格式/png格式`)
return false
}
return true
},
iconPicturePreview(file) {
this.dialogImageUrl = file.url
this.dialogVisible = true
},
/* 文件上传失败 */
uploadError() {
this.$message.error('文件上传失败')
},
handleClick(tab, event) {
console.log(tab, event);
},
}
};
</script>
<style lang="scss" scoped>
.app-container {
.form-top {
display: flex;
justify-content: space-between;
.form-top--right {
flex: 1;
}
}
.form-bottom {
display: flex;
justify-content: flex-end;
}
::v-deep .hide .el-upload--picture-card {
display: none;
}
}
</style>
Loading…
Cancel
Save