第24讲投票管理实现

投票管理实现

第24讲投票管理实现_第1张图片
后端:

package com.java1234.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.java1234.entity.*;
import com.java1234.service.IVoteDetailService;
import com.java1234.service.IVoteItemService;
import com.java1234.service.IVoteService;
import com.java1234.service.WxUserInfoService;
import com.java1234.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 投票Controller控制器
 * @author java1234_小锋 (公众号:java1234)
 * @site www.java1234.vip
 * @company 南通小锋网络科技有限公司
 */
@RestController
@RequestMapping("/business/vote")
public class VoteController {

    @Autowired
    private IVoteService voteService;

    @Autowired
    private IVoteItemService voteItemService;

    @Autowired
    private IVoteDetailService voteDetailService;

    @Autowired
    private WxUserInfoService wxUserInfoService;

    /**
     * 根据条件分页查询投票信息
     * @param pageBean
     * @return
     */
    @PostMapping("/list")
    @PreAuthorize("hasAuthority('business:vote:list')")
    public R list(@RequestBody PageBean pageBean){
        String query=pageBean.getQuery().trim();
        Page<Vote> pageResult = voteService.page(new Page<>(pageBean.getPageNum(), pageBean.getPageSize()), new QueryWrapper<Vote>().like(StringUtil.isNotEmpty(query), "title", query));
        List<Vote> voteList = pageResult.getRecords();
        for(Vote vote:voteList){
            // 根据openid获取投票人信息
            WxUserInfo wxUserInfo = wxUserInfoService.getOne(new QueryWrapper<WxUserInfo>().eq("openid", vote.getOpenid()));
            // 获取投票选项
            List<VoteItem> voteItemList = voteItemService.list(new QueryWrapper<VoteItem>().eq("vote_id", vote.getId()));
            vote.setVoteItemList(voteItemList);
            vote.setWxUserInfo(wxUserInfo);
        }
        Map<String,Object> resultMap=new HashMap<>();
        resultMap.put("voteList",voteList);
        resultMap.put("total",pageResult.getTotal());
        return R.ok(resultMap);
    }

    /**
     * 删除指定id的投票信息
     * @param id
     * @return
     */
    @GetMapping("/delete/{id}")
    @Transactional
    @PreAuthorize("hasAuthority('business:vote:delete')")
    public R delete(@PathVariable(value = "id")Integer id){
        voteDetailService.remove(new QueryWrapper<VoteDetail>().eq("vote_id",id)); // 删除用户投票详情
        voteItemService.remove(new QueryWrapper<VoteItem>().eq("vote_id",id)); // 删除投票选项
        voteService.removeById(id); // 删除投票
        return R.ok();
    }

}

前端:

<template>
  <div class="app-container">

    <el-row :gutter="20" class="header">
      <el-col :span="7">
        <el-input placeholder="请输入标题..." v-model="queryForm.query" clearable ></el-input>
      </el-col>
      <el-button type="primary" :icon="Search" @click="initVoteList">搜索</el-button>
    </el-row>

    <el-table :data="tableData" stripe style="width: 100%" >
        <el-table-column prop="id" label="编号"  width="80" align="center"/>
        <el-table-column prop="title" label="标题"  align="center"/>
        <el-table-column prop="openid" label="投票人" width="250" >
          <template v-slot="scope">
            <img :src="getServerUrl()+'image/weixinAvatar/'+scope.row.wxUserInfo.avatarUrl" width="50" height="50"/>&nbsp;&nbsp;{{scope.row.wxUserInfo.nickName}}
          </template>
        </el-table-column>
      <el-table-column  label="投票选项" width="100" align="center">
        <template v-slot="scope">
          <el-popover placement="left" :width="400" trigger="click" @show="getItemList(scope.row)">

          <template #reference>
            <el-button  type="success">查看</el-button>
          </template>

            <el-table :data="voteItemList" >
              <el-table-column type="index" label="序号" align="left" width="50" />
              <el-table-column  property="name" label="选项名称" />
            </el-table>

        </el-popover>
        </template>
      </el-table-column>

        <el-table-column prop="voteEndTime" label="投票截止时间" width="200" align="center"/>
        <el-table-column prop="action" label="操作" width="100" fixed="right" align="center">
        <template v-slot="scope" >
          <el-popconfirm   title="您确定要删除这条记录吗?" @confirm="handleDelete(scope.row.id)">
            <template #reference>
              <el-button  type="danger" :icon="Delete" v-if="hasAuth('business:vote:delete')"/>
            </template>
          </el-popconfirm>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
        v-model:currentPage="queryForm.pageNum"
        v-model:page-size="queryForm.pageSize"
        :page-sizes="[10, 20, 30, 40]"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
    />
  </div>

</template>

<script setup>
import {ref} from 'vue';
import requestUtil,{getServerUrl} from "@/util/request";
import { Search ,Delete,DocumentAdd ,Edit, Tools, RefreshRight} from '@element-plus/icons-vue'

import { ElMessage, ElMessageBox } from 'element-plus'

const tableData=ref({})

const total=ref(0)

const queryForm=ref({
  query:'',
  pageNum:1,
  pageSize:10
})

const id=ref(-1)

const voteItemList=ref([])


const initVoteList=async()=>{
  const res=await requestUtil.post("business/vote/list",queryForm.value);
  tableData.value=res.data.voteList;
  total.value=res.data.total;
}

initVoteList();

const handleSizeChange=(pageSize)=>{
  queryForm.value.pageNum=1;
  queryForm.value.pageSize=pageSize;
  initVoteList();
}

const handleCurrentChange=(pageNum)=>{
  queryForm.value.pageNum=pageNum;
  initVoteList();
}

const getItemList=(row)=>{
  console.log("row="+JSON.stringify(row))
  voteItemList.value=row.voteItemList;

}

const handleDelete=async (id)=>{

  const res=await requestUtil.get("business/vote/delete/"+id)
  if(res.data.code==200){
    ElMessage({
      type: 'success',
      message: '执行成功!'
    })
    initVoteList();
  }else{
    ElMessage({
      type: 'error',
      message: res.data.msg,
    })
  }
}

</script>

<style lang="scss" scoped>

.header{
  padding-bottom: 16px;
  box-sizing: border-box;
}

.el-pagination{
  float: right;
  padding: 20px;
  box-sizing: border-box;
}

::v-deep th.el-table__cell{
  word-break: break-word;
  background-color: #f8f8f9 !important;
  color: #515a6e;
  height: 40px;
  font-size: 13px;

}

.el-tag--small {
  margin-left: 5px;
}
</style>
/*
SQLyog Ultimate v11.33 (64 bit)
MySQL - 5.7.18-log : Database - db_vote3
*********************************************************************
*/

/*!40101 SET NAMES utf8 */;

/*!40101 SET SQL_MODE=''*/;

/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/`db_vote3` /*!40100 DEFAULT CHARACTER SET utf8 */;

USE `db_vote3`;

/*Table structure for table `sys_menu` */

DROP TABLE IF EXISTS `sys_menu`;

CREATE TABLE `sys_menu` (
  `id` bigint(20) DEFAULT NULL,
  `name` varchar(150) DEFAULT NULL,
  `icon` varchar(300) DEFAULT NULL,
  `parent_id` bigint(20) DEFAULT NULL,
  `order_num` int(11) DEFAULT NULL,
  `path` varchar(600) DEFAULT NULL,
  `component` varchar(765) DEFAULT NULL,
  `menu_type` char(3) DEFAULT NULL,
  `perms` varchar(300) DEFAULT NULL,
  `create_time` datetime DEFAULT NULL,
  `update_time` datetime DEFAULT NULL,
  `remark` varchar(1500) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

/*Data for the table `sys_menu` */

insert  into `sys_menu`(`id`,`name`,`icon`,`parent_id`,`order_num`,`path`,`component`,`menu_type`,`perms`,`create_time`,`update_time`,`remark`) values (1,'系统管理','system',0,1,'/sys','','M','','2022-07-04 14:56:29','2022-07-04 14:56:31','系统管理目录'),(2,'业务管理','monitor',0,2,'/bsns','','M','','2022-07-04 14:59:43','2022-07-04 14:59:45','业务管理目录'),(3,'用户管理','user',1,1,'/sys/user','sys/user/index','C','system:user:list','2022-07-04 15:20:51','2022-07-04 15:20:53','用户管理菜单'),(4,'角色管理','peoples',1,2,'/sys/role','sys/role/index','C','system:role:list','2022-07-04 15:23:35','2022-07-04 15:23:39','角色管理菜单'),(5,'菜单管理','tree-table',1,3,'/sys/menu','sys/menu/index','C','system:menu:list','2022-07-04 15:23:41','2022-07-04 15:23:43','菜单管理菜单'),(6,'部门管理','tree',2,4,'/bsns/department','bsns/Department','C','','2022-07-04 23:24:40','2023-04-30 08:27:33','部门管理菜单'),(7,'岗位管理','post',2,3,'/bsns/post','bsns/Post','C','','2022-07-04 23:24:42','2023-04-30 08:27:41','岗位管理菜单'),(8,'用户新增','#',3,2,'','','F','system:user:add','2022-07-04 15:24:42','2022-07-04 15:24:46','添加用户按钮'),(9,'用户修改','#',3,3,'','','F','system:user:edit','2022-07-04 15:24:42','2022-07-04 15:24:46','修改用户按钮'),(10,'用户删除','#',3,4,'','','F','system:user:delete','2022-07-04 15:24:42','2022-07-04 15:24:46','删除用户按钮'),(11,'分配角色','#',3,5,'','','F','system:user:role','2022-07-04 15:24:42','2022-07-04 15:24:46','分配角色按钮'),(12,'重置密码','#',3,6,'','','F','system:user:resetPwd','2022-07-04 15:24:42','2022-07-04 15:24:46','重置密码按钮'),(13,'角色新增','#',4,2,'','','F','system:role:add','2022-07-04 15:24:42','2022-07-04 15:24:46','添加用户按钮'),(14,'角色修改','#',4,3,'','','F','system:role:edit','2022-07-04 15:24:42','2022-07-04 15:24:46','修改用户按钮'),(15,'角色删除','#',4,4,'',NULL,'F','system:role:delete','2022-07-04 15:24:42','2022-07-04 15:24:46','删除用户按钮'),(16,'分配权限','#',4,5,'','','F','system:role:menu','2022-07-04 15:24:42','2022-07-04 15:24:46','分配权限按钮'),(17,'菜单新增','#',5,2,'',NULL,'F','system:menu:add','2022-07-04 15:24:42','2022-07-04 15:24:46','添加菜单按钮'),(18,'菜单修改','#',5,3,'',NULL,'F','system:menu:edit','2022-07-04 15:24:42','2022-07-04 15:24:46','修改菜单按钮'),(19,'菜单删除','#',5,4,'',NULL,'F','system:menu:delete','2022-07-04 15:24:42','2022-07-04 15:24:46','删除菜单按钮'),(20,'用户查询','#',3,1,'',NULL,'F','system:user:query','2022-07-04 15:24:42','2022-07-04 15:24:46','用户查询按钮'),(21,'角色查询','#',4,1,'',NULL,'F','system:role:query','2022-07-04 15:24:42','2022-07-04 15:24:46','角色查询按钮'),(22,'菜单查询','#',5,1,'',NULL,'F','system:menu:query','2022-07-04 15:24:42','2022-07-04 15:24:46','菜单查询按钮'),(33,'测速22','122',3,3,'','34','M','33','2022-08-19 03:11:20','2022-08-18 19:11:33',NULL),(34,'微信用户管理','weixin2',2,1,'/bsns/weixin','bsns/weixin/index','C','business:wxUser:list','2023-04-30 08:27:19',NULL,NULL),(35,'投票管理','vote3',2,2,'/bsns/vote','bsns/vote/index','C','business:vote:list','2023-04-30 08:31:17',NULL,NULL),(36,'微信用户查询','',34,1,'','','F','business:wxUser:query','2023-04-30 15:06:33',NULL,NULL),(37,'微信用户修改','',34,1,'','','F','business:wxUser:edit','2023-04-30 15:06:57',NULL,NULL),(38,'投票查询','',35,1,'','','F','business:vote:query','2023-05-01 08:06:01',NULL,NULL),(39,'投票删除','',35,2,'','','F','business:vote:delete','2023-05-01 16:06:28','2023-05-01 08:06:36',NULL);

/*Table structure for table `sys_role` */

DROP TABLE IF EXISTS `sys_role`;

CREATE TABLE `sys_role` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '角色主键ID',
  `name` varchar(30) DEFAULT NULL COMMENT '角色名称',
  `code` varchar(100) DEFAULT NULL COMMENT '角色权限字符串',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8;

/*Data for the table `sys_role` */

insert  into `sys_role`(`id`,`name`,`code`,`create_time`,`update_time`,`remark`) values (1,'超级管理员','admin','2022-07-04 14:40:44','2022-07-04 14:40:47','拥有系统最高权限'),(2,'普通角色','common','2022-07-04 14:41:56','2022-07-04 14:41:58','普通角色'),(3,'测试角色','test3','2022-07-04 14:42:24','2022-07-04 14:42:27','测试角色'),(4,'2',NULL,NULL,NULL,NULL),(6,'4',NULL,NULL,NULL,NULL),(17,'0',NULL,NULL,NULL,NULL),(19,'测2','cc2','2022-08-13 21:06:21','2022-08-13 13:06:27','eewew2'),(20,'ccc测试','test2','2022-08-29 17:10:33',NULL,'xxx'),(21,'今天测试角色','todytest','2022-08-29 22:01:11',NULL,'ccc'),(22,'ttt测','t11','2022-11-20 18:27:10','2022-11-20 10:27:24','tce测试');

/*Table structure for table `sys_role_menu` */

DROP TABLE IF EXISTS `sys_role_menu`;

CREATE TABLE `sys_role_menu` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '角色菜单主键ID',
  `role_id` bigint(20) DEFAULT NULL COMMENT '角色ID',
  `menu_id` bigint(20) DEFAULT NULL COMMENT '菜单ID',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=316 DEFAULT CHARSET=utf8;

/*Data for the table `sys_role_menu` */

insert  into `sys_role_menu`(`id`,`role_id`,`menu_id`) values (15,3,2),(16,3,6),(17,3,7),(21,7,1),(22,7,2),(23,7,6),(24,7,7),(25,6,1),(26,6,3),(27,6,9),(28,6,10),(29,19,1),(30,19,3),(31,19,2),(32,19,6),(208,20,1),(209,20,3),(210,20,20),(211,20,8),(212,20,9),(213,20,33),(214,20,10),(215,20,11),(216,20,4),(217,20,21),(218,20,13),(219,20,5),(220,20,22),(221,20,17),(222,20,18),(223,20,2),(224,20,6),(225,20,7),(232,21,1),(233,21,9),(234,21,4),(235,21,21),(236,21,2),(237,21,6),(238,21,7),(251,4,1),(252,4,2),(253,4,6),(254,4,7),(273,2,1),(274,2,3),(275,2,20),(276,2,8),(277,2,4),(278,2,21),(279,2,13),(280,2,15),(281,2,5),(282,2,22),(283,2,18),(284,2,19),(285,2,2),(286,2,6),(287,2,7),(288,1,1),(289,1,3),(290,1,20),(291,1,8),(292,1,9),(293,1,10),(294,1,11),(295,1,12),(296,1,4),(297,1,21),(298,1,13),(299,1,14),(300,1,15),(301,1,16),(302,1,5),(303,1,22),(304,1,17),(305,1,18),(306,1,19),(307,1,2),(308,1,34),(309,1,36),(310,1,37),(311,1,35),(312,1,38),(313,1,39),(314,1,7),(315,1,6);

/*Table structure for table `sys_user` */

DROP TABLE IF EXISTS `sys_user`;

CREATE TABLE `sys_user` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '用户ID',
  `username` varchar(100) DEFAULT NULL COMMENT '用户名',
  `password` varchar(100) DEFAULT NULL COMMENT '密码',
  `avatar` varchar(255) DEFAULT 'default.jpg' COMMENT '用户头像',
  `email` varchar(100) DEFAULT '' COMMENT '用户邮箱',
  `phonenumber` varchar(11) DEFAULT '' COMMENT '手机号码',
  `login_date` datetime DEFAULT NULL COMMENT '最后登录时间',
  `status` char(1) DEFAULT '0' COMMENT '帐号状态(0正常 1停用)',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=40 DEFAULT CHARSET=utf8;

/*Data for the table `sys_user` */

insert  into `sys_user`(`id`,`username`,`password`,`avatar`,`email`,`phonenumber`,`login_date`,`status`,`create_time`,`update_time`,`remark`) values (1,'java1234','$2a$10$cLJkZ.VSAWw0g5fcYSs1Peuxwhalqrmkk9cnnWcXoJl6rzxld9bjS','20221012090919000000959.jpg','[email protected]','18862857412','2022-08-29 22:10:52','0','2022-06-09 08:47:52','2022-10-12 09:10:33','备注'),(2,'common','$2a$10$tiArwm0GxChyEP5k0JGzsOuzyY15IKA.ZTl8S2aj3haYlKAfpwfl.','222.jpg','','','2022-08-22 21:34:39','0',NULL,NULL,NULL),(3,'test','$2a$10$tiArwm0GxChyEP5k0JGzsOuzyY15IKA.ZTl8S2aj3haYlKAfpwfl.','333.jpg','','','2022-07-24 17:36:07','0',NULL,NULL,NULL),(4,'1','$2a$10$lD0Fx7oMsFFmX9hVkmYy7eJteH8pBaXXro1X9DEMP5sbM.Z6Co55m','default.jpg','','',NULL,'1',NULL,NULL,NULL),(5,'2',NULL,'default.jpg','','',NULL,'1',NULL,NULL,NULL),(15,'fdsfs','$2a$10$AQVcp4hQ7REc5o7ztVnI7eX.sJdcYy3d1x2jm5CfrcCoMZMPacfpi','default.jpg','[email protected]','18862851414','2022-08-02 02:22:45','1','2022-08-02 02:21:24','2022-08-01 18:23:16','fdfds4'),(28,'sdfss2','$2a$10$7aNJxwVmefI0XAk64vrzYuOqeeImYJUQnoBrtKP9pLTGTWO2CXQ/y','default.jpg','[email protected]','18862857413',NULL,'1','2022-08-07 00:42:46','2022-08-06 16:43:04','ddd33'),(29,'ccc','$2a$10$7cbWeVwDWO9Hh3qbJrvTHOn0E/DLYXxnIZpxZei0jY4ChfQbJuhi.','20220829080150000000341.jpg','[email protected]','18862584120','2022-08-29 19:52:27','0','2022-08-29 17:04:58',NULL,'xxx'),(30,'ccc666','$2a$10$Tmw5VCM/K2vb837AZDYHQOqE3gPiRZKevxLsh/ozndpTSjdwABqaK','20220829100454000000771.jpg','[email protected]','18865259845','2022-08-29 22:05:18','0','2022-08-29 22:00:39',NULL,'ccc'),(31,'1',NULL,'default.jpg','','',NULL,'0',NULL,NULL,NULL),(32,'2',NULL,'default.jpg','','',NULL,'0',NULL,NULL,NULL),(37,'common2','$2a$10$JpPa1JOQyrP1iRg.QnMmxuvAn.6J55QB5yd3nF1TpQuXGUJ5eOei.','default.jpg','[email protected]','15525462582',NULL,'1','2022-10-20 00:37:24','2022-10-20 08:48:47','xxx2'),(38,'ccc2','$2a$10$ZN9MoJwJsU36TJ27qXdmrel/FcXSDbczAVIUAS5I3GT8dIIHr74Wu','default.jpg','[email protected]','15562854120',NULL,'0','2022-11-22 21:58:23',NULL,'111'),(39,'ccc2','$2a$10$eIsxbV4CIcxclMcp/da31en.RIUGeuYYFIF7pNhvTmkbONxCd4xVi','default.jpg','[email protected]','15562854120',NULL,'0','2022-11-22 21:59:31',NULL,'111');

/*Table structure for table `sys_user_role` */

DROP TABLE IF EXISTS `sys_user_role`;

CREATE TABLE `sys_user_role` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '用户角色主键ID',
  `user_id` bigint(20) DEFAULT NULL COMMENT '用户ID',
  `role_id` bigint(20) DEFAULT NULL COMMENT '角色ID',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8;

/*Data for the table `sys_user_role` */

insert  into `sys_user_role`(`id`,`user_id`,`role_id`) values (1,1,1),(2,2,2),(4,1,2),(6,3,3),(7,3,2),(9,4,3),(10,5,3),(11,15,3),(20,29,20),(21,30,17),(22,30,21);

/*Table structure for table `t_vote` */

DROP TABLE IF EXISTS `t_vote`;

CREATE TABLE `t_vote` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(600) DEFAULT NULL,
  `explanation` varchar(3000) DEFAULT NULL,
  `cover_image` varchar(600) DEFAULT NULL,
  `vote_end_time` datetime DEFAULT NULL,
  `openid` varchar(600) DEFAULT NULL,
  `type` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;

/*Data for the table `t_vote` */

insert  into `t_vote`(`id`,`title`,`explanation`,`cover_image`,`vote_end_time`,`openid`,`type`) values (2,'1','2','20230517045026000000236.jpg','2023-05-20 16:50:22','o30ur5JpAsAUyGBkR0uW4IxvahR8',2),(4,'1','2','20230521102103000000159.jpg','2023-05-22 10:20:32','o30ur5JpAsAUyGBkR0uW4IxvahR8',1),(5,'www','1','20230521123953000000327.jpg','2023-05-22 12:39:50','o30ur5JpAsAUyGBkR0uW4IxvahR8',1),(6,'1','2','20230522085421000000169.jpg','2023-05-23 20:54:17','o30ur5JpAsAUyGBkR0uW4IxvahR8',1);

/*Table structure for table `t_vote_detail` */

DROP TABLE IF EXISTS `t_vote_detail`;

CREATE TABLE `t_vote_detail` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `vote_id` int(11) DEFAULT NULL,
  `vote_item_id` int(11) DEFAULT NULL,
  `vote_date` datetime DEFAULT NULL,
  `openid` varchar(600) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;

/*Data for the table `t_vote_detail` */

insert  into `t_vote_detail`(`id`,`vote_id`,`vote_item_id`,`vote_date`,`openid`) values (2,2,3,'2023-05-20 12:09:39','o30ur5JpAsAUyGBkR0uW4IxvahR8'),(3,4,9,'2023-05-21 10:21:27','o30ur5JpAsAUyGBkR0uW4IxvahR8'),(5,4,9,'2023-05-21 10:49:14','o30ur5PiPOr52bBsetXcIV93NL-U'),(6,5,10,'2023-05-21 12:40:14','o30ur5JpAsAUyGBkR0uW4IxvahR8');

/*Table structure for table `t_vote_item` */

DROP TABLE IF EXISTS `t_vote_item`;

CREATE TABLE `t_vote_item` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `vote_id` int(11) DEFAULT NULL,
  `name` varchar(600) DEFAULT NULL,
  `image` varchar(600) DEFAULT NULL,
  `number` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8;

/*Data for the table `t_vote_item` */

insert  into `t_vote_item`(`id`,`vote_id`,`name`,`image`,`number`) values (3,2,'1','20230517045034000000735.jpg',1),(4,2,'2','20230517045037000000283.jpg',0),(5,2,'长城','20230517045042000000183.jpg',0),(8,4,'1',NULL,1),(9,4,'2',NULL,2),(10,5,'1',NULL,1),(11,5,'2',NULL,0),(12,6,'1',NULL,0),(13,6,'2',NULL,0);

/*Table structure for table `t_wxuserinfo` */

DROP TABLE IF EXISTS `t_wxuserinfo`;

CREATE TABLE `t_wxuserinfo` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `openid` varchar(90) DEFAULT NULL,
  `nick_name` varchar(150) DEFAULT NULL,
  `avatar_url` varchar(600) DEFAULT NULL,
  `register_date` datetime DEFAULT NULL,
  `last_login_date` datetime DEFAULT NULL,
  `status` char(3) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8;

/*Data for the table `t_wxuserinfo` */

insert  into `t_wxuserinfo`(`id`,`openid`,`nick_name`,`avatar_url`,`register_date`,`last_login_date`,`status`) values (7,'o30ur5PiPOr52bBsetXcIV93NL-U','小锋四号@java1234','20230410102248000000487.jpg','2023-04-10 10:21:30','2023-05-21 10:23:32','0'),(9,'o30ur5JpAsAUyGBkR0uW4IxvahR0','微信用户','default.png','2023-04-30 07:42:19','2023-04-30 07:42:19','0'),(10,'1',NULL,NULL,NULL,NULL,'1'),(11,'2',NULL,NULL,NULL,NULL,'1'),(12,'3',NULL,NULL,NULL,NULL,'1'),(13,'4',NULL,NULL,NULL,NULL,'1'),(14,'5',NULL,NULL,NULL,NULL,'1'),(15,'6',NULL,NULL,NULL,NULL,'1'),(16,'7',NULL,NULL,NULL,NULL,'1'),(17,'8',NULL,NULL,NULL,NULL,'1'),(19,'o30ur5JpAsAUyGBkR0uW4IxvahR8','小锋111@java1234','20230514112056000000757.jpeg','2023-05-11 08:44:11','2023-05-22 20:56:48','0');

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

你可能感兴趣的:(uniapp微信小程序投票系统,windows)