Conflicts:
	code/backend/sql/digital_culture_heritage.sql
main
HZXhuang 2 years ago
commit 37210676a5

@ -3,75 +3,27 @@
Source Server : mysql
Source Server Type : MySQL
Source Server Version : 80025
Source Server Version : 80031
Source Host : localhost:3306
Source Schema : digital_culture_heritage
Target Server Type : MySQL
Target Server Version : 80025
Target Server Version : 80031
File Encoding : 65001
Date: 02/11/2023 14:10:26
Date: 02/11/2023 14:02:09
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for activity_promotion_apply
-- ----------------------------
DROP TABLE IF EXISTS `activity_promotion_apply`;
CREATE TABLE `activity_promotion_apply` (
`userId` int NOT NULL COMMENT '用户id',
`activityName` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '活动名',
`activityArea` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '活动地点',
`id` int NOT NULL AUTO_INCREMENT COMMENT 'id自增主键',
`activityTime` datetime NULL DEFAULT NULL COMMENT '活动时间',
`promotionalWebsite` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '活动宣传网址',
`activityIntroduction` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '活动介绍',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of activity_promotion_apply
-- ----------------------------
INSERT INTO `activity_promotion_apply` VALUES (1, '师大之星', '励德楼', 1, '2023-11-11 08:00:00', 'http://www.hunnu.edu.cn', '非常好');
-- ----------------------------
-- Table structure for city
-- ----------------------------
DROP TABLE IF EXISTS `city`;
CREATE TABLE `city` (
`cityId` int NOT NULL AUTO_INCREMENT COMMENT '城市主键ID自增长',
`cityName` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '城市名',
PRIMARY KEY (`cityId`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of city
-- ----------------------------
INSERT INTO `city` VALUES (1, '常德市');
INSERT INTO `city` VALUES (2, '郴州市');
INSERT INTO `city` VALUES (3, '衡阳市');
INSERT INTO `city` VALUES (4, '怀化市');
INSERT INTO `city` VALUES (5, '娄底市');
INSERT INTO `city` VALUES (6, '邵阳市');
INSERT INTO `city` VALUES (7, '湘潭市');
INSERT INTO `city` VALUES (8, '湘西土家族苗族自治州');
INSERT INTO `city` VALUES (9, '益阳市');
INSERT INTO `city` VALUES (10, '永州市');
INSERT INTO `city` VALUES (11, '岳阳市');
INSERT INTO `city` VALUES (12, '张家界市');
INSERT INTO `city` VALUES (13, '长沙市');
INSERT INTO `city` VALUES (14, '株洲市');
-- ----------------------------
-- Table structure for comment
-- ----------------------------
DROP TABLE IF EXISTS `comment`;
CREATE TABLE `comment` (
`commentId` int NOT NULL AUTO_INCREMENT COMMENT '评论id',
`cultureId` int UNSIGNED NOT NULL COMMENT '讨论的技艺类型',
`commentId` int(0) NOT NULL AUTO_INCREMENT COMMENT '评论id',
`cultureId` int(0) UNSIGNED NOT NULL COMMENT '讨论的技艺类型',
`releaseTime` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '评论时间',
`summary` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '评论摘要',
`picture` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '评论的图片',
@ -80,7 +32,7 @@ CREATE TABLE `comment` (
PRIMARY KEY (`commentId`) USING BTREE,
INDEX `cultureId`(`cultureId`) USING BTREE,
CONSTRAINT `comment_ibfk_1` FOREIGN KEY (`cultureId`) REFERENCES `culture` (`cultureId`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of comment
@ -95,12 +47,12 @@ INSERT INTO `comment` VALUES (4, 8, '2023年9月15日', '岳州扇是中国三
-- ----------------------------
DROP TABLE IF EXISTS `culture`;
CREATE TABLE `culture` (
`cultureId` int UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增编号',
`cultureId` int(0) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增编号',
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '非物质文化遗产名称',
`category` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '非物质文化遗产类别',
`kind` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '非物质文化遗产类型',
`cityId` int NULL DEFAULT NULL COMMENT '外键所属地级市ID',
`announcementTime` year NULL DEFAULT NULL COMMENT '公布时间',
`announcementTime` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '公布时间',
`productNumber` int NOT NULL COMMENT '国家非遗项目序号',
`declaringUnit` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '非遗申报单位',
`protectionUnit` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '非遗保护单位',
@ -178,18 +130,19 @@ CREATE TABLE `offlineexperience` (
`praiseNumber` int UNSIGNED NULL DEFAULT NULL COMMENT '点赞数',
`status` int UNSIGNED NULL DEFAULT 2 COMMENT '当前活动/店铺的状态1正常2待审批3已结束。默认待审批',
`detail` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '活动详情网址url',
`isPassed` tinyint(0) NULL DEFAULT NULL COMMENT '线下活动是否被管理员通过',
PRIMARY KEY (`activityId`) USING BTREE,
INDEX `cultureId`(`cultureId`) USING BTREE,
INDEX `contactId`(`contactId`) USING BTREE,
CONSTRAINT `offlineexperience_ibfk_1` FOREIGN KEY (`cultureId`) REFERENCES `culture` (`cultureId`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `offlineexperience_ibfk_2` FOREIGN KEY (`contactId`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of offlineexperience
-- ----------------------------
INSERT INTO `offlineexperience` VALUES (1, 2, 1, '体验古法蓝染制作', '染布公司', '800-17:00 ', '梅溪湖', '一块蓝染布,\r\n隐匿于扎染的千年时光\r\n闻得见诗经的味道。\r\n蓝白两色创造了一个淳朴自然、\r\n千变万化的艺术世界。', 'https://img.alicdn.com/imgextra/i2/363098991/TB2ryYDX91I.eBjy0FjXXabfXXa_!!363098991.jpg', 2, 1, '64 【推荐:长沙团建、姐妹趴、亲子研学活动 - 爱染布的文老师 | 小红书 - 标记我的生活】 😆 FflwxLmTOYrGrQe 😆 http://xhslink.com/mYuy4v');
INSERT INTO `offlineexperience` VALUES (2, 1, 1, '张家界-精美技艺土家锦和砂石画', '张家界旅游商品产业园', '周一至周五10:00-16:00', '张家界永定区沙堤街道旅游商品产业园', '土家织锦文化创意园和军声砂石画文创园', 'https://www.xilankapu.com/wp-content/uploads/2020/07/1594808389-6edd4c48c4ad65b-748x1024.jpg', 3, 2, 'https://www.xiaohongshu.com/explore/63ccefd2000000001b01687c');
INSERT INTO `offlineexperience` VALUES (1, 2, 1, '体验古法蓝染制作', '染布公司', '800-17:00 ', '梅溪湖', '一块蓝染布,\r\n隐匿于扎染的千年时光\r\n闻得见诗经的味道。\r\n蓝白两色创造了一个淳朴自然、\r\n千变万化的艺术世界。', 'https://img.alicdn.com/imgextra/i2/363098991/TB2ryYDX91I.eBjy0FjXXabfXXa_!!363098991.jpg', 2, 1, 'http://xhslink.com/mYuy4v', 1);
INSERT INTO `offlineexperience` VALUES (2, 1, 1, '张家界-精美技艺土家锦和砂石画', '张家界旅游商品产业园', '周一至周五10:00-16:00', '张家界永定区沙堤街道旅游商品产业园', '土家织锦文化创意园和军声砂石画文创园', 'https://www.xilankapu.com/wp-content/uploads/2020/07/1594808389-6edd4c48c4ad65b-748x1024.jpg', 3, 2, 'https://www.xiaohongshu.com/explore/63ccefd2000000001b01687c', 1);
-- ----------------------------
-- Table structure for user
@ -208,12 +161,13 @@ CREATE TABLE `user` (
`avatar` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用户的头像url',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `unique_user_u`(`username`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 77 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;
) ENGINE = InnoDB AUTO_INCREMENT = 77 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of user
-- ----------------------------
INSERT INTO `user` VALUES (1, 3, '张三', '过往烟云', 'e10adc3949ba59abbe56e057f20f883e', '湖南师范大学', '123456765@qq.com', '13135475865', NULL, '');
INSERT INTO `user` VALUES (1, 3, '张三', '过往烟云2', '', '湖南师范大学', '726354856@qq.com', '13135475865', NULL, '');
INSERT INTO `user` VALUES (2, 2, '李四', '雨纷纷', '123456', '湘西染布有限公司', '9995555123@qq.com', '13587946534', 30, NULL);
INSERT INTO `user` VALUES (77, 3, '王五', '过往烟云2', 'e10adc3949ba59abbe56e057f20f883e', '湖南师范大学', '123456765@qq.com', '13135475865', NULL, '');
SET FOREIGN_KEY_CHECKS = 1;

@ -0,0 +1,114 @@
package org.example.controller;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSON;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jakarta.servlet.http.HttpServletResponse;
import org.example.utils.Result;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.util.List;
@RestController
@RequestMapping("/files")
@Api(tags = "文件上传下载控制器")
public class FileController {
@Value("${server.port}")
private String port;
@Value("${file.ip}")
private String ip;
/**
*
* @param file
* @return
* @throws IOException
*/
@PostMapping("/upload")
@ApiOperation(value = "上传文件到本地接口")
public Result upload(MultipartFile file) throws IOException {
String originalFilename = file.getOriginalFilename(); // 获取源文件的名称
// 定义文件的唯一标识(前缀)
String flag = IdUtil.fastSimpleUUID();
String rootFilePath = System.getProperty("user.dir") + "/files/" + flag + "_" + originalFilename; // 获取上传的路径
int lastIndex = originalFilename.lastIndexOf(".");
if (lastIndex == -1) {
rootFilePath += ".jpg";
}
File rootFile = new File(rootFilePath);
if (!rootFile.getParentFile().exists()) {
rootFile.getParentFile().mkdirs();
}
FileUtil.writeBytes(file.getBytes(), rootFilePath); // 把文件写入到上传的路径
// return Result.success("http://" + ip + ":" + port + "/api/files/" + flag); // 返回结果 url
return Result.success("/api/files/get/" + flag); // 返回结果 url
}
/**
*
* @param file
* @return
* @throws IOException
*/
@PostMapping("/editor/upload")
@ApiOperation(value = "富文本文件上传接口")
public JSON editorUpload(MultipartFile file) throws IOException {
String originalFilename = file.getOriginalFilename(); // 获取源文件的名称
// 定义文件的唯一标识(前缀)
String flag = IdUtil.fastSimpleUUID();
String rootFilePath = System.getProperty("user.dir") + "/files/" + flag + "_" + originalFilename; // 获取上传的路径
File rootFile = new File(rootFilePath);
if (!rootFile.getParentFile().exists()) {
rootFile.getParentFile().mkdirs();
}
FileUtil.writeBytes(file.getBytes(), rootFilePath); // 把文件写入到上传的路径
String url = "http://" + ip + ":" + port + "/files/" + flag;
JSONObject json = new JSONObject();
json.set("errno", 0);
JSONArray arr = new JSONArray();
JSONObject data = new JSONObject();
arr.add(data);
data.set("url", url);
json.set("data", arr);
return json; // 返回结果 url
}
/**
*
* @param flag
* @param response
*/
@GetMapping("/get/{flag}")
@ApiOperation(value = "文件下载接口")
public void getFiles(@PathVariable String flag, HttpServletResponse response) {
OutputStream os; // 新建一个输出流对象
String basePath = System.getProperty("user.dir") + "/files/"; // 定于文件上传的根路径
List<String> fileNames = FileUtil.listFileNames(basePath); // 获取所有的文件名称
String fileName = fileNames.stream().filter(name -> name.contains(flag)).findAny().orElse(""); // 找到跟参数一致的文件
try {
if (StrUtil.isNotEmpty(fileName)) {
response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
response.setContentType("application/octet-stream");
byte[] bytes = FileUtil.readBytes(basePath + fileName); // 通过文件的路径读取文件字节流
os = response.getOutputStream(); // 通过输出流返回文件
os.write(bytes);
os.flush();
os.close();
}
} catch (Exception e) {
System.out.println("文件下载失败");
}
}
}

@ -1,12 +1,10 @@
package org.example.controller;
import org.example.pojo.OfflineActivity;
import org.example.service.OfflineActivityService;
import org.example.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
@RestController
public class OfflineActivityController {
@ -24,4 +22,9 @@ public class OfflineActivityController {
public Result getAllOfflineActivityByPage(@RequestParam("pageSize") Integer pageSize, @RequestParam("pageNumber") Integer pageNumber){
return offlineActivityService.getAllOfflineActivityByPage(pageSize,pageNumber);
}
@PostMapping("/activityPromotionApply")
public Result activityPromotionApply(@RequestBody OfflineActivity offlineActivity){
return offlineActivityService.activityPromotionApply(offlineActivity);
}
}

@ -2,7 +2,6 @@ package org.example.controller;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.example.pojo.ActivityPromotionApply;
import org.example.pojo.User;
import org.example.pojo.UserPassword;
import org.example.service.UserService;
@ -45,8 +44,4 @@ public class UserController {
}
@PostMapping("/activityPromotionApply")
public Result activityPromotionApply(@RequestBody ActivityPromotionApply activityPromotionApply){
return userService.activityPromotionApply(activityPromotionApply);
}
}

@ -1,12 +1,8 @@
package org.example.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.example.pojo.ActivityPromotionApply;
import org.example.pojo.User;
import java.util.List;
public interface UserMapper extends BaseMapper<User> {
int insertActivityPromotionApply(ActivityPromotionApply activityPromotionApply);
}

@ -1,56 +0,0 @@
package org.example.pojo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Builder;
import lombok.Data;
import java.util.Date;
@Data
@Builder
@TableName("activity_promotion_apply")
public class ActivityPromotionApply {
private Integer id;
@TableField("userId")
private Integer userId;
@TableField("activityName")
private String activityName;
@TableField("activityArea")
private String activityArea;
@TableField("activityTime")
private Date activityTime;
@TableField("promotionalWebsite")
private String promotionalWebsite;
@TableField("activityIntroduction")
private String activityIntroduction;
public Integer getId() {
return id;
}
public Integer getUserId() {
return userId;
}
public String getActivityName() {
return activityName;
}
public String getActivityArea() {
return activityArea;
}
public Date getActivityTime() {
return activityTime;
}
public String getPromotionalWebsite() {
return promotionalWebsite;
}
public String getActivityIntroduction() {
return activityIntroduction;
}
}

@ -29,4 +29,6 @@ public class OfflineActivity {
private Integer praiseNumber;
private Integer status;
private String detail;
@TableField("isPassed")
private Integer isPassed=0;
}

@ -1,9 +1,12 @@
package org.example.service;
import org.example.pojo.OfflineActivity;
import org.example.utils.Result;
public interface OfflineActivityService {
Result getAllOfflineActivity();
Result getAllOfflineActivityByPage(Integer pageSize, Integer pageNumber);
Result activityPromotionApply(OfflineActivity offlineActivity);
}

@ -1,6 +1,5 @@
package org.example.service;
import org.example.pojo.ActivityPromotionApply;
import org.example.pojo.User;
import org.example.pojo.UserPassword;
import org.example.utils.Result;
@ -14,5 +13,4 @@ public interface UserService {
Result rPassword(UserPassword userPassword);
Result activityPromotionApply(ActivityPromotionApply activityPromotionApply);
}

@ -2,6 +2,8 @@ package org.example.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.micrometer.common.util.StringUtils;
import org.example.common.ResponseStatusEnum;
import org.example.mapper.OfflineActivityMapper;
import org.example.pojo.OfflineActivity;
import org.example.service.OfflineActivityService;
@ -37,4 +39,17 @@ public class OfflineActivityServiceImpl implements OfflineActivityService {
map.put("totalPage",(page.getTotal()+page.getSize()-1)/page.getSize());
return Result.success(map);
}
@Override
public Result activityPromotionApply(OfflineActivity offlineActivity) {
if(StringUtils.isBlank(String.valueOf(offlineActivity.getContactId()))){
return Result.error(ResponseStatusEnum.USERNAME_EMPTY);
}
offlineActivity.setCultureId(1);
int rows = offlineActivityMapper.insert(offlineActivity);
if(rows>0){
return Result.success();
}
return Result.error(ResponseStatusEnum.ERROR);
}
}

@ -5,7 +5,6 @@ import io.micrometer.common.util.StringUtils;
import org.example.common.ResponseStatusEnum;
import org.example.exception.CustomException;
import org.example.mapper.UserMapper;
import org.example.pojo.ActivityPromotionApply;
import org.example.pojo.User;
import org.example.pojo.UserPassword;
import org.example.service.UserService;
@ -74,14 +73,6 @@ public class UserServiceImpl implements UserService {
return Result.error(ResponseStatusEnum.PASSWORD_ERROR);
}
@Override
public Result activityPromotionApply(ActivityPromotionApply activityPromotionApply) {
int rows = userMapper.insertActivityPromotionApply(activityPromotionApply);
if(rows >0){
return Result.success();
}
return Result.error(ResponseStatusEnum.ERROR);
}
public void validate(String username, String password) {
if (StringUtils.isBlank(username)) {
@ -113,25 +104,27 @@ public class UserServiceImpl implements UserService {
throw new CustomException(ResponseStatusEnum.UPDATE_PASSWORD_EMPTY);
}
}
public void validate(String username) {
if(StringUtils.isBlank(username)){
throw new CustomException(ResponseStatusEnum.NAME_EMPTY);
}
}
@Override
public Result update(User user) {
validate(user.getUsername(), user.getPassword());
validate(user.getUsername());
QueryWrapper<User> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("username",user.getUsername());
User user1 = userMapper.selectOne(queryWrapper);
if(user1==null){
return Result.error(ResponseStatusEnum.USER_ACCOUNT_NOT_EXIST);
}
if(user1.getPassword().equals(MD5Util.encrypt(user.getPassword()))){
user.setPassword(MD5Util.encrypt(user.getPassword()));
int count = userMapper.update(user,queryWrapper);
if(count>0){
return Result.success("0","修改个人信息成功");
}
return Result.error(ResponseStatusEnum.UPDATE_USER_INFO_FAILED);
int count = userMapper.update(user,queryWrapper);
if(count>0){
return Result.success("0","修改个人信息成功");
}
return Result.error(ResponseStatusEnum.USERNAME_PASSWORD_ERROR);
return Result.error(ResponseStatusEnum.ERROR);
}
}

@ -17,6 +17,8 @@ mybatis-plus:
db-config:
id-type: auto
configuration:
# 不开启驼峰转换
# <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>շ<EFBFBD>ת<EFBFBD><EFBFBD>
map-underscore-to-camel-case: false
file:
ip: 127.0.0.1

@ -12,9 +12,9 @@
</select>
<select id="searchAllPostTime" resultType="java.lang.String">
select announcementTime from culture
select DISTINCT announcementTime from culture
</select>
<select id="searchAllArea" resultType="java.lang.String">
select declaringUnit from culture
select DISTINCT declaringUnit from culture
</select>
</mapper>

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"https://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.example.mapper.UserMapper">
<insert id="insertActivityPromotionApply">
insert into activity_promotion_apply(id,userId,activityName,activityArea,activityTime,promotionalWebsite,activityIntroduction)
values(null,#{userId},#{activityName},#{activityArea},#{activityTime},#{promotionalWebsite},#{activityIntroduction})
</insert>
</mapper>

@ -2,7 +2,10 @@
* 分页组件
*/
<template>
<el-pagination class="page-box" @size-change="handleSizeChange" @current-change="handleCurrentChange" background :current-page="childMsg.currentPage" :page-sizes="[10, 20, 30, 40]" :page-size="childMsg.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="childMsg.total">
<el-pagination class="page-box" @size-change="handleSizeChange"
@current-change="handleCurrentChange" background :current-page="pageParam.currentPage"
:page-sizes="[10, 20, 30, 40]" :page-size="pageParam.pageSize" layout="total, sizes, prev, pager, next, jumper"
:total="childMsg.total">
</el-pagination>
</template>
<script>
@ -12,10 +15,10 @@ export default {
props: ['childMsg'],
data() {
return {
pageparm: {
currentPage: this.childMsg.currentPage,
pageParam: {
pageNumber: this.childMsg.currentPage,
pageSize: this.childMsg.pageSize
}
},
}
},
created() {},
@ -26,8 +29,9 @@ export default {
* 参数1 父元素方法
* 参数2 数据
*/
this.pageparm.pageSize = val
this.$emit('callFather', this.pageparm)
this.pageParam.pageNumber=1
this.pageParam.pageSize=val
this.$emit('callFather', this.pageParam)
},
handleCurrentChange(val) {
/**
@ -35,8 +39,8 @@ export default {
* 参数1 父元素方法
* 参数2 数据
*/
this.pageparm.currentPage = val
this.$emit('callFather', this.pageparm)
this.pageParam.pageNumber=val
this.$emit('callFather', this.pageParam)
}
}
}

@ -3,16 +3,16 @@
<div style="margin-bottom: 20px">
<el-select style="width: 150px; margin-right: 10px" v-model="search_data.area" placeholder="请选择地区">
<el-option
v-for="item in options.area"
:key="item"
v-for="(item,index) in options.area"
:key="index"
:label="item"
:value="item">
</el-option>
</el-select>
<el-select style="width: 180px; margin-right: 10px" v-model="search_data.postTime" placeholder="请选择公布时间">
<el-option
v-for="item in options.postTime"
:key="item"
v-for="(item,index) in options.postTime"
:key="index"
:label="item"
:value="item">
</el-option>
@ -31,23 +31,23 @@
border element-loading-text="拼命加载中"
style="width: 100%; font-size: 14px; ">
<el-table-column sortable prop="cultureId" label="ID" width="80">
<el-table-column sortable prop="cultureId" label="ID" width="80" >
</el-table-column>
<el-table-column prop="name" label="名称" width="150">
<el-table-column prop="name" label="名称" width="150" >
</el-table-column>
<el-table-column prop="category" label="类别" width="150">
<el-table-column prop="category" label="类别" width="150" >
</el-table-column>
<el-table-column prop="kind" label="类型" width="140">
<el-table-column prop="kind" label="类型" width="140" >
</el-table-column>
<el-table-column sortable prop="announcementTime" label="公布时间" width="100">
<el-table-column sortable prop="announcementTime" label="公布时间" width="100" >
</el-table-column>
<el-table-column prop="declaringUnit" label="申报地区或单位" >
</el-table-column>
<el-table-column prop="protectionUnit" label="保护单位" >
<el-table-column prop="protectionUnit" label="保护单位" >
</el-table-column>
</el-table>
<!-- 分页组件 -->
<Pagination v-bind:child-msg="pageparm" @callFather="callFather"></Pagination>
<Pagination v-bind:child-msg="pageParam" @callFather="callFather"></Pagination>
</div>
</template>
@ -71,12 +71,17 @@ export default {
pageSize: 10,
//total: 10
},
pageParam:{
currentPage:1,
pageSize:10,
total:10
},
search_data: {
area:null,
postTime:null,
name: null,
pageSize:'5',
pageNumber:'1'
pageSize:10,
pageNumber:1
},
list_data: [
{
@ -136,21 +141,18 @@ export default {
}
},
mounted(){
getAllHeritageByPage(this.searchParam).then(res=>{
console.log(res.data)
if(res.code === '0'){
this.list_data=res.data.records;
this.options.postTime=res.data.postTimeList;
this.options.area=res.data.areaList;
}
})
this.getAllHeritagePaged(this.searchParam)
},
methods: {
//
callFather(parm) {
this.search_data.pageNum = parm.currentPage
this.search_data.pageSize = parm.pageSize
callFather(param) {
// this.search_data.area=null;
// this.search_data.postTime=null;
// this.search_data.name=null;
// this.getAllHeritagePaged(param)
this.search_data.pageSize = param.pageSize;
this.search_data.pageNumber = param.pageNumber;
this.searchCultureHeritage();
},
searchCultureHeritage(){
console.log(this.search_data.postTime)
@ -158,6 +160,20 @@ export default {
console.log(res.data)
if(res.code === '0'){
this.list_data=res.data.records;
this.pageParam.total=res.data.total
}
})
},
getAllHeritagePaged(param){
getAllHeritageByPage(param).then(res=>{
console.log(res.data)
if(res.code === '0'){
this.list_data=res.data.records;
this.options.postTime=res.data.postTimeList;
this.options.area=res.data.areaList;
this.pageParam.currentPage=res.data.current;
this.pageParam.pageSize=res.data.size;
this.pageParam.total=res.data.total
}
})
}

@ -103,6 +103,7 @@ export default {
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();

Loading…
Cancel
Save