管理端微信小程序首页轮播图配置项

master
zxf 2023-07-18 15:33:04 +08:00
parent 9cec82dc96
commit 6506f893eb
9 changed files with 874 additions and 5 deletions

View File

@ -0,0 +1,105 @@
package com.zxf.web.controller.wheel;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.zxf.system.domain.ZxfmnWheel;
import com.zxf.system.service.IZxfmnWheelService;
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.zxf.common.annotation.Log;
import com.zxf.common.core.controller.BaseController;
import com.zxf.common.core.domain.AjaxResult;
import com.zxf.common.enums.BusinessType;
import com.zxf.common.utils.poi.ExcelUtil;
import com.zxf.common.core.page.TableDataInfo;
/**
* wheelController
*
* @author zxf
* @date 2023-07-18
*/
@RestController
@RequestMapping("/wheel/wheel")
public class ZxfmnWheelController extends BaseController
{
@Autowired
private IZxfmnWheelService zxfmnWheelService;
/**
* wheel
*/
@PreAuthorize("@ss.hasPermi('wheel:wheel:list')")
@GetMapping("/list")
public TableDataInfo list(ZxfmnWheel zxfmnWheel)
{
startPage();
List<ZxfmnWheel> list = zxfmnWheelService.selectZxfmnWheelList(zxfmnWheel);
return getDataTable(list);
}
/**
* wheel
*/
@PreAuthorize("@ss.hasPermi('wheel:wheel:export')")
@Log(title = "wheel", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ZxfmnWheel zxfmnWheel)
{
List<ZxfmnWheel> list = zxfmnWheelService.selectZxfmnWheelList(zxfmnWheel);
ExcelUtil<ZxfmnWheel> util = new ExcelUtil<ZxfmnWheel>(ZxfmnWheel.class);
util.exportExcel(response, list, "wheel数据");
}
/**
* wheel
*/
@PreAuthorize("@ss.hasPermi('wheel:wheel:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Integer id)
{
return success(zxfmnWheelService.selectZxfmnWheelById(id));
}
/**
* wheel
*/
@PreAuthorize("@ss.hasPermi('wheel:wheel:add')")
@Log(title = "wheel", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ZxfmnWheel zxfmnWheel)
{
return toAjax(zxfmnWheelService.insertZxfmnWheel(zxfmnWheel));
}
/**
* wheel
*/
@PreAuthorize("@ss.hasPermi('wheel:wheel:edit')")
@Log(title = "wheel", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ZxfmnWheel zxfmnWheel)
{
return toAjax(zxfmnWheelService.updateZxfmnWheel(zxfmnWheel));
}
/**
* wheel
*/
@PreAuthorize("@ss.hasPermi('wheel:wheel:remove')")
@Log(title = "wheel", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Integer[] ids)
{
return toAjax(zxfmnWheelService.deleteZxfmnWheelByIds(ids));
}
}

View File

@ -5,6 +5,8 @@ import com.zxf.common.annotation.Anonymous;
import com.zxf.common.core.domain.AjaxResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
@ -17,17 +19,27 @@ import java.util.Map;
public class wxBusinessControllApi {
private static final Logger log = LoggerFactory.getLogger(wxBusinessControllApi.class);
@Autowired
JdbcTemplate jdbcTemplate;
/**
*
* @param param
* @return
*/
@Anonymous
@GetMapping("/getimage")
public AjaxResult getimage(@RequestParam Map param) {
log.info("获取首页轮播图图片地址 到时候返回静态服务器绝对路径");
List a = new ArrayList();
a.add("/images/1.jpg");
a.add("/images/2.jpg");
a.add("/images/3.jpg");
return AjaxResult.success(a);
List<Map<String,Object>> images=jdbcTemplate.queryForList("select CONCAT('http://127.0.0.1:8080',img_url ) img_url from zxfmn_wheel");
return AjaxResult.success(images);
}
}

View File

@ -0,0 +1,121 @@
package com.zxf.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zxf.common.annotation.Excel;
import com.zxf.common.core.domain.BaseEntity;
/**
* wheel zxfmn_wheel
*
* @author zxf
* @date 2023-07-18
*/
public class ZxfmnWheel extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Integer id;
/** 1 展示 2 不展示 */
@Excel(name = "1 展示 2 不展示")
private String isFlag;
/** 图片地址 */
@Excel(name = "图片地址")
private String imgUrl;
/** 跳转地址 */
@Excel(name = "跳转地址")
private String skipUrl;
/** 富文本信息展示 */
@Excel(name = "富文本信息展示")
private String richText;
/** 视频地址 */
@Excel(name = "视频地址")
private String videoText;
/** 扩展 */
@Excel(name = "扩展")
private String extend;
public void setId(Integer id)
{
this.id = id;
}
public Integer getId()
{
return id;
}
public void setIsFlag(String isFlag)
{
this.isFlag = isFlag;
}
public String getIsFlag()
{
return isFlag;
}
public void setImgUrl(String imgUrl)
{
this.imgUrl = imgUrl;
}
public String getImgUrl()
{
return imgUrl;
}
public void setSkipUrl(String skipUrl)
{
this.skipUrl = skipUrl;
}
public String getSkipUrl()
{
return skipUrl;
}
public void setRichText(String richText)
{
this.richText = richText;
}
public String getRichText()
{
return richText;
}
public void setVideoText(String videoText)
{
this.videoText = videoText;
}
public String getVideoText()
{
return videoText;
}
public void setExtend(String extend)
{
this.extend = extend;
}
public String getExtend()
{
return extend;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("isFlag", getIsFlag())
.append("imgUrl", getImgUrl())
.append("skipUrl", getSkipUrl())
.append("richText", getRichText())
.append("videoText", getVideoText())
.append("extend", getExtend())
.toString();
}
}

View File

@ -0,0 +1,62 @@
package com.zxf.system.mapper;
import java.util.List;
import com.zxf.system.domain.ZxfmnWheel;
/**
* wheelMapper
*
* @author zxf
* @date 2023-07-18
*/
public interface ZxfmnWheelMapper
{
/**
* wheel
*
* @param id wheel
* @return wheel
*/
public ZxfmnWheel selectZxfmnWheelById(Integer id);
/**
* wheel
*
* @param zxfmnWheel wheel
* @return wheel
*/
public List<ZxfmnWheel> selectZxfmnWheelList(ZxfmnWheel zxfmnWheel);
/**
* wheel
*
* @param zxfmnWheel wheel
* @return
*/
public int insertZxfmnWheel(ZxfmnWheel zxfmnWheel);
/**
* wheel
*
* @param zxfmnWheel wheel
* @return
*/
public int updateZxfmnWheel(ZxfmnWheel zxfmnWheel);
/**
* wheel
*
* @param id wheel
* @return
*/
public int deleteZxfmnWheelById(Integer id);
/**
* wheel
*
* @param ids
* @return
*/
public int deleteZxfmnWheelByIds(Integer[] ids);
}

View File

@ -0,0 +1,62 @@
package com.zxf.system.service;
import com.zxf.system.domain.ZxfmnWheel;
import java.util.List;
/**
* wheelService
*
* @author zxf
* @date 2023-07-18
*/
public interface IZxfmnWheelService
{
/**
* wheel
*
* @param id wheel
* @return wheel
*/
public ZxfmnWheel selectZxfmnWheelById(Integer id);
/**
* wheel
*
* @param zxfmnWheel wheel
* @return wheel
*/
public List<ZxfmnWheel> selectZxfmnWheelList(ZxfmnWheel zxfmnWheel);
/**
* wheel
*
* @param zxfmnWheel wheel
* @return
*/
public int insertZxfmnWheel(ZxfmnWheel zxfmnWheel);
/**
* wheel
*
* @param zxfmnWheel wheel
* @return
*/
public int updateZxfmnWheel(ZxfmnWheel zxfmnWheel);
/**
* wheel
*
* @param ids wheel
* @return
*/
public int deleteZxfmnWheelByIds(Integer[] ids);
/**
* wheel
*
* @param id wheel
* @return
*/
public int deleteZxfmnWheelById(Integer id);
}

View File

@ -0,0 +1,95 @@
package com.zxf.system.service.impl;
import java.util.List;
import com.zxf.system.domain.ZxfmnWheel;
import com.zxf.system.mapper.ZxfmnWheelMapper;
import com.zxf.system.service.IZxfmnWheelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* wheelService
*
* @author zxf
* @date 2023-07-18
*/
@Service
public class ZxfmnWheelServiceImpl implements IZxfmnWheelService
{
@Autowired
private ZxfmnWheelMapper zxfmnWheelMapper;
/**
* wheel
*
* @param id wheel
* @return wheel
*/
@Override
public ZxfmnWheel selectZxfmnWheelById(Integer id)
{
return zxfmnWheelMapper.selectZxfmnWheelById(id);
}
/**
* wheel
*
* @param zxfmnWheel wheel
* @return wheel
*/
@Override
public List<ZxfmnWheel> selectZxfmnWheelList(ZxfmnWheel zxfmnWheel)
{
return zxfmnWheelMapper.selectZxfmnWheelList(zxfmnWheel);
}
/**
* wheel
*
* @param zxfmnWheel wheel
* @return
*/
@Override
public int insertZxfmnWheel(ZxfmnWheel zxfmnWheel)
{
return zxfmnWheelMapper.insertZxfmnWheel(zxfmnWheel);
}
/**
* wheel
*
* @param zxfmnWheel wheel
* @return
*/
@Override
public int updateZxfmnWheel(ZxfmnWheel zxfmnWheel)
{
return zxfmnWheelMapper.updateZxfmnWheel(zxfmnWheel);
}
/**
* wheel
*
* @param ids wheel
* @return
*/
@Override
public int deleteZxfmnWheelByIds(Integer[] ids)
{
return zxfmnWheelMapper.deleteZxfmnWheelByIds(ids);
}
/**
* wheel
*
* @param id wheel
* @return
*/
@Override
public int deleteZxfmnWheelById(Integer id)
{
return zxfmnWheelMapper.deleteZxfmnWheelById(id);
}
}

View File

@ -0,0 +1,81 @@
<?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.zxf.system.mapper.ZxfmnWheelMapper">
<resultMap type="ZxfmnWheel" id="ZxfmnWheelResult">
<result property="id" column="id" />
<result property="isFlag" column="is_flag" />
<result property="imgUrl" column="img_url" />
<result property="skipUrl" column="skip_url" />
<result property="richText" column="rich_text" />
<result property="videoText" column="video_text" />
<result property="extend" column="extend" />
</resultMap>
<sql id="selectZxfmnWheelVo">
select id, is_flag, img_url, skip_url, rich_text, video_text, extend from zxfmn_wheel
</sql>
<select id="selectZxfmnWheelList" parameterType="ZxfmnWheel" resultMap="ZxfmnWheelResult">
<include refid="selectZxfmnWheelVo"/>
<where>
<if test="isFlag != null and isFlag != ''"> and is_flag = #{isFlag}</if>
<if test="imgUrl != null and imgUrl != ''"> and img_url = #{imgUrl}</if>
<if test="skipUrl != null and skipUrl != ''"> and skip_url = #{skipUrl}</if>
<if test="richText != null and richText != ''"> and rich_text = #{richText}</if>
<if test="videoText != null and videoText != ''"> and video_text = #{videoText}</if>
<if test="extend != null and extend != ''"> and extend = #{extend}</if>
</where>
</select>
<select id="selectZxfmnWheelById" parameterType="Integer" resultMap="ZxfmnWheelResult">
<include refid="selectZxfmnWheelVo"/>
where id = #{id}
</select>
<insert id="insertZxfmnWheel" parameterType="ZxfmnWheel" useGeneratedKeys="true" keyProperty="id">
insert into zxfmn_wheel
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="isFlag != null">is_flag,</if>
<if test="imgUrl != null">img_url,</if>
<if test="skipUrl != null">skip_url,</if>
<if test="richText != null">rich_text,</if>
<if test="videoText != null">video_text,</if>
<if test="extend != null">extend,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="isFlag != null">#{isFlag},</if>
<if test="imgUrl != null">#{imgUrl},</if>
<if test="skipUrl != null">#{skipUrl},</if>
<if test="richText != null">#{richText},</if>
<if test="videoText != null">#{videoText},</if>
<if test="extend != null">#{extend},</if>
</trim>
</insert>
<update id="updateZxfmnWheel" parameterType="ZxfmnWheel">
update zxfmn_wheel
<trim prefix="SET" suffixOverrides=",">
<if test="isFlag != null">is_flag = #{isFlag},</if>
<if test="imgUrl != null">img_url = #{imgUrl},</if>
<if test="skipUrl != null">skip_url = #{skipUrl},</if>
<if test="richText != null">rich_text = #{richText},</if>
<if test="videoText != null">video_text = #{videoText},</if>
<if test="extend != null">extend = #{extend},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZxfmnWheelById" parameterType="Integer">
delete from zxfmn_wheel where id = #{id}
</delete>
<delete id="deleteZxfmnWheelByIds" parameterType="String">
delete from zxfmn_wheel where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询wheel列表
export function listWheel(query) {
return request({
url: '/wheel/wheel/list',
method: 'get',
params: query
})
}
// 查询wheel详细
export function getWheel(id) {
return request({
url: '/wheel/wheel/' + id,
method: 'get'
})
}
// 新增wheel
export function addWheel(data) {
return request({
url: '/wheel/wheel',
method: 'post',
data: data
})
}
// 修改wheel
export function updateWheel(data) {
return request({
url: '/wheel/wheel',
method: 'put',
data: data
})
}
// 删除wheel
export function delWheel(id) {
return request({
url: '/wheel/wheel/' + id,
method: 'delete'
})
}

View File

@ -0,0 +1,287 @@
<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="skipUrl">
<el-input
v-model="queryParams.skipUrl"
placeholder="请输入跳转地址"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="扩展" prop="extend">
<el-input
v-model="queryParams.extend"
placeholder="请输入扩展"
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="['wheel:wheel: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="['wheel:wheel: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="['wheel:wheel: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="['wheel:wheel:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="wheelList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="是否发布" align="center" prop="isFlag" />
<el-table-column label="图片地址" align="center" prop="imgUrl" width="100">
<template slot-scope="scope">
<image-preview :src="scope.row.imgUrl" :width="50" :height="50"/>
</template>
</el-table-column>
<el-table-column label="跳转地址" align="center" prop="skipUrl" />
<el-table-column label="富文本信息展示" align="center" prop="richText" />
<el-table-column label="视频地址" align="center" prop="videoText" width="100">
<template slot-scope="scope">
<image-preview :src="scope.row.videoText" :width="50" :height="50"/>
</template>
</el-table-column>
<el-table-column label="扩展" align="center" prop="extend" />
<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="['wheel:wheel:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['wheel:wheel: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"
/>
<!-- 添加或修改wheel对话框 -->
<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="imgUrl">
<image-upload v-model="form.imgUrl"/>
</el-form-item>
<el-form-item label="跳转地址" prop="skipUrl">
<el-input v-model="form.skipUrl" placeholder="请输入跳转地址" />
</el-form-item>
<el-form-item label="富文本信息展示">
<editor v-model="form.richText" :min-height="192"/>
</el-form-item>
<el-form-item label="视频地址" prop="videoText">
<image-upload v-model="form.videoText"/>
</el-form-item>
<el-form-item label="扩展" prop="extend">
<el-input v-model="form.extend" 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 { listWheel, getWheel, delWheel, addWheel, updateWheel } from "@/api/wheel/wheel";
export default {
name: "Wheel",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
// wheel
wheelList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
isFlag: null,
imgUrl: null,
skipUrl: null,
richText: null,
videoText: null,
extend: null
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询wheel列表 */
getList() {
this.loading = true;
listWheel(this.queryParams).then(response => {
this.wheelList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
isFlag: null,
imgUrl: null,
skipUrl: null,
richText: null,
videoText: null,
extend: 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 = "添加wheel";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getWheel(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改wheel";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateWheel(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addWheel(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除wheel编号为"' + ids + '"的数据项?').then(function() {
return delWheel(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('wheel/wheel/export', {
...this.queryParams
}, `wheel_${new Date().getTime()}.xlsx`)
}
}
};
</script>