uniapp微信小程序投票系统实战 (SpringBoot2+vue3.2+element plus ) -后端架构搭建

2024-01-08 17:32:13

锋哥原创的uniapp微信小程序投票系统实战:

uniapp微信小程序投票系统实战课程 (SpringBoot2+vue3.2+element plus ) ( 火爆连载更新中... )_哔哩哔哩_bilibiliuniapp微信小程序投票系统实战课程 (SpringBoot2+vue3.2+element plus ) ( 火爆连载更新中... )共计21条视频,包括:uniapp微信小程序投票系统实战课程 (SpringBoot2+vue3.2+element plus ) ( 火爆连载更新中... )、第2讲 投票项目后端架构搭建、第3讲 小程序端 TabBar搭建等,UP主更多精彩视频,请关注UP账号。icon-default.png?t=N7T8https://www.bilibili.com/video/BV1ea4y137xf/

idea新建项目:java1234-vote3

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.3.2.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.java1234</groupId>
    <artifactId>java1234-vote3</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>java1234-vote3</name>
    <description>java1234-vote3</description>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-validation</artifactId>
        </dependency>


        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>


        <!-- 连接池 -->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid</artifactId>
            <version>1.1.10</version>
        </dependency>
        <!-- mybatis-plus -->
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
            <version>3.3.2</version>
        </dependency>
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
            <version>3.3.2</version>
        </dependency>

        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
            <version>1.2.40</version>
        </dependency>

        <!-- JWT -->
        <dependency>
            <groupId>com.auth0</groupId>
            <artifactId>java-jwt</artifactId>
            <version>3.2.0</version>
        </dependency>
        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt</artifactId>
            <version>0.9.1</version>
        </dependency>

        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.5</version>
        </dependency>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>

        <!-- spring boot redis 缓存引入 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-redis</artifactId>
        </dependency>
        <!-- lettuce pool 缓存连接池 -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-pool2</artifactId>
        </dependency>

        <!-- hutool工具类-->
        <dependency>
            <groupId>cn.hutool</groupId>
            <artifactId>hutool-all</artifactId>
            <version>5.3.3</version>
        </dependency>

        <!-- 验证码依赖-->
        <dependency>
            <groupId>com.github.axet</groupId>
            <artifactId>kaptcha</artifactId>
            <version>0.0.9</version>
        </dependency>

        <!-- 添加Httpclient支持 -->
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.5.2</version>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>2.3.2.RELEASE</version>
            </plugin>
        </plugins>
    </build>

</project>

application.yml

server:
  port: 8866
  servlet:
    context-path: /

spring:
  datasource:
    type: com.alibaba.druid.pool.DruidDataSource
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/db_vote3?serverTimezone=Asia/Shanghai
    username: root
    password: 123456


mybatis-plus:
  global-config:
    db-config:
      id-type: auto
  configuration:
    map-underscore-to-camel-case: true
    auto-mapping-behavior: full
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
  mapper-locations: classpath:mapper/*.xml

启动类加上,扫描mapper接口:@MapperScan("com.java1234.mapper")

项目结构;


测试接口:

/**
 * 测试
 * @return
 */
@RequestMapping("/test")
public R test(){
    List<WxUserInfo> list = wxUserInfoService.list();
    HashMap<String,Object> result=new HashMap<>();
    result.put("list",list);
    return R.ok(result);
}

浏览器地址栏输入:

http://localhost:8866/user/test



测试OK

新建数据库:db_vote3

新建微信用户信息表:t_wxuserinfo

/*
SQLyog Ultimate v11.33 (64 bit)
MySQL - 5.7.18-log 
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;

create table `t_wxuserinfo` (
	`id` int (11),
	`openid` varchar (90),
	`nick_name` varchar (150),
	`avatar_url` varchar (600),
	`register_date` datetime ,
	`last_login_date` datetime ,
	`status` char (3)
); 
insert into `t_wxuserinfo` (`id`, `openid`, `nick_name`, `avatar_url`, `register_date`, `last_login_date`, `status`) values('6','o30ur5JpAsAUyGBkR0uW4IxvahR8','小锋老师@java1234','20230324082340000000882.jpeg','2023-02-27 17:48:29','2023-05-04 21:06:40','0');
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-04 21:20:38','0');
insert into `t_wxuserinfo` (`id`, `openid`, `nick_name`, `avatar_url`, `register_date`, `last_login_date`, `status`) values('9','o30ur5JpAsAUyGBkR0uW4IxvahR0','微信用户','default.png','2023-04-30 07:42:19','2023-04-30 07:42:19','1');
insert into `t_wxuserinfo` (`id`, `openid`, `nick_name`, `avatar_url`, `register_date`, `last_login_date`, `status`) values('10','1',NULL,NULL,NULL,NULL,'1');
insert into `t_wxuserinfo` (`id`, `openid`, `nick_name`, `avatar_url`, `register_date`, `last_login_date`, `status`) values('11','2',NULL,NULL,NULL,NULL,'1');
insert into `t_wxuserinfo` (`id`, `openid`, `nick_name`, `avatar_url`, `register_date`, `last_login_date`, `status`) values('12','3',NULL,NULL,NULL,NULL,'1');
insert into `t_wxuserinfo` (`id`, `openid`, `nick_name`, `avatar_url`, `register_date`, `last_login_date`, `status`) values('13','4',NULL,NULL,NULL,NULL,'1');
insert into `t_wxuserinfo` (`id`, `openid`, `nick_name`, `avatar_url`, `register_date`, `last_login_date`, `status`) values('14','5',NULL,NULL,NULL,NULL,'1');
insert into `t_wxuserinfo` (`id`, `openid`, `nick_name`, `avatar_url`, `register_date`, `last_login_date`, `status`) values('15','6',NULL,NULL,NULL,NULL,'1');
insert into `t_wxuserinfo` (`id`, `openid`, `nick_name`, `avatar_url`, `register_date`, `last_login_date`, `status`) values('16','7',NULL,NULL,NULL,NULL,'1');
insert into `t_wxuserinfo` (`id`, `openid`, `nick_name`, `avatar_url`, `register_date`, `last_login_date`, `status`) values('17','8',NULL,NULL,NULL,NULL,'1');

(*记得要设置下主键自增)

文章来源:https://blog.csdn.net/caoli201314/article/details/135382478
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。