Merge branch 'master' of http://124.222.105.7:3000/dianliang/dl_site_system
This commit is contained in:
commit
62cc90e131
@ -0,0 +1,112 @@
|
||||
package com.ruoyi.base.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
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.base.domain.BaseTemp;
|
||||
import com.ruoyi.base.service.IBaseTempService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 模板库Controller
|
||||
*
|
||||
* @author pqz
|
||||
* @date 2025-08-07
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/base/temp")
|
||||
public class BaseTempController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IBaseTempService baseTempService;
|
||||
|
||||
/**
|
||||
* 查询模板库列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('base:temp:list')")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(BaseTemp baseTemp,
|
||||
@RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize)
|
||||
{
|
||||
Page<BaseTemp> page = new Page<>(pageNum, pageSize);
|
||||
IPage<BaseTemp> list = baseTempService.queryListPage(baseTemp,page);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出模板库列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('base:temp:export')")
|
||||
@Log(title = "模板库", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, BaseTemp baseTemp)
|
||||
{
|
||||
List<BaseTemp> list = baseTempService.list();
|
||||
ExcelUtil<BaseTemp> util = new ExcelUtil<BaseTemp>(BaseTemp.class);
|
||||
util.exportExcel(response, list, "模板库数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取模板库详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('base:temp:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") String id)
|
||||
{
|
||||
return success(baseTempService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增模板库有3万块钱的购物卡么
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('base:temp:add')")
|
||||
@Log(title = "模板库", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody BaseTemp baseTemp)
|
||||
{
|
||||
return toAjax(baseTempService.save(baseTemp));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改模板库
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('base:temp:edit')")
|
||||
@Log(title = "模板库", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody BaseTemp baseTemp)
|
||||
{
|
||||
return toAjax(baseTempService.updateById(baseTemp));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除模板库
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('base:temp:remove')")
|
||||
@Log(title = "模板库", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable String[] ids)
|
||||
{
|
||||
List<String> list = new ArrayList<>(Arrays.asList(ids));
|
||||
return toAjax(baseTempService.removeByIds(list));
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package com.ruoyi.base.domain;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
import com.ruoyi.common.core.domain.DlBaseEntity;
|
||||
|
||||
/**
|
||||
* 模板库对象 dl_base_temp
|
||||
*
|
||||
* @author pqz
|
||||
* @date 2025-08-07
|
||||
*/
|
||||
@TableName("dl_base_temp")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class BaseTemp extends DlBaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
@TableId(type = IdType.ASSIGN_UUID)
|
||||
private String id;
|
||||
|
||||
/** 标题 */
|
||||
@Excel(name = "标题")
|
||||
private String title;
|
||||
|
||||
/** 图片 */
|
||||
@Excel(name = "图片")
|
||||
private String file;
|
||||
|
||||
/** 描述 */
|
||||
@Excel(name = "描述")
|
||||
private String remark;
|
||||
|
||||
/** 站点唯一编码(租户id) */
|
||||
@Excel(name = "站点唯一编码", readConverterExp = "租=户id")
|
||||
private String tenantId;
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.ruoyi.base.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.base.domain.BaseTemp;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 模板库Mapper接口
|
||||
*
|
||||
* @author pqz
|
||||
* @date 2025-08-07
|
||||
*/
|
||||
@Mapper
|
||||
public interface BaseTempMapper extends BaseMapper<BaseTemp>
|
||||
{
|
||||
IPage<BaseTemp> queryListPage(@Param("entity") BaseTemp entity, Page<BaseTemp> page);
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.ruoyi.base.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.base.domain.BaseTemp;
|
||||
|
||||
/**
|
||||
* 模板库Service接口
|
||||
*
|
||||
* @author pqz
|
||||
* @date 2025-08-07
|
||||
*/
|
||||
public interface IBaseTempService extends IService<BaseTemp>
|
||||
{
|
||||
IPage<BaseTemp> queryListPage(BaseTemp pageReqVO, Page<BaseTemp> page);
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.ruoyi.base.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.base.mapper.BaseTempMapper;
|
||||
import com.ruoyi.base.domain.BaseTemp;
|
||||
import com.ruoyi.base.service.IBaseTempService;
|
||||
|
||||
/**
|
||||
* 模板库Service业务层处理
|
||||
*
|
||||
* @author pqz
|
||||
* @date 2025-08-07
|
||||
*/
|
||||
@Service
|
||||
public class BaseTempServiceImpl extends ServiceImpl<BaseTempMapper,BaseTemp> implements IBaseTempService
|
||||
{
|
||||
@Autowired
|
||||
private BaseTempMapper baseTempMapper;
|
||||
|
||||
@Override
|
||||
public IPage<BaseTemp> queryListPage(BaseTemp pageReqVO, Page<BaseTemp> page) {
|
||||
return baseTempMapper.queryListPage(pageReqVO, page);
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
<?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.base.mapper.BaseTempMapper">
|
||||
|
||||
<resultMap type="BaseTemp" id="BaseTempResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="title" column="title" />
|
||||
<result property="file" column="file" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="tenantId" column="tenant_id" />
|
||||
<result property="creator" column="creator" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updater" column="updater" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectBaseTempVo">
|
||||
select id, title, file, remark, tenant_id, creator, create_time, updater, update_time, del_flag from dl_base_temp
|
||||
</sql>
|
||||
|
||||
<select id="queryListPage" parameterType="BaseTemp" resultMap="BaseTempResult">
|
||||
<include refid="selectBaseTempVo"/>
|
||||
<where>
|
||||
<if test="entity.title != null and entity.title != ''"> and title = #{entity.title}</if>
|
||||
<if test="entity.file != null and entity.file != ''"> and file = #{entity.file}</if>
|
||||
<if test="entity.remark != null and entity.remark != ''"> and remark = #{entity.remark}</if>
|
||||
<if test="entity.tenantId != null and entity.tenantId != ''"> and tenant_id = #{entity.tenantId}</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
44
dl_vue/src/api/base/temp.js
Normal file
44
dl_vue/src/api/base/temp.js
Normal file
@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询模板库列表
|
||||
export function listTemp(query) {
|
||||
return request({
|
||||
url: '/base/temp/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询模板库详细
|
||||
export function getTemp(id) {
|
||||
return request({
|
||||
url: '/base/temp/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增模板库
|
||||
export function addTemp(data) {
|
||||
return request({
|
||||
url: '/base/temp',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改模板库
|
||||
export function updateTemp(data) {
|
||||
return request({
|
||||
url: '/base/temp',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除模板库
|
||||
export function delTemp(id) {
|
||||
return request({
|
||||
url: '/base/temp/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
284
dl_vue/src/views/base/temp/index.vue
Normal file
284
dl_vue/src/views/base/temp/index.vue
Normal file
@ -0,0 +1,284 @@
|
||||
<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="title">
|
||||
<el-input
|
||||
v-model="queryParams.title"
|
||||
placeholder="请输入标题"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="remark">
|
||||
<el-input
|
||||
v-model="queryParams.remark"
|
||||
placeholder="请输入描述"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="站点唯一编码" prop="tenantId">
|
||||
<el-input
|
||||
v-model="queryParams.tenantId"
|
||||
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="['base:temp: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="['base:temp: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="['base:temp: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="['base:temp:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="tempList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="主键" align="center" prop="id" />
|
||||
<el-table-column label="标题" align="center" prop="title" />
|
||||
<el-table-column label="图片" align="center" prop="file" />
|
||||
<el-table-column label="描述" align="center" prop="remark" />
|
||||
<el-table-column label="站点唯一编码" 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="['base:temp:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['base:temp: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="title">
|
||||
<el-input v-model="form.title" placeholder="请输入标题" />
|
||||
</el-form-item>
|
||||
<el-form-item label="图片" prop="file">
|
||||
<file-upload v-model="form.file"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入描述" />
|
||||
</el-form-item>
|
||||
<el-form-item label="站点唯一编码" prop="tenantId">
|
||||
<el-input v-model="form.tenantId" 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 { listTemp, getTemp, delTemp, addTemp, updateTemp } from "@/api/base/temp";
|
||||
|
||||
export default {
|
||||
name: "Temp",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 模板库表格数据
|
||||
tempList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
title: null,
|
||||
file: null,
|
||||
remark: null,
|
||||
tenantId: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询模板库列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listTemp(this.queryParams).then(response => {
|
||||
this.tempList = response.data.records;
|
||||
this.total = response.data.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
title: null,
|
||||
file: null,
|
||||
remark: null,
|
||||
tenantId: null,
|
||||
creator: null,
|
||||
createTime: null,
|
||||
updater: null,
|
||||
updateTime: 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
|
||||
getTemp(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) {
|
||||
updateTemp(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addTemp(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 delTemp(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('base/temp/export', {
|
||||
...this.queryParams
|
||||
}, `temp_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user