本地yaml配置
server:port: 9638devtools:restart:enabled: true #设置开启热部署additional-paths: src/main/java/com/example/demo3 #重启目录exclude: WEB-INF/**thymeleaf:cache: false #使用Thymeleaf模板引擎,关闭缓存server-header:
mybatis:mapper-locations: classpath:mybatis/mapper/*.xmltype-aliases-package: com.example.demo.entry.pojo
mybatis-plus:mapper-locations: classpath:mapper/*.xmlconfiguration:map-underscore-to-camel-case: false
spring:application:name: exam-provider-basicdatasource:driver-class-name: com.mysql.cj.jdbc.Driverusername: rootpassword: 123456# url: jdbc:mysql://localhost:3306/best?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true# url: jdbc:mysql:150.158.136.15//116.62.47.169:11955/huanbao?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=trueurl: jdbc:mysql://127.0.0.1:3306/yu?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=trueservlet:multipart:max-request-size: 500MBmax-file-size: 100MB# knife4启动部署策略防止启动报错mvc:pathmatch:matching-strategy: ant_path_matcher
files:upload:
# path: /home/huanbao/images/path: C:/Users/l/Desktop/photo/upload/
sql文件
/*Navicat Premium Data TransferSource Server : nnSource Server Type : MySQLSource Server Version : 80016 (8.0.16)Source Host : localhost:3306Source Schema : yuTarget Server Type : MySQLTarget Server Version : 80016 (8.0.16)File Encoding : 65001Date: 30/11/2024 15:01:09
*/SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;-- ----------------------------
-- Table structure for chuyulaji
-- ----------------------------
DROP TABLE IF EXISTS `chuyulaji`;
CREATE TABLE `chuyulaji` (`id` int(11) NOT NULL,`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '名字',PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;-- ----------------------------
-- Records of chuyulaji
-- ------------------------------ ----------------------------
-- Table structure for document
-- ----------------------------
DROP TABLE IF EXISTS `document`;
CREATE TABLE `document` (`id` int(20) NOT NULL AUTO_INCREMENT,`openid` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,`wenzhangname` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,`coin` int(11) NOT NULL DEFAULT 2,`time` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,PRIMARY KEY (`id`) USING BTREE,UNIQUE INDEX `document_id_uindex`(`id` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 78644061 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;-- ----------------------------
-- Records of document
-- ----------------------------
INSERT INTO `document` VALUES (16677383, '038pzv1m7FVTamTkYKYdaZ78gv0vWzPrhXUiECsaf3tYw0f', 'y', 2, '2024-03-25 15:56:09');
INSERT INTO `document` VALUES (17692053, '062pzv1m7FVTamTkYKYdaZ78ioTgvWzPwzdtv_FJWDUpts8', '1231231231231111111111111111111111111111', 2, '2024-03-25 16:04:51');
INSERT INTO `document` VALUES (19721610, '062pzv1m7FVTamTkYKYdaZ78ioTgvWzPwzdtv_FJWDUpts8', 'qweqweqweqweqew', 2, '2024-03-25 15:56:54');
INSERT INTO `document` VALUES (34211426, '015pzv1m7FVTamTkYKYdaZ78hvoye7mtTrRRaxTEYBgXXM3', '风险', 2, '2024-03-25 18:47:34');
INSERT INTO `document` VALUES (39719110, '038pzv1m7FVTamTkYKYdaZ78gv0vWzPrhXUiECsaf3tYw0f', '1', 2, '2024-03-25 15:08:35');
INSERT INTO `document` VALUES (40877447, '038pzv1m7FVTamTkYKYdaZ78gv0vWzPrhXUiECsaf3tYw0f', '1', 2, '2024-03-25 15:22:36');
INSERT INTO `document` VALUES (42437406, '038pzv1m7FVTamTkYKYdaZ78gv0vWzPrhXUiECsaf3tYw0f', '1', 2, '2024-03-25 15:20:23');
INSERT INTO `document` VALUES (69509827, '038pzv1m7FVTamTkYKYdaZ78gv0vWzPrhXUiECsaf3tYw0f', '1', 2, '2024-03-25 15:27:33');
INSERT INTO `document` VALUES (78644060, '099pzv1m7FVTamTkYKYdaZ78lsKEzjNo6IqmfZ0snKQMaI6', '永远永远', 2, '2024-03-25 19:58:52');-- ----------------------------
-- Table structure for errrorquestion
-- ----------------------------
DROP TABLE IF EXISTS `errrorquestion`;
CREATE TABLE `errrorquestion` (`erorid` int(11) NOT NULL COMMENT '随机生成的错题id',`openid` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'OpenId\n',`questionname` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '题目名字',`userAnswer` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户答案',`zhengquedaan` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '正确答案',`questionid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '错题题目id',UNIQUE INDEX `errrorquestion_erorid_uindex`(`erorid` ASC) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;-- ----------------------------
-- Records of errrorquestion
-- ------------------------------ ----------------------------
-- Table structure for goods
-- ----------------------------
DROP TABLE IF EXISTS `goods`;
CREATE TABLE `goods` (`id` int(20) NOT NULL AUTO_INCREMENT,`shopImage` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '商品图片',`goodTitle` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '商品标题',`column_4` int(11) NULL DEFAULT NULL,`shopJs` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '商品介绍',`shopCoin` int(11) NOT NULL COMMENT '所需积分',PRIMARY KEY (`id`) USING BTREE,UNIQUE INDEX `goods_id_uindex`(`id` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;-- ----------------------------
-- Records of goods
-- ------------------------------ ----------------------------
-- Table structure for items
-- ----------------------------
DROP TABLE IF EXISTS `items`;
CREATE TABLE `items` (`id` int(11) NOT NULL AUTO_INCREMENT,`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,`description` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL,PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;-- ----------------------------
-- Records of items
-- ------------------------------ ----------------------------
-- Table structure for kehuishou
-- ----------------------------
DROP TABLE IF EXISTS `kehuishou`;
CREATE TABLE `kehuishou` (`id` int(11) NOT NULL,`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '名字',PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;-- ----------------------------
-- Records of kehuishou
-- ------------------------------ ----------------------------
-- Table structure for ks
-- ----------------------------
DROP TABLE IF EXISTS `ks`;
CREATE TABLE `ks` (`paperid` int(20) NULL DEFAULT NULL COMMENT 'sj试卷id',`openid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'openid',`nowdate` datetime NULL DEFAULT NULL COMMENT '当前时间 ',`useranswer` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用户作答记录',`zhengquedaan` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '正确答案\n',`questionid` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,`fenshu` int(10) NULL DEFAULT NULL COMMENT '分数',`timumignzi` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '考试的题目名字'
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '考试' ROW_FORMAT = COMPACT;-- ----------------------------
-- Records of ks
-- ----------------------------
INSERT INTO `ks` VALUES (69439969, '062pzv1m7FVTamTkYKYdaZ78ioTgvWzPwzdtv_FJWDUpts8', '2024-03-20 10:04:51', '可回收垃圾,其他垃圾,其他垃圾,厨余垃圾,其他垃圾', '可回收垃圾,其他垃圾,其他垃圾,其他垃圾,厨余垃圾', '6,23,20,15,9', 3, '纸巾,塑料薄膜,布料碎片,纸屑,鱼鳞');
INSERT INTO `ks` VALUES (15913846, '062pzv1m7FVTamTkYKYdaZ78ioTgvWzPwzdtv_FJWDUpts8', '2024-03-20 10:09:26', '可回收垃圾,其他垃圾,厨余垃圾,有害垃圾,其他垃圾', '可回收垃圾,厨余垃圾,厨余垃圾,厨余垃圾,厨余垃圾', '3,13,12,14,5', 2, '塑料瓶,茶叶渣,香蕉皮,大蒜皮,菜叶');
INSERT INTO `ks` VALUES (9877581, '062pzv1m7FVTamTkYKYdaZ78ioTgvWzPwzdtv_FJWDUpts8', '2024-03-21 07:00:29', '其他垃圾,厨余垃圾,其他垃圾,可回收垃圾,厨余垃圾', '厨余垃圾,厨余垃圾,可回收垃圾,可回收垃圾,厨余垃圾', '8,12,3,6,4', 3, '剩饭剩菜,香蕉皮,塑料瓶,纸巾,苹果核');
INSERT INTO `ks` VALUES (43329237, '038pzv1m7FVTamTkYKYdaZ78gv0vWzPrhXUiECsaf3tYw0f', '2024-03-21 14:50:57', '厨余垃圾,厨余垃圾,可回收垃圾,可回收垃圾,可回收垃圾', '可回收垃圾,厨余垃圾,厨余垃圾,其他垃圾,其他垃圾', '3,1,4,20,22', 1, '塑料瓶,橙子皮,苹果核,布料碎片,猫砂');
INSERT INTO `ks` VALUES (4121673, '038pzv1m7FVTamTkYKYdaZ78gv0vWzPrhXUiECsaf3tYw0f', '2024-03-21 15:10:35', '厨余垃圾,厨余垃圾,可回收垃圾,可回收垃圾,可回收垃圾', '厨余垃圾,可回收垃圾,其他垃圾,可回收垃圾,其他垃圾', '5,3,19,11,18', 2, '菜叶,塑料瓶,化妆品,杂志,一次性餐具');
INSERT INTO `ks` VALUES (55440237, '038pzv1m7FVTamTkYKYdaZ78gv0vWzPrhXUiECsaf3tYw0f', '2024-03-23 04:55:11', '其他垃圾,厨余垃圾,有害垃圾,其他垃圾,可回收垃圾', '可回收垃圾,厨余垃圾,其他垃圾,其他垃圾,厨余垃圾', '3,1,23,16,12', 2, '塑料瓶,橙子皮,塑料薄膜,陶瓷碎片,香蕉皮');
INSERT INTO `ks` VALUES (73032352, '062pzv1m7FVTamTkYKYdaZ78ioTgvWzPwzdtv_FJWDUpts8', '2024-03-23 07:14:45', '其他垃圾,厨余垃圾,其他垃圾,其他垃圾,其他垃圾', '其他垃圾,厨余垃圾,厨余垃圾,可回收垃圾,其他垃圾', '23,7,1,2,15', 3, '塑料薄膜,鸡骨头,橙子皮,纸板箱,纸屑');
INSERT INTO `ks` VALUES (69168659, '038pzv1m7FVTamTkYKYdaZ78gv0vWzPrhXUiECsaf3tYw0f', '2024-03-25 07:21:28', '厨余垃圾,厨余垃圾,可回收垃圾,可回收垃圾,可回收垃圾', '可回收垃圾,厨余垃圾,有害垃圾,其他垃圾,厨余垃圾', '30,5,25,17,9', 1, '铁丝,菜叶,废水银温度计,碎玻璃,鱼鳞');
INSERT INTO `ks` VALUES (90187525, '038pzv1m7FVTamTkYKYdaZ78gv0vWzPrhXUiECsaf3tYw0f', '2024-03-25 07:25:07', '厨余垃圾,厨余垃圾,可回收垃圾,可回收垃圾,可回收垃圾', '厨余垃圾,其他垃圾,可回收垃圾,可回收垃圾,其他垃圾', '7,20,31,29,23', 3, '鸡骨头,布料碎片,信封,桌布,塑料薄膜');
INSERT INTO `ks` VALUES (15544065, '038pzv1m7FVTamTkYKYdaZ78gv0vWzPrhXUiECsaf3tYw0f', '2024-03-25 07:55:22', '厨余垃圾,有害垃圾,有害垃圾,厨余垃圾,其他垃圾', '可回收垃圾,可回收垃圾,有害垃圾,厨余垃圾,其他垃圾', '29,11,28,38,15', 3, '桌布,杂志,老鼠药,动物内脏,纸屑');
INSERT INTO `ks` VALUES (55909233, '015pzv1m7FVTamTkYKYdaZ78hvoye7mtTrRRaxTEYBgXXM3', '2024-03-25 10:45:36', '厨余垃圾,厨余垃圾,有害垃圾,可回收垃圾,有害垃圾', '厨余垃圾,其他垃圾,其他垃圾,可回收垃圾,其他垃圾', '40,18,19,2,23', 2, '蛋壳,一次性餐具,化妆品,纸板箱,塑料薄膜');
INSERT INTO `ks` VALUES (33676755, '099pzv1m7FVTamTkYKYdaZ78lsKEzjNo6IqmfZ0snKQMaI6', '2024-03-25 11:59:24', '有害垃圾,有害垃圾,有害垃圾,有害垃圾,有害垃圾', '其他垃圾,厨余垃圾,可回收垃圾,有害垃圾,厨余垃圾', '36,39,32,26,40', 1, '消毒剂,茶渣,广告单,废油漆,蛋壳');
INSERT INTO `ks` VALUES (20302666, '091pzv1m7FVTamTkYKYdaZ78u_aR5qYcoYmVepFDpXm-UMe', '2024-03-25 14:57:42', '其他垃圾,其他垃圾,其他垃圾,其他垃圾,其他垃圾', '其他垃圾,厨余垃圾,其他垃圾,可回收垃圾,有害垃圾', '21,5,22,11,25', 2, '泡沫板,菜叶,猫砂,杂志,废水银温度计');
INSERT INTO `ks` VALUES (5168503, '015pzv1m7FVTamTkYKYdaZ78hBFZnOzvW3_2B-uYNpCChsb', '2024-04-02 12:46:57', '厨余垃圾,可回收垃圾,厨余垃圾,厨余垃圾,可回收垃圾', '厨余垃圾,可回收垃圾,厨余垃圾,厨余垃圾,可回收垃圾', '5,3,7,14,2', 5, '菜叶,塑料瓶,鸡骨头,大蒜皮,纸板箱');
INSERT INTO `ks` VALUES (87236085, '015pzv1m7FVTamTkYKYdaZ78hBFZnOzvW3_2B-uYNpCChsb', '2024-04-02 12:47:19', '厨余垃圾,可回收垃圾,可回收垃圾,可回收垃圾,有害垃圾', '厨余垃圾,可回收垃圾,可回收垃圾,可回收垃圾,有害垃圾', '41,29,10,3,28', 5, '小鸡骨,桌布,易拉罐,塑料瓶,老鼠药');
INSERT INTO `ks` VALUES (84763647, '061pzv1m7FVTamTkYKYdaZ78hqg8LrYqnCkXEgn_kdnMCI7', '2024-04-18 10:43:37', '可回收垃圾,可回收垃圾,厨余垃圾,其他垃圾,其他垃圾', '可回收垃圾,其他垃圾,其他垃圾,其他垃圾,厨余垃圾', '30,34,17,21,9', 2, '铁丝,泡沫塑料,碎玻璃,泡沫板,鱼鳞');-- ----------------------------
-- Table structure for paper
-- ----------------------------
DROP TABLE IF EXISTS `paper`;
CREATE TABLE `paper` (`id` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,`questionname` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,`xuanxiangyi` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,`xuanxianger` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,`xuanxiangsan` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,`xuanxiangsi` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,`answer` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,`openid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,`coin` int(10) NULL DEFAULT NULL COMMENT '0',`pid` int(10) NULL DEFAULT NULL
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = COMPACT;-- ----------------------------
-- Records of paper
-- ------------------------------ ----------------------------
-- Table structure for qitalaji
-- ----------------------------
DROP TABLE IF EXISTS `qitalaji`;
CREATE TABLE `qitalaji` (`id` int(11) NOT NULL,`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '名字',PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;-- ----------------------------
-- Records of qitalaji
-- ------------------------------ ----------------------------
-- Table structure for question
-- ----------------------------
DROP TABLE IF EXISTS `question`;
CREATE TABLE `question` (`id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,`questionname` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,`xuanxiangyi` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '可回收垃圾' COMMENT '选项一',`xuanxianger` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '其他垃圾' COMMENT '选项二',`xuanxiangsi` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '有害垃圾' COMMENT '选项四',`xuanxiangsan` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '厨余垃圾' COMMENT '选项三',`zhengquedaan` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '可回收垃圾' COMMENT '答案',PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;-- ----------------------------
-- Records of question
-- ----------------------------
INSERT INTO `question` VALUES ('1', '橙子皮', '可回收垃圾', '其他垃圾', '有害垃圾', '厨余垃圾', '厨余垃圾');
INSERT INTO `question` VALUES ('10', '易拉罐', '可回收垃圾', '其他垃圾', '有害垃圾', '厨余垃圾', '可回收垃圾');
INSERT INTO `question` VALUES ('11', '杂志', '可回收垃圾', '其他垃圾', '有害垃圾', '厨余垃圾', '可回收垃圾');
INSERT INTO `question` VALUES ('12', '香蕉皮', '可回收垃圾', '其他垃圾', '有害垃圾', '厨余垃圾', '厨余垃圾');
INSERT INTO `question` VALUES ('13', '茶叶渣', '可回收垃圾', '其他垃圾', '有害垃圾', '厨余垃圾', '厨余垃圾');
INSERT INTO `question` VALUES ('14', '大蒜皮', '可回收垃圾', '其他垃圾', '有害垃圾', '厨余垃圾', '厨余垃圾');
INSERT INTO `question` VALUES ('15', '纸屑', '可回收垃圾', '其他垃圾', '有害垃圾', '厨余垃圾', '其他垃圾');
INSERT INTO `question` VALUES ('16', '陶瓷碎片', '可回收垃圾', '其他垃圾', '有害垃圾', '厨余垃圾', '其他垃圾');
INSERT INTO `question` VALUES ('17', '碎玻璃', '可回收垃圾', '其他垃圾', '有害垃圾', '厨余垃圾', '其他垃圾');
INSERT INTO `question` VALUES ('18', '一次性餐具', '可回收垃圾', '其他垃圾', '有害垃圾', '厨余垃圾', '其他垃圾');
INSERT INTO `question` VALUES ('19', '化妆品', '可回收垃圾', '其他垃圾', '有害垃圾', '厨余垃圾', '其他垃圾');
INSERT INTO `question` VALUES ('2', '纸板箱', '可回收垃圾', '其他垃圾', '有害垃圾', '厨余垃圾', '可回收垃圾');
INSERT INTO `question` VALUES ('20', '布料碎片', '可回收垃圾', '其他垃圾', '有害垃圾', '厨余垃圾', '其他垃圾');
INSERT INTO `question` VALUES ('21', '泡沫板', '可回收垃圾', '其他垃圾', '有害垃圾', '厨余垃圾', '其他垃圾');
INSERT INTO `question` VALUES ('22', '猫砂', '可回收垃圾', '其他垃圾', '有害垃圾', '厨余垃圾', '其他垃圾');
INSERT INTO `question` VALUES ('23', '塑料薄膜', '可回收垃圾', '其他垃圾', '有害垃圾', '厨余垃圾', '其他垃圾');
INSERT INTO `question` VALUES ('24', '废电池', '可回收垃圾', '其他垃圾', '有害垃圾', '厨余垃圾', '有害垃圾');
INSERT INTO `question` VALUES ('25', '废水银温度计', '可回收垃圾', '其他垃圾', '有害垃圾', '厨余垃圾', '有害垃圾');
INSERT INTO `question` VALUES ('26', '废油漆', '可回收垃圾', '其他垃圾', '有害垃圾', '厨余垃圾', '有害垃圾');
INSERT INTO `question` VALUES ('27', '废灯管', '可回收垃圾', '其他垃圾', '有害垃圾', '厨余垃圾', '有害垃圾');
INSERT INTO `question` VALUES ('28', '老鼠药', '可回收垃圾', '其他垃圾', '有害垃圾', '厨余垃圾', '有害垃圾');
INSERT INTO `question` VALUES ('29', '桌布', '可回收垃圾', '其他垃圾', '有害垃圾', '厨余垃圾', '可回收垃圾');
INSERT INTO `question` VALUES ('3', '塑料瓶', '可回收垃圾', '其他垃圾', '有害垃圾', '厨余垃圾', '可回收垃圾');
INSERT INTO `question` VALUES ('30', '铁丝', '可回收垃圾', '其他垃圾', '有害垃圾', '厨余垃圾', '可回收垃圾');
INSERT INTO `question` VALUES ('31', '信封', '可回收垃圾', '其他垃圾', '有害垃圾', '厨余垃圾', '可回收垃圾');
INSERT INTO `question` VALUES ('32', '广告单', '可回收垃圾', '其他垃圾', '有害垃圾', '厨余垃圾', '可回收垃圾');
INSERT INTO `question` VALUES ('33', '布料', '可回收垃圾', '其他垃圾', '有害垃圾', '厨余垃圾', '可回收垃圾');
INSERT INTO `question` VALUES ('34', '泡沫塑料', '可回收垃圾', '其他垃圾', '有害垃圾', '厨余垃圾', '其他垃圾');
INSERT INTO `question` VALUES ('35', '橡皮泥', '可回收垃圾', '其他垃圾', '有害垃圾', '厨余垃圾', '其他垃圾');
INSERT INTO `question` VALUES ('36', '消毒剂', '可回收垃圾', '其他垃圾', '有害垃圾', '厨余垃圾', '其他垃圾');
INSERT INTO `question` VALUES ('37', '废弃食用油', '可回收垃圾', '其他垃圾', '有害垃圾', '厨余垃圾', '厨余垃圾');
INSERT INTO `question` VALUES ('38', '动物内脏', '可回收垃圾', '其他垃圾', '有害垃圾', '厨余垃圾', '厨余垃圾');
INSERT INTO `question` VALUES ('39', '茶渣', '可回收垃圾', '其他垃圾', '有害垃圾', '厨余垃圾', '厨余垃圾');
INSERT INTO `question` VALUES ('4', '苹果核', '可回收垃圾', '其他垃圾', '有害垃圾', '厨余垃圾', '厨余垃圾');
INSERT INTO `question` VALUES ('40', '蛋壳', '可回收垃圾', '其他垃圾', '有害垃圾', '厨余垃圾', '厨余垃圾');
INSERT INTO `question` VALUES ('41', '小鸡骨', '可回收垃圾', '其他垃圾', '有害垃圾', '厨余垃圾', '厨余垃圾');
INSERT INTO `question` VALUES ('5', '菜叶', '可回收垃圾', '其他垃圾', '有害垃圾', '厨余垃圾', '厨余垃圾');
INSERT INTO `question` VALUES ('6', '纸巾', '可回收垃圾', '其他垃圾', '有害垃圾', '厨余垃圾', '可回收垃圾');
INSERT INTO `question` VALUES ('7', '鸡骨头', '可回收垃圾', '其他垃圾', '有害垃圾', '厨余垃圾', '厨余垃圾');
INSERT INTO `question` VALUES ('8', '剩饭剩菜', '可回收垃圾', '其他垃圾', '有害垃圾', '厨余垃圾', '厨余垃圾');
INSERT INTO `question` VALUES ('9', '鱼鳞', '可回收垃圾', '其他垃圾', '有害垃圾', '厨余垃圾', '厨余垃圾');-- ----------------------------
-- Table structure for rubbish
-- ----------------------------
DROP TABLE IF EXISTS `rubbish`;
CREATE TABLE `rubbish` (`id` int(11) NOT NULL COMMENT 'id',`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,`type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '垃圾总表' ROW_FORMAT = DYNAMIC;-- ----------------------------
-- Records of rubbish
-- ------------------------------ ----------------------------
-- Table structure for sj
-- ----------------------------
DROP TABLE IF EXISTS `sj`;
CREATE TABLE `sj` (`paper` int(11) NOT NULL COMMENT '试卷id',`openid` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,`nowdate` datetime NULL DEFAULT NULL COMMENT '当前时间\n\n',PRIMARY KEY (`paper`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '试卷' ROW_FORMAT = COMPACT;-- ----------------------------
-- Records of sj
-- ----------------------------
INSERT INTO `sj` VALUES (4121673, '038pzv1m7FVTamTkYKYdaZ78gv0vWzPrhXUiECsaf3tYw0f', '2024-03-21 15:10:34');
INSERT INTO `sj` VALUES (5168503, '015pzv1m7FVTamTkYKYdaZ78hBFZnOzvW3_2B-uYNpCChsb', '2024-04-02 12:46:57');
INSERT INTO `sj` VALUES (9877581, '062pzv1m7FVTamTkYKYdaZ78ioTgvWzPwzdtv_FJWDUpts8', '2024-03-21 07:00:29');
INSERT INTO `sj` VALUES (15043373, '1', '2024-03-20 16:06:26');
INSERT INTO `sj` VALUES (15544065, '038pzv1m7FVTamTkYKYdaZ78gv0vWzPrhXUiECsaf3tYw0f', '2024-03-25 07:55:22');
INSERT INTO `sj` VALUES (15913846, '062pzv1m7FVTamTkYKYdaZ78ioTgvWzPwzdtv_FJWDUpts8', '2024-03-20 10:09:26');
INSERT INTO `sj` VALUES (20302666, '091pzv1m7FVTamTkYKYdaZ78u_aR5qYcoYmVepFDpXm-UMe', '2024-03-25 14:57:42');
INSERT INTO `sj` VALUES (33676755, '099pzv1m7FVTamTkYKYdaZ78lsKEzjNo6IqmfZ0snKQMaI6', '2024-03-25 11:59:24');
INSERT INTO `sj` VALUES (43329237, '038pzv1m7FVTamTkYKYdaZ78gv0vWzPrhXUiECsaf3tYw0f', '2024-03-21 14:50:57');
INSERT INTO `sj` VALUES (48266426, '1', '2024-03-20 16:10:11');
INSERT INTO `sj` VALUES (55440237, '038pzv1m7FVTamTkYKYdaZ78gv0vWzPrhXUiECsaf3tYw0f', '2024-03-23 04:55:11');
INSERT INTO `sj` VALUES (55909233, '015pzv1m7FVTamTkYKYdaZ78hvoye7mtTrRRaxTEYBgXXM3', '2024-03-25 10:45:36');
INSERT INTO `sj` VALUES (69168659, '038pzv1m7FVTamTkYKYdaZ78gv0vWzPrhXUiECsaf3tYw0f', '2024-03-25 07:21:28');
INSERT INTO `sj` VALUES (69439969, '062pzv1m7FVTamTkYKYdaZ78ioTgvWzPwzdtv_FJWDUpts8', '2024-03-20 10:04:51');
INSERT INTO `sj` VALUES (73032352, '062pzv1m7FVTamTkYKYdaZ78ioTgvWzPwzdtv_FJWDUpts8', '2024-03-23 07:14:45');
INSERT INTO `sj` VALUES (84763647, '061pzv1m7FVTamTkYKYdaZ78hqg8LrYqnCkXEgn_kdnMCI7', '2024-04-18 10:43:37');
INSERT INTO `sj` VALUES (87236085, '015pzv1m7FVTamTkYKYdaZ78hBFZnOzvW3_2B-uYNpCChsb', '2024-04-02 12:47:19');
INSERT INTO `sj` VALUES (90187525, '038pzv1m7FVTamTkYKYdaZ78gv0vWzPrhXUiECsaf3tYw0f', '2024-03-25 07:25:07');
INSERT INTO `sj` VALUES (93957644, '091pzv1m7FVTamTkYKYdaZ78u_aR5qYcoYmVepFDpXm-UMe', '2024-03-19 03:02:37');-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (`id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'id',`userAccount` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '账号',`userPassword` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '密码',`unionId` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '微信开放平台id',`mpOpenId` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '公众号openId',`userName` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户昵称',`userAvatar` varchar(700) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户头像',`userProfile` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户简介',`userRole` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'user' COMMENT '用户角色:user/admin/ban',`createTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',`updateTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',`isDelete` tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否删除',`coin` int(11) NULL DEFAULT 0 COMMENT '积分'
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户' ROW_FORMAT = COMPACT;-- ----------------------------
-- Records of user
-- ----------------------------
INSERT INTO `user` VALUES ('39aff64f-ba2e-49dd-80f1-d3122db1d375', '12345678', '123456', '123456678', '096pzv1m7FVTamTkYKYdaZ78gQEpWLpbCXclR0sykUQgZof', NULL, NULL, '用户简介', 'user', '2024-03-19 19:02:28', '2024-03-19 19:02:28', 0, 0);
INSERT INTO `user` VALUES ('93d13808-4b16-4506-8c7b-dbc1272795c4', '12345678', '123456', '123456678', '096pzv1m7FVTamTkYKYdaZ78gQEpWLpbCXclR0sykUQgZof', NULL, NULL, '用户简介', 'user', '2024-03-19 19:02:28', '2024-03-19 19:02:28', 0, 0);
INSERT INTO `user` VALUES ('9281668a-615f-44cc-813f-8087454dbe7b', '12345678', '123456', '123456678', '062pzv1m7FVTamTkYKYdaZ78ioTgvWzPwzdtv_FJWDUpts8', 'xiaoIDE', 'https://tfs.alipayobjects.com/images/partner/ATyFkDTLhpEe4AAAAAAAAAAAAADtl2AA', '用户简介', 'user', '2024-03-20 18:03:37', '2024-03-25 16:04:51', 0, 15);
INSERT INTO `user` VALUES ('da3b02a3-5f3e-4483-a8c8-933cee47c7af', '12345678', '123456', '123456678', '015pzv1m7FVTamTkYKYdaZ78hBFZnOzvW3_2B-uYNpCChsb', '郝秋吉', 'https://tfs.alipayobjects.com/images/partner/ATJYdMQIytQOAAAAAAAAAAAAAADtl2AA', '用户简介', 'user', '2024-03-21 12:46:31', '2024-04-02 20:47:29', 0, 10);
INSERT INTO `user` VALUES ('2bf04c87-f6cc-4403-aede-d6576769f66e', '12345678', '123456', '123456678', '038pzv1m7FVTamTkYKYdaZ78gv0vWzPrhXUiECsaf3tYw0f', '马钰博', 'https://tfs.alipayobjects.com/images/partner/AT-ggAQo25zggAAAAAAAAAAAAADtl2AA', '用户简介', 'user', '2024-03-21 22:22:30', '2024-03-25 15:56:09', 0, 30);
INSERT INTO `user` VALUES ('99c40520-3178-4a7c-8d5d-2a549f9c2e0a', '12345678', '123456', '123456678', '097pzv1m7FVTamTkYKYdaZ78ogNvy3ouoEI61Dbv_5lCWoc', '测试', 'https://tfs.alipayobjects.com/images/partner/ATjhg5SYgsCEQAAAAAAAAAAAAADtl2AA', '用户简介', 'user', '2024-03-23 16:22:38', '2024-03-23 16:22:38', 0, 0);
INSERT INTO `user` VALUES ('ca9e3441-572f-4502-92d2-33e1235749c6', '12345678', '123456', '123456678', '028pzv1m7FVTamTkYKYdaZ78lT8ilGo9NyHKCoh-JVD9ns4', NULL, NULL, '用户简介', 'user', '2024-03-23 16:35:19', '2024-03-23 16:35:19', 0, 0);
INSERT INTO `user` VALUES ('5e97116f-61b2-446c-be1c-0cf3640778ce', '12345678', '123456', '123456678', '015pzv1m7FVTamTkYKYdaZ78hvoye7mtTrRRaxTEYBgXXM3', '林天云', 'https://tfs.alipayobjects.com/images/partner/ATWrMFTKG7fmUAAAAAAAAAAAAADtl2AA', '用户简介', 'user', '2024-03-25 18:44:10', '2024-03-25 18:47:34', 0, 4);
INSERT INTO `user` VALUES ('d0825985-f693-4d22-b270-f3d00e4fb1a5', '12345678', '123456', '123456678', '099pzv1m7FVTamTkYKYdaZ78lsKEzjNo6IqmfZ0snKQMaI6', '小程序审核', 'https://tfs.alipayobjects.com/images/partner/ATsxhST55kinkAAAAAAAAAAAAADtl2AA', '用户简介', 'user', '2024-03-25 19:58:14', '2024-03-25 19:59:29', 0, 3);
INSERT INTO `user` VALUES ('73e1af4e-80ee-41a5-8023-d20c71aeed3f', '12345678', '123456', '123456678', '000pzv1m7FVTamTkYKYdaZ78mBRk3-wjQkQjGJE1_ZejLI9', 'ο▬▬▬◙▅▅▆▆▇▇◤40米', 'https://tfs.alipayobjects.com/images/partner/TB1KHeRb7RDDuNkUvNmXXXSypXa', '用户简介', 'user', '2024-03-25 20:10:24', '2024-03-25 20:10:24', 0, 0);
INSERT INTO `user` VALUES ('402816ca-884f-4c82-a145-54a1d2de1ebe', '12345678', '123456', '123456678', '072pzv1m7FVTamTkYKYdaZ78oWZohk6acmB9BoGS_xnnWs8', 'Yang', 'https://tfs.alipayobjects.com/images/partner/T1AiJkXbdeXXXXXXXX', '用户简介', 'user', '2024-03-25 20:15:25', '2024-03-25 20:15:25', 0, 0);
INSERT INTO `user` VALUES ('5f820f69-20d7-409c-b4dd-02302e3f5479', '12345678', '123456', '123456678', '007pzv1m7FVTamTkYKYdaZ78ifFKTxywQRNdIZEdskp2HM8', NULL, NULL, '用户简介', 'user', '2024-04-07 10:12:02', '2024-04-07 10:12:02', 0, 0);
INSERT INTO `user` VALUES ('28b0ef35-07a5-490d-b548-a1b44b6f35ab', '12345678', '123456', '123456678', '097pzv1m7FVTamTkYKYdaZ78u6oLfxeHF3Z7_HGRd_HosU6', NULL, 'https://tfs.alipayobjects.com/images/partner/TB1PGMgbKxFDuNjm2EuXXaJ6pXa', '用户简介', 'user', '2024-04-07 10:29:19', '2024-04-07 10:29:19', 0, 0);
INSERT INTO `user` VALUES ('935f2c59-1ce5-44ec-8f7a-926d8ddf1184', '12345678', '123456', '123456678', '099pzv1m7FVTamTkYKYdaZ78lM0hRLIUyDvLQMsmiD-nOw3', '伟', 'https://tfs.alipayobjects.com/images/partner/T15_ReXkRoXXXXXXXX', '用户简介', 'user', '2024-04-12 19:24:34', '2024-04-12 19:24:34', 0, 0);
INSERT INTO `user` VALUES ('9586e167-94b4-4b52-83b4-5339233a3eac', '12345678', '123456', '123456678', '036pzv1m7FVTamTkYKYdaZ78romfPKRB04qwy59jyUbEgk9', NULL, NULL, '用户简介', 'user', '2024-04-17 19:14:14', '2024-04-17 19:14:14', 0, 0);
INSERT INTO `user` VALUES ('8a9610e9-32c7-40f1-9c90-ba1f6b76e019', '12345678', '123456', '123456678', '038pzv1m7FVTamTkYKYdaZ78gL2ZkFKShEkSbYwRD3F8j0e', NULL, 'https://tfs.alipayobjects.com/images/partner/T1ZXVfXcJkXXXXXXXX', '用户简介', 'user', '2024-04-18 14:37:30', '2024-04-18 14:37:30', 0, 0);
INSERT INTO `user` VALUES ('94ed1de1-e6d4-4b32-9fb6-c07274b8ada7', '12345678', '123456', '123456678', '061pzv1m7FVTamTkYKYdaZ78hqg8LrYqnCkXEgn_kdnMCI7', 'Sophie', 'https://tfs.alipayobjects.com/images/partner/TB1ZcQrc1dFDuNkUvLNXXXMFXXa', '用户简介', 'user', '2024-04-18 18:43:07', '2024-04-18 18:43:47', 0, 2);
INSERT INTO `user` VALUES ('3e6878da-c392-497e-b639-46f1c5cea5c5', '12345678', '123456', '123456678', '095pzv1m7FVTamTkYKYdaZ78mxq6mxgT1ymenpvm-DjDok5', '英鑫', 'https://tfs.alipayobjects.com/images/partner/T1A8heXotjXXXXXXXX', '用户简介', 'user', '2024-04-19 20:48:49', '2024-04-19 20:48:49', 0, 0);
INSERT INTO `user` VALUES ('69a826f3-475b-4a36-bc6e-36ad7f55cd15', '12345678', '123456', '123456678', '066pzv1m7FVTamTkYKYdaZ78r3TtNvI1jbT6TdG6Hp_J783', NULL, 'https://tfs.alipayobjects.com/images/partner/AT08hwRbJeOpEAAAAAAAAAAAAADtl2AA', '用户简介', 'user', '2024-04-29 11:03:42', '2024-04-29 11:03:42', 0, 0);
INSERT INTO `user` VALUES ('1786315482182139905', 'baiqier', '1234567', NULL, NULL, '测', '无', NULL, 'admin', '2024-05-03 16:42:53', '2024-05-08 14:39:19', 0, 0);
INSERT INTO `user` VALUES ('1786415995846352897', 'luyou', '12345678', NULL, NULL, NULL, NULL, NULL, 'user', '2024-05-03 23:22:18', '2024-05-03 23:22:18', 0, 0);
INSERT INTO `user` VALUES ('1805620925128105986', '11111111111', 'f50bc72cecfa64b96cc36137d0e3c95a', NULL, NULL, NULL, NULL, NULL, 'user', '2024-06-25 23:15:50', '2024-06-25 23:15:50', 0, 0);
INSERT INTO `user` VALUES ('1805621027066470401', '111111111', '7375746f30d54c526cf3c514b314c2e5', NULL, NULL, NULL, NULL, NULL, 'user', '2024-06-25 23:16:14', '2024-06-25 23:16:14', 0, 0);-- ----------------------------
-- Table structure for userlogs
-- ----------------------------
DROP TABLE IF EXISTS `userlogs`;
CREATE TABLE `userlogs` (`id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,`userlogin` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,`userName` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,`loginTime` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;-- ----------------------------
-- Records of userlogs
-- ----------------------------
INSERT INTO `userlogs` VALUES ('0e8d5eae2a9845c6893520ed58b954ba', 'baiqier', '测', '2024-05-03 23:20:05');
INSERT INTO `userlogs` VALUES ('147ee733e3f740e19af0c32f53e62e7f', 'baiqier', '测', '2024-05-03 23:27:12');
INSERT INTO `userlogs` VALUES ('183a12a332e64169a15aba99e6f0e138', 'baiqier', '测', '2024-05-03 23:27:00');
INSERT INTO `userlogs` VALUES ('194d82b6cfba4d44a3aa0980ad3f7464', 'user', '测', '1714728569228');
INSERT INTO `userlogs` VALUES ('1c4ba57fd8c34e4686ea908633b5a2b4', 'baiqier', '测', '2024-05-03 23:27:12');
INSERT INTO `userlogs` VALUES ('24a6c2733889487586730953d62e9708', 'baiqier', '测', '2024-05-04 00:02:34');
INSERT INTO `userlogs` VALUES ('2c54f240a4b847bbacd2abdf9cc93fd6', 'baiqier', '测', '2024-05-03 23:52:10');
INSERT INTO `userlogs` VALUES ('2e7f2358add64f05be66484af0c75a4f', 'baiqier', '测', '2024-05-03 23:27:12');
INSERT INTO `userlogs` VALUES ('2e8d7006abf24ee5b3a88c299494efc0', 'baiqier', '测', '2024-05-08 16:03:47');
INSERT INTO `userlogs` VALUES ('2f978375010545e1b2624e2ac9388a9e', 'baiqier', '测', '2024-05-08 16:04:47');
INSERT INTO `userlogs` VALUES ('322d1fb261be4e668e4c4aed000f3afe', 'baiqier', '测', '2024-05-03 17:33:24');
INSERT INTO `userlogs` VALUES ('37fee90f32bc4b79bf2d60475f2638df', 'luyou', NULL, '2024-05-08 16:04:21');
INSERT INTO `userlogs` VALUES ('3d7dda70077e4415baf00e31a2071804', 'baiqier', '测', '2024-05-03 23:26:58');
INSERT INTO `userlogs` VALUES ('444fcba6f240491b801f37f5ca916006', 'baiqier', '测', '2024-05-08 17:16:30');
INSERT INTO `userlogs` VALUES ('4ea54fe73cba4980b58bc7a71b892942', 'baiqier', '测', '2024-05-03 23:49:31');
INSERT INTO `userlogs` VALUES ('54a8cc1078214ed8857e695dd67c6831', 'baiqier', '测', '2024-05-03 23:27:12');
INSERT INTO `userlogs` VALUES ('553af491fb1542c4af186593c203e1f7', 'baiqier', '测', '2024-05-08 15:10:26');
INSERT INTO `userlogs` VALUES ('5c61f283543d4c3798739445ada63496', 'baiqier', '测', '2024-05-03 23:20:05');
INSERT INTO `userlogs` VALUES ('60b0bd7b8b304eb99adcc8ff9d9f99eb', 'baiqier', '测', '2024-05-03 23:43:36');
INSERT INTO `userlogs` VALUES ('6e9a5789214d4c29b587e12eea5393b9', 'baiqier', '测', '2024-05-08 14:28:00');
INSERT INTO `userlogs` VALUES ('70c218327c2143beacfc680d287b9e01', 'baiqier', '测', '2024-05-03 23:38:58');
INSERT INTO `userlogs` VALUES ('72196d607d5b433b89769998e64afd82', 'baiqier', '测', '2024-05-04 00:03:09');
INSERT INTO `userlogs` VALUES ('786ca97237ff444e8324159c766a78e7', 'baiqier', '测', '2024-05-08 14:25:58');
INSERT INTO `userlogs` VALUES ('83d1c1d1e5f646ca87ed1f70e292853b', 'baiqier', '测', '2024-05-03 23:27:13');
INSERT INTO `userlogs` VALUES ('96c78b3b1c7445d287fe8886de494040', 'baiqier', '测', '2024-05-08 15:09:57');
INSERT INTO `userlogs` VALUES ('9b4e9af3a88040a88c9323ecd65e0728', 'baiqier', '测', '2024-05-08 17:24:46');
INSERT INTO `userlogs` VALUES ('ad9b15e3ce074d8682c7843ecc3c9590', 'baiqier', '测', '2024-05-03 23:27:00');
INSERT INTO `userlogs` VALUES ('b4f3c4c55ffb4291957de3b536941520', 'baiqier', '测', '2024-05-08 17:23:44');
INSERT INTO `userlogs` VALUES ('b5f5005715894d77bbb9410a802aec6b', 'baiqier', '测', '2024-05-03 23:20:05');
INSERT INTO `userlogs` VALUES ('c0bcb5937373477d8794f45463dd6393', 'baiqier', '测', '2024-05-08 17:24:14');
INSERT INTO `userlogs` VALUES ('c0fedac4e3824632ab9ab23500e3184c', 'baiqier', '测', '2024-05-03 23:20:01');
INSERT INTO `userlogs` VALUES ('c4c97250840c4f8388c3d0d64ed44bb8', 'baiqier', '测', '2024-05-03 23:20:05');
INSERT INTO `userlogs` VALUES ('c56cd28db43747238142ce9b85111bf3', 'baiqier', '测', '2024-05-08 15:13:03');
INSERT INTO `userlogs` VALUES ('c740b4821e5945a78682d427131acf88', 'baiqier', '测', '2024-05-07 11:34:15');
INSERT INTO `userlogs` VALUES ('e2188162c35a41c2989d08662125c594', 'baiqier', '测', '2024-05-03 23:27:12');-- ----------------------------
-- Table structure for wenzhang
-- ----------------------------
DROP TABLE IF EXISTS `wenzhang`;
CREATE TABLE `wenzhang` (`id` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,`title` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '标题',`content` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '内容',`tags` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '标签列表',`thumbNum` int(11) NOT NULL DEFAULT 0 COMMENT '点赞数',`favourNum` int(11) NOT NULL DEFAULT 0 COMMENT '收藏数',`userId` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '创建用户 id',`createTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',`updateTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',`image` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,`mpOpenId` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;-- ----------------------------
-- Records of wenzhang
-- ----------------------------
INSERT INTO `wenzhang` VALUES ('116571760', '保护环境,人人有责', '我们可以从日常生活的点滴做起,比如使用环保购物袋代替塑料袋,选择公共交通工具而非私家车,节约用水用电,分类垃圾,支持和使用可再生能源。此外,我们还可以通过教育和宣传,提高自己和他人的环保意识。\n让我们行动起来,为了我们和后代子孙的美好未来,共同守护我们的蓝色星球。只有每个人都参与', NULL, 0, 0, '马钰博', '2024-03-23 13:01:20', '2024-03-23 13:01:20', 'https://cksys.xuande.work:9638/photo/90cb716ee60a42d5879a6c790fe49986.png', '038pzv1m7FVTamTkYKYdaZ78gv0vWzPrhXUiECsaf3tYw0f');
INSERT INTO `wenzhang` VALUES ('168580243', 'aksdhaksdhaksjdh1233', 'hahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahaahahahahahahahahahahahhaahhaahhaahahahahahahahahahahahahahahahhahaahah', NULL, 0, 0, 'xiaoIDE', '2024-03-21 16:36:41', '2024-03-23 06:12:22', 'https://cksys.xuande.work:9638/photo/278044a5cdae42f5bf991bd5cbf03456.jpg', '062pzv1m7FVTamTkYKYdaZ78ioTgvWzPwzdtv_FJWDUpts8');
INSERT INTO `wenzhang` VALUES ('248443029', '垃圾垃圾垃圾', '杂修杂修杂修杂修杂修杂修杂修杂修杂修杂修杂修杂修杂修杂修杂修杂修杂修杂修杂修杂修杂修杂修杂修杂修杂修杂修杂修杂修杂修杂修杂修杂修杂修杂修杂修杂修杂修杂修杂修杂修杂修杂修杂修杂修杂修', NULL, 0, 0, 'xiaoIDE', '2024-03-21 15:54:59', '2024-03-21 15:54:59', 'https://cksys.xuande.work:9638/photo/1f9a3102e1bb4632a4c205ef0afa0229.jpg', '062pzv1m7FVTamTkYKYdaZ78ioTgvWzPwzdtv_FJWDUpts8');
INSERT INTO `wenzhang` VALUES ('347929185', '绿色生活', '我们可以从日常生活的点滴做起,比如使用环保购物袋代替塑料袋,选择公共交通工具而非私家车,节约用水用电,分类垃圾,支持和使用可再生能源。此外,我们还可以通过教育和宣传,提高自己和他人的环保意识。', NULL, 0, 0, '马钰博', '2024-03-23 13:06:02', '2024-03-23 13:06:02', 'https://cksys.xuande.work:9638/photo/037f22d5839e484fbb7e8657a0a8f5b9.jpg', '038pzv1m7FVTamTkYKYdaZ78gv0vWzPrhXUiECsaf3tYw0f');
INSERT INTO `wenzhang` VALUES ('412102686', 'aksdhaksdhaksjdh1', 'hahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahaahahahahahahahahahahahhaahhaahhaahahahahahahahahahahahahahahahhahaahah', NULL, 0, 0, 'xiaoIDE', '2024-03-21 17:05:57', '2024-03-21 17:05:57', 'https://cksys.xuande.work:9638/photo/278044a5cdae42f5bf991bd5cbf03456.jpg', '062pzv1m7FVTamTkYKYdaZ78ioTgvWzPwzdtv_FJWDUpts8');
INSERT INTO `wenzhang` VALUES ('468787179', '环境保护:共同的使命', '为了一个更加绿色、更加美丽的地球,共同努力。因为只有一个健康的环境,才能支撑起一个繁荣的社会和一个充满活力的地球。', NULL, 0, 0, '马钰博', '2024-03-23 13:04:09', '2024-03-25 11:44:32', 'https://cksys.xuande.work:9638/photo/aa1cfea94cd0448b809da686d1c5062a.png', '038pzv1m7FVTamTkYKYdaZ78gv0vWzPrhXUiECsaf3tYw0f');
INSERT INTO `wenzhang` VALUES ('624357619', '永远永远', '我以为', NULL, 0, 0, '小程序审核', '2024-03-25 19:58:53', '2024-03-25 19:58:53', 'https://cksys.xuande.work:9638/photo/e2db15c52e4e4338bf296c131c640daa.jpg', '099pzv1m7FVTamTkYKYdaZ78lsKEzjNo6IqmfZ0snKQMaI6');
INSERT INTO `wenzhang` VALUES ('646190828', '保护环境,从我做起', '我们生活的地球,正面临着前所未有的环境危机。空气污染、水资源短缺、生物多样性的丧失,这些问题都在提醒我们,环境保护刻不容缓。作为地球上的一份子,我们每个人都应该负起责任,为保护环境出一份力。\n', NULL, 0, 0, '马钰博', '2024-03-23 12:57:52', '2024-03-23 12:57:52', 'https://cksys.xuande.work:9638/photo/a8b13e1ea51c4433897c0265a2743c4a.png', '038pzv1m7FVTamTkYKYdaZ78gv0vWzPrhXUiECsaf3tYw0f');
INSERT INTO `wenzhang` VALUES ('799036919', 'qweqweqweqweqew', 'qweqasdasdasdasdasdsadadaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', NULL, 0, 0, 'xiaoIDE', '2024-03-25 15:56:55', '2024-03-25 15:56:55', 'https://cksys.xuande.work:9638/photo/82ec69a55cb34aa8bb02f2bd752e2f5d.jpg', '062pzv1m7FVTamTkYKYdaZ78ioTgvWzPwzdtv_FJWDUpts8');
INSERT INTO `wenzhang` VALUES ('827155916', '1231231231231111111111111111111111111111', '12312311111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111', NULL, 0, 0, 'xiaoIDE', '2024-03-25 16:04:52', '2024-03-25 16:04:52', 'https://cksys.xuande.work:9638/photo/8931cf53205d4b96944fc2bf9714e76a.jpg', '062pzv1m7FVTamTkYKYdaZ78ioTgvWzPwzdtv_FJWDUpts8');
INSERT INTO `wenzhang` VALUES ('831265540', '老弟', '123123123123', NULL, 0, 0, 'xiaoIDE', '2024-03-20 18:04:27', '2024-03-20 18:04:27', 'https://cksys.xuande.work:9638/photo/ebc8e31995094be7a7a0e1820c9e4063.jpg', '062pzv1m7FVTamTkYKYdaZ78ioTgvWzPwzdtv_FJWDUpts8');
INSERT INTO `wenzhang` VALUES ('931726238', '环境保护,从我做起', '让我们行动起来,为了我们和后代子孙的美好未来,共同守护我们的蓝色星球。只有每个人都参与进来,我们才能共创一个更加绿色、更加健康的地球家园。', NULL, 0, 0, '马钰博', '2024-03-23 13:04:55', '2024-03-23 13:04:55', 'https://cksys.xuande.work:9638/photo/2cf52f6a6114485a956b72f8171e2af7.png', '038pzv1m7FVTamTkYKYdaZ78gv0vWzPrhXUiECsaf3tYw0f');-- ----------------------------
-- Table structure for youhai
-- ----------------------------
DROP TABLE IF EXISTS `youhai`;
CREATE TABLE `youhai` (`id` int(11) NOT NULL,`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '名字',PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;-- ----------------------------
-- Records of youhai
-- ----------------------------
INSERT INTO `youhai` VALUES (55, '78');
INSERT INTO `youhai` VALUES (90, '九零');
INSERT INTO `youhai` VALUES (888, 'hhhh');-- ----------------------------
-- Procedure structure for CompareAnswers
-- ----------------------------
DROP PROCEDURE IF EXISTS `CompareAnswers`;
delimiter ;;
CREATE PROCEDURE `CompareAnswers`(IN user_openid VARCHAR(255))
BEGIN-- 定义变量DECLARE finished INTEGER DEFAULT 0;DECLARE qid VARCHAR(20);DECLARE uans VARCHAR(255);DECLARE cans VARCHAR(255);DECLARE cur CURSOR FORSELECT questionid, useranswer, zhengquedaan FROM ksWHERE openid = user_openid AND useranswer != zhengquedaan;DECLARE CONTINUE HANDLER FOR NOT FOUND SET finished = 1;-- 创建一个临时表来存储不匹配的questionidDROP TEMPORARY TABLE IF EXISTS TempQuestionIds;CREATE TEMPORARY TABLE TempQuestionIds (questionid VARCHAR(20));-- 打开游标OPEN cur;-- 循环获取每一行记录get_answers: LOOPFETCH cur INTO qid, uans, cans;IF finished = 1 THENLEAVE get_answers;END IF;-- 此处应编写比较逗号分隔字符串的逻辑-- 比如,使用自定义函数分割字符串并比较-- 例如:CALL CompareCommaSeparatedStrings(uans, cans, qid);END LOOP get_answers;-- 关闭游标CLOSE cur;-- 返回结果SELECT * FROM TempQuestionIds;-- 清除临时表DROP TEMPORARY TABLE IF EXISTS TempQuestionIds;
END
;;
delimiter ;SET FOREIGN_KEY_CHECKS = 1;
登录
根据code登录获取用户信息
package com.example.demo3.controller;import cn.hutool.core.lang.UUID;
import com.alibaba.fastjson2.JSON;
import com.alipay.api.AlipayApiException;
import com.alipay.api.AlipayClient;
import com.alipay.api.AlipayConfig;
import com.alipay.api.DefaultAlipayClient;
import com.alipay.api.request.AlipaySystemOauthTokenRequest;
import com.alipay.api.request.AlipayUserInfoShareRequest;
import com.alipay.api.response.AlipaySystemOauthTokenResponse;
import com.alipay.api.response.AlipayUserInfoShareResponse;import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.demo3.entry.pojo.User;
import com.example.demo3.mapper.UserMapper;
import com.example.demo3.util.Result;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
@Api(tags = "一步获取用户信息")
@RestController
@RequestMapping("/yibu")
public class yibuController {@ResourceUserMapper userMapper;private static final String URL = "https://openapi.alipay.com/gateway.do";private static final String APPID = "2021004129682309";private static final String PRIVATE_KEY = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCO5L5iTpA3wYaqYWD1quQS8MCc08DbY6uJjbL1RsDkN0Ib36yjmiEH3vy0p0420rOTwSIF3+Wcnvcf5mN8RyGekk3qzl8tCrcsuufnOrL3OthG0NONv2IvrnnFfLNxQ0gzgEVrPc2OREKQkTR0d0ETUbrg1CmGntsTpNAQyJxGx0h+nKcYhi5+W5wdgrdqyDqvs4N3puiG5vWt7ILxbI8Yh2l5m43YytCqxoSO6KUGVwXJCusvUUOPPYLyxMxPUhIinJ6fBkiAgX1RiggT0AIWljmfEQaiLjQgdXrrH1tM26Ud7VS6wMfnG4srynkUHAP9KxNz6ifkl8BuCAqT/JtNAgMBAAECggEBAI09pr2vIDgsbzq8VEWgLB5YoFqjqA5y31xwloKA9CrgP9UjaxavQ5TvIWRDtzjTXbNfhIy/+cqtCmIarR1rhdyiiqfcYxE3dUWeXZkeWUWsgZjF00ZZ9OhiknTVRN1gft6BHJzbEvJboFwbWvj/43AAKjMPIxiwrqUlFJByap492k6f0uZAbm+2S32LDXV902O/lg2KS2WatXM6+M+B7AieOEqa6IlwYrF0nzL6Efzf6E9u9H90LAmbtKiIVDGuBjqeuxUUzmZOJL74m0r6E+cVc+ScJ/PFTqMio+fCg5kk8t0MecxMwlNXUtsWWnIB2NhxaLmms+0if1Upi1HzauECgYEA8hvr/HYPoea1W3ToA6CpxJd51Bn0M04Q+FcgmfdsqwRhVmtKHUojmEqhrNlhZUep+qCVdXgaLOmXvjgGtfE7NIu+au9MPKXfIXPBcA0AWxJeGVdJuyBcaJouY84j1RN7vFHPYZKplxbCnQTFcG5AFurysLmXog0QQOa8ouyeQIUCgYEAlxeNWa4AVlkakmqGl1FiKGTjZ23aINo0DW5xaVQPeJvQ/o/kZPcG70YjoXiLpsx26+7IpcXp4drCEypxZuEoN/6N2F3hIfPeb3aeLVW8qv/VzpIZApQ+Ax46IcEMQFQIMGXYMAVKu5mkhHgZlOAoBTtf0y7LggVksiZSx/u5DikCgYEAk0vphu9NE3MJY1r8zTgyESkXNbOUnqIgMPbRHtspgeJoVetwa+FvRnghZMfcOYIgKBsK0yz+v9RePZxYeNkK7C0Y7HYqK7u+xNtoFIPUc5P5K/GvKenGTt1+27nOkxQHc8tSIEraYtG2FVGRzZVF6KuIe3xuhGjuOo4mtfi/TwECgYA9ZXWr1ngOnoCctKrifFCdx3lcwxfbN6/lMVbmjSEISpDfkIsnt/Xaby71Y22kJvvAHbTtIAJNI76vWRTh0GauckMjg+qDCHz/4DyggXF8Lx+rpFSDZsfYLoVCyBZ5YWw+dnQl91CJ8QIYTlFe3MOGdL0YrLBHsndbqRUEbLajGQKBgG9WiwI7Sk1lTBM8m8tQxN3lJfu01Zw6YwrkGglC2qcPjfTsYqggC7IESXTUmUdMt+LAoegj8/3q+dG8Mzk5ucX9diog7wvqF/IjTeicGD4cs1qd+bz8vlumZlQmBbEoGHK0ZJwgd14GGSkiYyBCuQLd4eAKktuBXHA39DQe3CtC";private static final String FORMAT = "JSON";private static final String CHARSET = "UTF-8";private static final String SIGN_TYPE = "RSA2";private static final String ALIPAY_PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlFnDyktBuKW3670lZvJi3ZGWNqNu0mqCvan90yf554u7eerk1g27SdqnfbnrgdMfziF0gMuf2NDNpjNhGkS7mft4LK2ZNzLG4Kgjg0SIoUXQC2BeNmwv0i0fF7zWuDqN3H1XwcdDJ4IZqi2MTQjOpYrzw7gfZqWc1LgSAJgtPRD0pD1Wa0s9vnsmLv01AU83CQvq0Ery4FNvcx91Z+LuYlQmxuh7j3lX5U/LIpwcwFRFoPxoTrg2wwYkgP+CFhU5XVKwSxAaHQur4FYJJaS48wsnDch2pqu5afpyBHItVSD6L2zyCLvYl4eg4mhqjxL+19GXp8xemIer25BUGmtyVQIDAQAB";@GetMapping("/getTokenAndUserInfo")public void getTokenAndUserInfo(@RequestParam("code") String code, HttpServletResponse httpServletResponse)throws IOException, AlipayApiException, ExecutionException, InterruptedException {httpServletResponse.setContentType("application/json; charset=UTF-8");PrintWriter out = httpServletResponse.getWriter();System.out.println(code);AlipayConfig alipayConfig = getAlipayConfig();AlipayClient alipayClient = new DefaultAlipayClient(alipayConfig);// Step 1: Get TokenCompletableFuture<String> tokenFuture = CompletableFuture.supplyAsync(() -> {try {AlipaySystemOauthTokenRequest tokenRequest = new AlipaySystemOauthTokenRequest();tokenRequest.setGrantType("authorization_code");tokenRequest.setCode(code);AlipaySystemOauthTokenResponse tokenResponse = alipayClient.execute(tokenRequest);if (tokenResponse.isSuccess()) {System.out.println("获取令牌调用成功");return tokenResponse.getAccessToken();} else {System.out.println("获取令牌调用失败: " + tokenResponse.getMsg());return null;}} catch (AlipayApiException e) {System.err.println("获取令牌调用异常: " + e.getErrMsg());return null;}});// Step 2: Get User InfoCompletableFuture<Map<String, String>> userInfoFuture = tokenFuture.thenApplyAsync(accessToken -> {Map<String, String> map = new HashMap<>();if (accessToken != null) {try {AlipayUserInfoShareRequest userInfoRequest = new AlipayUserInfoShareRequest();AlipayUserInfoShareResponse userInfoResponse = alipayClient.execute(userInfoRequest, accessToken);if (userInfoResponse.isSuccess()) {System.out.println("获取用户信息调用成功");QueryWrapper<User> queryWrapper = new QueryWrapper<>();queryWrapper.eq("mpOpenid", userInfoResponse.getOpenId());User user = userMapper.selectOne(queryWrapper);if (user == null) {User user1 = new User();user1.setId(String.valueOf(UUID.randomUUID()));user1.setUseraccount("12345678");user1.setUserpassword("123456");user1.setUnionid("123456678");user1.setUseravatar(userInfoResponse.getAvatar());user1.setUserprofile("用户简介");user1.setUserrole("user");TimeZone chinaTimeZone = TimeZone.getTimeZone("Asia/Shanghai");Date chinaCurrentTime = new Date();chinaCurrentTime.setTime(chinaCurrentTime.getTime() + chinaTimeZone.getRawOffset());user1.setCreatetime(chinaCurrentTime);user1.setUpdatetime(chinaCurrentTime);user1.setIsdelete(0);user1.setCoin(0);user1.setUsername(userInfoResponse.getNickName());user1.setMpopenid(userInfoResponse.getOpenId());userMapper.insertuser(user1);}map.put("openId", userInfoResponse.getOpenId());map.put("userName", userInfoResponse.getNickName());map.put("avatar", userInfoResponse.getAvatar());map.put("msg", "success");} else {System.out.println("获取用户信息调用失败: " + userInfoResponse.getMsg());map.put("msg", "failed");}} catch (AlipayApiException e) {System.err.println("获取用户信息调用异常: " + e.getErrMsg());map.put("msg", "failed");}} else {map.put("msg", "failed");}return map;});// Combine resultsMap<String, String> result = userInfoFuture.get();// Convert the result to JSON and send it to the clientString jsonStr = JSON.toJSONString(result);out.print(jsonStr);}private AlipayConfig getAlipayConfig() {AlipayConfig alipayConfig = new AlipayConfig();alipayConfig.setServerUrl(URL);alipayConfig.setAppId(APPID);alipayConfig.setPrivateKey(PRIVATE_KEY);alipayConfig.setFormat(FORMAT);alipayConfig.setCharset(CHARSET);alipayConfig.setSignType(SIGN_TYPE);alipayConfig.setAlipayPublicKey(ALIPAY_PUBLIC_KEY);return alipayConfig;}}
UserController
package com.example.demo3.controller;import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.demo3.common.BaseResponse;
import com.example.demo3.common.DeleteRequest;
import com.example.demo3.common.ErrorCode;
import com.example.demo3.common.ResultUtils;
import com.example.demo3.entry.dao.user.*;
import com.example.demo3.entry.pojo.Ks;
import com.example.demo3.entry.pojo.User;
import com.example.demo3.entry.pojo.Userlogs;
import com.example.demo3.entry.vo.DocumentVo;
import com.example.demo3.entry.vo.JifenVo;
import com.example.demo3.entry.vo.UserVO;
import com.example.demo3.entry.vo.WemzhangVo;
import com.example.demo3.exception.BusinessException;
import com.example.demo3.exception.ThrowUtils;
import com.example.demo3.mapper.*;
import com.example.demo3.service.UserService;
import com.example.demo3.service.WenzhangService;
import com.example.demo3.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.*;import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;@Api(tags = "用户管理")
@RestController
public class UserController {@ResourceDocumentMapper documentMapper;@ResourceUserService userService;@ResourceUserMapper userMapper;@ResourceWenzhangMapper wenzhangMapper;@ResourceWenzhangService wenzhangService;@ResourceKsMapper ksMapper;@ResourceUserlogsMapper userlogsMapper;/*** 登录** @param userLogin* @param request* @return*/@ApiOperation(value = "登录")@PostMapping("/login")BaseResponse<UserVO> loginUser(@RequestBody UserLogin userLogin, HttpServletRequest request) {String userAccount = userLogin.getUseraccount();String userPassword = userLogin.getUserpassword();UserVO userVO = userService.userLogin(userAccount, userPassword, request);Userlogs userlogs = new Userlogs();userlogs.setId(IdUtil.simpleUUID() );userlogs.setUserlogin(userVO.getUseraccount());userlogs.setUsername(userVO.getUsername());//获取当前时间userlogs.setLogintime(DateUtil.now());userlogsMapper.insert(userlogs);return ResultUtils.success(userVO);}/*** 注册** @param userRegisterRequest* @return*/@PostMapping("/register")public BaseResponse<String> userRegister(@RequestBody UserRegisterRequest userRegisterRequest) {if (userRegisterRequest == null) {throw new BusinessException(ErrorCode.PARAMS_ERROR);}String userAccount = userRegisterRequest.getUserAccount();String userPassword = userRegisterRequest.getUserPassword();String checkPassword = userRegisterRequest.getCheckPassword();// 1. 校验if (StringUtils.isAnyBlank(userAccount, userPassword, checkPassword)) {throw new BusinessException(ErrorCode.PARAMS_ERROR, "参数为空");}if (userAccount.length() < 4) {throw new BusinessException(ErrorCode.PARAMS_ERROR, "用户账号过短");}if (userPassword.length() < 8 || checkPassword.length() < 8) {throw new BusinessException(ErrorCode.PARAMS_ERROR, "用户密码过短");}String result = userService.userRegister(userAccount, userPassword, checkPassword);return ResultUtils.success(result);}/*** 更新** @param userUpdateRequest* @return*/@ApiOperation(value = "修改用户信息")@PostMapping("/update")public BaseResponse<Boolean> updateUser(@RequestBody UserUpdateRequest userUpdateRequest) {if (userUpdateRequest == null || userUpdateRequest.getId() == null) {throw new BusinessException(ErrorCode.PARAMS_ERROR);}User user = new User();//---->>>>>>> copy 从左侧往右侧赋值QueryWrapper<User> queryWrapper = new QueryWrapper<>();queryWrapper.eq("userAccount", userUpdateRequest.getUseraccount());long count = userMapper.selectCount(queryWrapper);if (count > 0) {throw new BusinessException(ErrorCode.PARAMS_ERROR, "账号重复");}BeanUtils.copyProperties(userUpdateRequest, user);boolean result = userService.updateById(user);return ResultUtils.success(result);}@ApiOperation(value = "退出")@PostMapping("/logout")public BaseResponse<Boolean> userLogout(HttpServletRequest request) {if (request == null) {throw new BusinessException(ErrorCode.PARAMS_ERROR);}boolean result = userService.userLogout(request);return ResultUtils.success(result);}@PostMapping("/list/page")public BaseResponse<Page<User>> listUserByPage(@RequestBody UserQueryRequest userQueryRequest,HttpServletRequest request) {long current = userQueryRequest.getCurrent();long size = userQueryRequest.getPageSize();Page<User> userPage = userService.page(new Page<>(current, size),userService.getQueryWrapper(userQueryRequest));return ResultUtils.success(userPage);}// @GetMapping("/get")
// public BaseResponse<User> getUserById(long id, HttpServletRequest request) {
// if (id <= 0) {
// throw new BusinessException(ErrorCode.PARAMS_ERROR);
// }
// User user = userService.getById(id);
// return ResultUtils.success(user);
// }// @GetMapping("/get/vo")
// public BaseResponse<UserVO> getUserVOById(long id, HttpServletRequest request) {
// BaseResponse<User> response = getUserById(id, request);
// User user = response.getData();
// return ResultUtils.success(userService.getUserVO(user));
// }@PostMapping("/deleteUser")
// @AuthCheck(mustRole = UserConstant.ADMIN_ROLE)public BaseResponse<Boolean> deleteUser(@RequestBody DeleteRequest deleteRequest, HttpServletRequest request) {if (deleteRequest == null || deleteRequest.getId() <= 0) {throw new BusinessException(ErrorCode.PARAMS_ERROR);}boolean b = userService.removeById(deleteRequest.getId());return ResultUtils.success(b);}/*** 修改密码** @param userPasswordDTO* @return*/@ApiOperation(value = "修改用户密码")@PostMapping("/password")public Result password(@RequestBody UserPasswordDTO userPasswordDTO) {return userService.updatePassword(userPasswordDTO);}/*** 查询用户积分*/@ApiOperation(value = "查询用户积分")@GetMapping("/score")JifenVo score(String mpOpenId) {// User loginUser = userService.getLoginUser(request);return userService.selectJifen(mpOpenId);}@ApiOperation(value = "批量删除")@DeleteMapping("/batchDelete")public Result batchDeleteUsers(@RequestBody List<String> userIds) {return userService.batchDeleteUsers(userIds);}@ApiOperation(value = "根据积分查询用户信息")@GetMapping("/selectByMpOpenId")User selectByMpOpenId(String mpOpenId) {return userService.selectUser(mpOpenId);}@PostMapping("/batchInsert")public String batchInsertUsers(@RequestBody List<User> userList) {userService.batchInsertUsers(userList);return "Batch insertion successful";}@ApiOperation(value = "查询当前用户发布的文章")@GetMapping("/selectwenzhangByMpOpenId")List<WemzhangVo> selectwenzhangByMpOpenId(String openId) {return wenzhangMapper.selectWengByopenId(openId);}@ApiOperation(value = "根据OpenId查询当前用户信息")@PostMapping("/get/user")User getUserById(@RequestParam("mpOpenId") String mpOpenId) {QueryWrapper<User> queryWrapper = new QueryWrapper<>();queryWrapper.eq("mpOpenId", mpOpenId);User user = userService.getOne(queryWrapper);ThrowUtils.throwIf(user == null, ErrorCode.SYSTEM_ERROR);return user;}@ApiOperation("购物")@GetMapping("/goShoping")Result goShoping(@RequestParam("openid") String openid) {User user = userMapper.selctbyOpenID(openid);if (user.getCoin() < 10000) {return new Result(100, "您的积分不足");} else {user.setCoin(user.getCoin() - 10000);}user.setCoin(user.getCoin() - 10000);userMapper.updateUserCoin(user);return new Result(200, "购买成功");}@ApiOperation("查询所有考试次数")@GetMapping("/ksselectcount")Result ksselectcount(String openid) {QueryWrapper<Ks> objectQueryWrapper = new QueryWrapper<>();objectQueryWrapper.eq("openid", openid);Long aLong = ksMapper.selectCount(objectQueryWrapper);return new Result(200, "查询成功", null, aLong);}@ApiOperation("查询用户考试记录openid")@GetMapping("/selectUserExamRecord")Result selectUserExamRecord(@RequestParam("openid") String openid) {QueryWrapper<Ks> queryWrapper = new QueryWrapper<>();queryWrapper.eq("openid", openid);ksMapper.selectCount(queryWrapper);return new Result(200, "查询成功", ksMapper.selectList(queryWrapper), ksMapper.selectList(queryWrapper).size());}@ApiOperation("文章发布记录 根据openid查询")@GetMapping("/wengzhangjilu")List<DocumentVo> wengzhangjilu(String openid) {return documentMapper.getDocumentById(openid);}}
试卷
controller层
package com.example.demo3.controller;import com.example.demo3.entry.pojo.Ks;
import com.example.demo3.entry.vo.QuestionVo;
import com.example.demo3.service.ExamService;
import com.example.demo3.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Api(tags = "用户考试")
@RestController
@RequestMapping("/exam")
public class ExamController {@Autowiredprivate ExamService examService;@ApiOperation(value = "根据openid创建考试")@GetMapping("/create")public Result createExam(@RequestParam String openid) {return examService.createExam(openid);}// @PostMapping("/grade/{paperId}")
// public ResponseEntity<Map<String, Object>> gradeExam(@PathVariable int paperId, @RequestBody List<String> userAnswers) {
// try {
// int score = examService.recordAndGradeExam(paperId, userAnswers.toArray(new String[0]));
// Map<String, Object> response = new HashMap<>();
// response.put("score", score);
// return new ResponseEntity<>(response, HttpStatus.OK);
// } catch (RuntimeException e) {
// Map<String, Object> errorResponse = new HashMap<>();
// errorResponse.put("error", e.getMessage());
// return new ResponseEntity<>(errorResponse, HttpStatus.BAD_REQUEST);
// }
// }@ApiOperation("根据openid 和paperId答题 ")@PostMapping("/grade/{paperId}")public Result gradeExam(@PathVariable int paperId, @RequestBody List<String> userAnswers, @RequestParam String mpopenid) {try {int score = examService.recordAndGradeExam(paperId, userAnswers.toArray(new String[0]), mpopenid);
// return new Result(20000, "答题完成", Collections.singletonMap("score", score),score);return new Result(20000, "答题完成,分数值为count",null,score);} catch (RuntimeException e) {return new Result(400, e.getMessage(), null);}}}
service层
package com.example.demo3.service;import com.example.demo3.entry.pojo.Ks;
import com.example.demo3.entry.pojo.Question;
import com.example.demo3.entry.pojo.Sj;import com.example.demo3.entry.pojo.User;
import com.example.demo3.mapper.KsMapper;
import com.example.demo3.mapper.QuestionMapper;
import com.example.demo3.mapper.SjMapper;
import com.example.demo3.mapper.UserMapper;
import com.example.demo3.util.Result;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;import javax.annotation.Resource;import java.util.Date;
import java.util.List;
import java.util.Random;
import java.util.stream.Collectors;@Service
public class ExamService {@ResourceQuestionMapper questionMapper;@ResourceSjMapper sjMapper;@ResourceUserMapper userMapper;@ResourceKsMapper ksMapper;// ... (Other Autowired beans)public Result createExam(String openid) {// Select 5 random questionsList<Question> questions = questionMapper.selectRandomQuestions();// Create an entry in the sj tableSj sj = new Sj();sj.setOpenid(openid);sj.setPaper(new Random().nextInt(100000000));sj.setNowdate(new Date());sjMapper.insertSj(sj);// Assuming this method returns the generated keyString questionsname = questions.stream().map(Question::getQuestionname).collect(Collectors.joining(","));// Concatenate question IDsString questionIds = questions.stream().map(Question::getId).collect(Collectors.joining(","));// Concatenate correct answersString correctAnswers = questions.stream().map(Question::getZhengquedaan).collect(Collectors.joining(","));// Create ks entriesKs ks = new Ks();ks.setPaperid(sj.getPaper()); // This should be the ID from sj, linking ks to sjks.setOpenid(openid); // This is correct if you're using openid as a reference to sj.paperks.setNowdate(new Date());ks.setUseranswer(""); // Assuming an empty string if no answer is provided yetks.setZhengquedaan(correctAnswers);ks.setTimumignzi(questionsname);ks.setQuestionid(questionIds); // Set the concatenated question IDsksMapper.insert(ks);// Since you're not using QuestionVo, we will return a Result objectreturn new Result(200, "success date的值为paperId ,根据paperId 和openId答题", sj.getPaper(), questions);}@Transactionalpublic int recordAndGradeExam(int paperId, String[] userAnswers, String mpopenid) {// Retrieve the ks entry by paperIdKs ks = ksMapper.selectByPaperId(paperId);if (ks == null) {throw new RuntimeException("Exam not found for paperId: " + paperId);}// Split the correct answersString[] correctAnswers = ks.getZhengquedaan().split(",");int score = 0;// Update user answer and calculate scoreStringBuilder userAnswersConcat = new StringBuilder();for (int i = 0; i < correctAnswers.length; i++) {if (i > 0) userAnswersConcat.append(",");userAnswersConcat.append(userAnswers[i]);if (userAnswers[i].equals(correctAnswers[i])) {score++;}}System.out.println(score);// Update the ks table with user answersks.setUseranswer(userAnswersConcat.toString());ks.setFenshu(score);ksMapper.updateUserAnswer(ks);// Update the user's coinsUser user = userMapper.selectByMpOpenId(mpopenid);if (user != null) {user.setCoin(user.getCoin() + score);userMapper.updateUserCoins(user);}return score;}}
mapper
package com.example.demo3.mapper;import com.example.demo3.entry.pojo.Ks;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;import java.util.List;/**
* @author l
* @description 针对表【ks(考试)】的数据库操作Mapper
* @createDate 2023-12-22 01:03:55
* @Entity com.example.demo3.entry.pojo.Ks
*/
@Mapper
public interface KsMapper extends BaseMapper<Ks> {// 增加记录void insertKs(Ks ks);// 根据主键删除记录void deleteKsByPaperId(int paperId);// 更新记录void updateKs(Ks ks);// 根据主键查询记录Ks selectKsByPaperId(int paperId);// 查询所有记录List<Ks> selectAllKs();@Update("UPDATE ks SET fenshu = #{fenshu} WHERE paperid = #{paperid}")void updateScore(Ks ks);Ks selectByPaperId(int paperId);void updateUserAnswer(Ks ks);List<Ks> selectExamsByOpenId(String openId);List<Ks> wan(String openId);
}
mapper.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapperPUBLIC "-//mybatis.org//DTD Mapper 3.0//EN""http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.example.demo3.mapper.KsMapper"><resultMap id="BaseResultMap" type="com.example.demo3.entry.pojo.Ks"><result property="paperid" column="paperid" jdbcType="INTEGER"/><result property="openid" column="openid" jdbcType="VARCHAR"/><result property="nowdate" column="nowdate" jdbcType="TIMESTAMP"/><result property="useranswer" column="useranswer" jdbcType="VARCHAR"/><result property="zhengquedaan" column="zhengquedaan" jdbcType="VARCHAR"/><result property="questionid" column="questionid" jdbcType="VARCHAR"/><result property="fenshu" column="fenshu" jdbcType="INTEGER"/><result property="timumignzi" column="timumignzi" jdbcType="VARCHAR"/></resultMap><sql id="Base_Column_List">paperid,openid,nowdate,useranswer,zhengquedaan,questionid,fenshu,timumignzi</sql><!-- 增加记录 --><insert id="insertKs" parameterType="com.example.demo3.entry.pojo.Ks" useGeneratedKeys="true" keyProperty="id">INSERT INTO ks(paperid, openid, nowdate, useranswer, zhengquedaan, questionid, fenshu,timumignzi)VALUES (#{paperid}, #{openid}, #{nowdate}, #{useranswer}, #{zhengquedaan}, #{questionid}, #{fenshu},#{timumignzi})</insert><!-- 根据主键删除记录 --><delete id="deleteKsByPaperId">DELETEFROM ksWHERE paperid = #{paperId}</delete><!-- 更新记录 --><update id="updateKs" parameterType="com.example.demo3.entry.pojo.Ks">UPDATE ksSET nowdate = #{nowdate},useranswer = #{useranswer},zhengquedaan = #{zhengquedaan},questionid=#{questionid},timumignzi=#{timumignzi}WHERE paperid = #{paperid}and openid = #{openid}</update><update id="updateUserAnswer">UPDATE ksSET useranswer = #{useranswer},fenshu =#{fenshu}WHERE paperid = #{paperid}</update><!-- 根据主键查询记录 --><select id="selectKsByPaperId" resultType="com.example.demo3.entry.pojo.Ks">SELECT *FROM ksWHERE paperid = #{paperId}</select><!-- 查询所有记录 --><select id="selectAllKs" resultType="com.example.demo3.entry.pojo.Ks">SELECT *FROM ks</select><select id="selectByPaperId" resultType="com.example.demo3.entry.pojo.Ks">SELECT *FROM ksWHERE paperid = #{paperId}</select><select id="selectExamsByOpenId" resultType="com.example.demo3.entry.pojo.Ks">SELECT *FROM ksWHERE openid = #{openId}</select><select id="wan" resultType="com.example.demo3.entry.pojo.Ks">SELECT paperid, GROUP_CONCAT(DISTINCT questionid ORDER BY questionid ASC) AS wrong_questionidsFROM (SELECT ks.paperid,SUBSTRING_INDEX(SUBSTRING_INDEX(ks.questionid, ',', numbers.n), ',', -1) AS questionid,SUBSTRING_INDEX(SUBSTRING_INDEX(ks.useranswer, ',', numbers.n), ',', -1) AS useranswer,SUBSTRING_INDEX(SUBSTRING_INDEX(ks.zhengquedaan, ',', numbers.n), ',', -1) AS zhengquedaanFROM ksJOIN (SELECT 1 n UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5) numbers ON CHAR_LENGTH(ks.questionid) - CHAR_LENGTH(REPLACE(ks.questionid, ',', '')) >= numbers.n - 1WHERE ks.openid = #{openId}) AS subqueryWHERE subquery.useranswer != subquery.zhengquedaanGROUP BY paperid;</select></mapper>