栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

2021/12/22日记 开发springboot + vue + mybatis 棉花糖English 项目第一步Day01

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

2021/12/22日记 开发springboot + vue + mybatis 棉花糖English 项目第一步Day01

开发部分日记

发现最近学习效率不高,决定从今天开始写日记,提前为以后防止以后老年痴呆做准备

原有一个MhtEnglish英语学习小程序项目,但是过了一段时间之后觉得代码写的实在是臭,又不规范,所以推翻重来,这次在原有项目的基础上加上一个后台管理系统,为以后业务拓展做准备,原有小程序暂时没有对他进行改动的打算(懒得写前端)

github

github仓库

idea连接github
参考链接

同时从idea推送上去的时候会产生一点小问题:

  1. 第一个问题
    git遇到fatal: unable to access ‘https://github.com/xxx/xxx/’:OpenSSL SSL_read: Connection was aborted, errno 10053的问题
    原因
    Git默认限制推送的大小,运行命令更改限制大小即可
    解决方法

    git config --global http.postBuffer 524288000
    

    参考链接
    https://blog.csdn.net/ZJ_____W/article/details/114778696

  2. 因为github 现在的默认分支是main,去设置里修改默认分支为master(具体百度)

  3. 我习惯创建仓库的时候勾选readme.md 这时候如果直接push会出错
    解决办法:

git checkout master #切换到要提交代码的分支
git pull origin master --allow-unrelated-histories #加上后面这个选项允许不相关历史提交
git push origin master #提交到远程分支
后端架构

编写application.yml
#多环境配置
spring:
  profiles:
    active: dev

###编写application-dev.yml

#开发环境
server:
  port: 8080
spring:
  application:
    name: SpringbootTestApplication
  datasource:
    url: jdbc:mysql://localhost:3306/mht?useUnicode=true&characterEncoding=utf8&useSSL=false
    username: root
    password: 123456
    driver-class-name: com.mysql.cj.jdbc.Driver
    #druid 模块配置(copy别人的)
    druid:
      #2.连接池配置
      #初始化连接池的连接数量 大小,最小,最大
      initial-size: 5
      min-idle: 5
      max-active: 20
      #配置获取连接等待超时的时间
      max-wait: 60000
      #配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
      time-between-eviction-runs-millis: 60000
      # 配置一个连接在池中最小生存的时间,单位是毫秒
      min-evictable-idle-time-millis: 30000
      validation-query: SELECt 1 FROM DUAL
      test-while-idle: true
      test-on-borrow: true
      test-on-return: false
      # 是否缓存preparedStatement,也就是PSCache  官方建议MySQL下建议关闭   个人建议如果想用SQL防火墙 建议打开
      pool-prepared-statements: true
      max-pool-prepared-statement-per-connection-size: 20
      # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
      filter:
        stat:
          merge-sql: true
          slow-sql-millis: 5000
      #3.基础监控配置
      web-stat-filter:
        enabled: true
        url-pattern: *.xml
  type-aliases-package: com.lee.mht.*.entity
#  configuration:
#    map-underscore-to-camel-case: true
#    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl   #用于控制台打印sql语句
引入依赖
        
            com.alibaba
            druid-spring-boot-starter
            1.1.10
        
        
            org.springframework
            spring-aspects
        
druid 监控页面

http:localhost:8080/druid/index.html
账号密码在yml配置中

配置mybatis

引入mybatis依赖
直接搜索,过程略

mybatis:
  mapper-locations: classpath:/mapper

@Service
public class AdminUserServiceImpl implements AdminUserService {

    @Autowired(required = false)
    private AdminUserDao adminUserDao;


    @Override
    public Boolean login(@Param("username") String username,@Param("password") String password) {
        return adminUserDao.login(username,password);
    }
}

AdminUser.mapper

    
        SELECT count(*) FROM admin_user
        WHERe username = #{username} and password = #{password}
    

测试接口:


ps:数据库里的密码目前暂定是加密的,但是还没想好具体的加密方法,所以就直接整了个md5,先凑活这用

然后接下来去搞前端,我最不喜欢的(明天写) 总结

apex真坐牢,勾巴前端真烦

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/678512.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号