首页
轻听2.0常见问题
轻听APP2.0
关于
Search
1
GO程序打包至Linux服务器运行
1,348 阅读
2
SpringBoot2.7.9+Mybatis-Plus3.5.3.1+ShardingSphere-JDBC5.3.1实现分库分表
781 阅读
3
Xmind 思维脑图软件破解版
730 阅读
4
完美解决方案-雪花算法ID到前端之后精度丢失问题
673 阅读
5
mysql 让清空表且自增的id重新从0开始的命令
603 阅读
Git
Java
SQL
区块链
网站搭建技术
SpringBoot
thymeleaf
Vue
GO
实用软件
登录
Search
canace
累计撰写
23
篇文章
累计收到
0
条评论
首页
栏目
Git
Java
SQL
区块链
网站搭建技术
SpringBoot
thymeleaf
Vue
GO
实用软件
页面
轻听2.0常见问题
轻听APP2.0
关于
搜索到
11
篇与
网站搭建技术
的结果
2021-03-03
vue框架下部署上线后刷新报404问题解决方案
nginx配置location / { try_files $uri $uri/ /index.html; }vue history模式下nginx配置在宝塔的网站设置中修改 server { listen 80; server_name testwx.wangshibo.com; root /Data/app/xqsj_wx/dist; index index.html; access_log /var/log/testwx.log main; ## 注意从这里开始 location / { try_files $uri $uri/ @router; index index.html; } location @router { rewrite ^.*$ /index.html last; } }
2021年03月03日
399 阅读
0 评论
0 点赞
2021-03-01
Thymeleaf常用语法:模板注释
1、标准HTML/XML注释直接通过浏览器打开,不显示,Thymeleaf模板引擎解析也不处理,但查看网页源代码,注释有在里面。语法:<!-- 内容 -->浏览器界面不显示,查看浏览器网页源码有显示;2、解析层注释直接通过浏览器打开,会显示。但Thymeleaf模板引擎解析时会移除注释标签和里面内容。一般开发人员使用,减少对原型页面的破坏。语法:<!--/*--> 内容 <!--*/-->3、原型注释直接通过浏览器打开,不显示。但Thymeleaf模板引擎解析时只移除注释标签,不会移除里面内容,最后会正常输出。一般界面设计人员使用。语法:<!--/*/ 内容 /*/-->
2021年03月01日
372 阅读
0 评论
0 点赞
2021-02-08
Mybatis-plus自动代码生成工具
添加依赖 <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> <version>3.2.0</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-freemarker</artifactId> </dependency> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-generator</artifactId> <version>3.2.0</version> </dependency> import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException; import com.baomidou.mybatisplus.core.toolkit.StringPool; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.generator.AutoGenerator; import com.baomidou.mybatisplus.generator.InjectionConfig; import com.baomidou.mybatisplus.generator.config.*; import com.baomidou.mybatisplus.generator.config.po.TableInfo; import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine; import java.util.ArrayList; import java.util.List; import java.util.Scanner; /** * 代码生成器 */ // 演示例子,执行 main 方法控制台输入模块表名回车自动生成对应项目目录中 public class CodeGenerator { /** * <p> * 读取控制台内容 * </p> */ public static String scanner(String tip) { Scanner scanner = new Scanner(System.in); StringBuilder help = new StringBuilder(); help.append("请输入" + tip + ":"); System.out.println(help.toString()); if (scanner.hasNext()) { String ipt = scanner.next(); if (StringUtils.isNotEmpty(ipt)) { return ipt; } } throw new MybatisPlusException("请输入正确的" + tip + "!"); } public static void main(String[] args) { // 代码生成器 AutoGenerator mpg = new AutoGenerator(); // 全局配置 GlobalConfig gc = new GlobalConfig(); String projectPath = System.getProperty("user.dir"); gc.setOutputDir(projectPath + "/src/main/java"); // gc.setOutputDir("D:\\test"); // gc.setAuthor("LXQ"); gc.setOpen(false); // gc.setSwagger2(true); 实体属性 Swagger2 注解 gc.setServiceName("%sService"); mpg.setGlobalConfig(gc); // 数据源配置 DataSourceConfig dsc = new DataSourceConfig(); dsc.setUrl("jdbc:mysql://localhost:3306/vueblog?useUnicode=true&useSSL=false&characterEncoding=utf8&serverTimezone=UTC"); // dsc.setSchemaName("public"); dsc.setDriverName("com.mysql.cj.jdbc.Driver"); dsc.setUsername("root"); dsc.setPassword("123456"); mpg.setDataSource(dsc); // 包配置 PackageConfig pc = new PackageConfig(); pc.setModuleName(null); pc.setParent("com.web.blog"); mpg.setPackageInfo(pc); // 自定义配置 InjectionConfig cfg = new InjectionConfig() { @Override public void initMap() { // to do nothing } }; // 如果模板引擎是 freemarker String templatePath = "/templates/mapper.xml.ftl"; // 如果模板引擎是 velocity // String templatePath = "/templates/mapper.xml.vm"; // 自定义输出配置 List<FileOutConfig> focList = new ArrayList<>(); // 自定义配置会被优先输出 focList.add(new FileOutConfig(templatePath) { @Override public String outputFile(TableInfo tableInfo) { // 自定义输出文件名 , 如果你 Entity 设置了前后缀、此处注意 xml 的名称会跟着发生变化!! return projectPath + "/src/main/resources/mapper/" + "/" + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_XML; } }); cfg.setFileOutConfigList(focList); mpg.setCfg(cfg); // 配置模板 TemplateConfig templateConfig = new TemplateConfig(); templateConfig.setXml(null); mpg.setTemplate(templateConfig); // 策略配置 StrategyConfig strategy = new StrategyConfig(); strategy.setNaming(NamingStrategy.underline_to_camel); strategy.setColumnNaming(NamingStrategy.underline_to_camel); strategy.setEntityLombokModel(true); strategy.setRestControllerStyle(true); strategy.setInclude(scanner("表名,多个英文逗号分割").split(",")); strategy.setControllerMappingHyphenStyle(true); strategy.setTablePrefix("m_"); mpg.setStrategy(strategy); mpg.setTemplateEngine(new FreemarkerTemplateEngine()); mpg.execute(); } }
2021年02月08日
441 阅读
0 评论
0 点赞
2021-02-02
SpingBoot配置七牛云存储
1、七牛云存储相关依赖<!--七牛云存储--> <dependency> <groupId>com.qiniu</groupId> <artifactId>qiniu-java-sdk</artifactId> <version>7.2.28</version> </dependency> <dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <version>2.8.5</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> </dependency>2、yml文件配置#七牛云存储配置 qiniu: accessKey: SVc4nB8AQffickdBj4MoW-lxFX-P8ZzLmuEAcQhh secretKey: s8-4wL8RkOsCooBEcCJbPOZMuavhBL6HNgKW6vYV # 对象储存 bucket: music-web # 空间名称 path: https://file.canace.cn/ # 访问域名3、七牛云Config类配置import com.google.gson.Gson; import com.qiniu.common.QiniuException; import com.qiniu.common.Zone; import com.qiniu.http.Response; import com.qiniu.storage.Configuration; import com.qiniu.storage.UploadManager; import com.qiniu.storage.model.DefaultPutRet; import com.qiniu.util.Auth; import lombok.Data; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import java.io.FileInputStream; /** * 七牛云文件上传 */ @Data @Component public class QiNiuYunConfig { @Value("${qiniu.accessKey}") private String accessKey; @Value("${qiniu.secretKey}") private String secretKey; @Value("${qiniu.bucket}") private String bucket; @Value("${qiniu.path}") private String path; public String uploadToQiNiu(FileInputStream file, String filename) { // 构造一个带指定Zone对象的配置类,注意后面的zone各个地区不一样的 //zone2为华南地区 Configuration cfg = new Configuration(Zone.zone2()); // 其他参数参考类注释 UploadManager uploadManager = new UploadManager(cfg); // 生成密钥 Auth auth = Auth.create(accessKey, secretKey); try { String upToken = auth.uploadToken(bucket); try { Response response = uploadManager.put(file, filename, upToken, null, null); // 解析上传成功的结果 DefaultPutRet putRet = new Gson().fromJson(response.bodyString(), DefaultPutRet.class); // 这个returnPath是获得到的外链地址 String returnPath = getPath() +putRet.key; return returnPath; } catch (QiniuException ex) { Response r = ex.response; System.err.println(r.toString()); try { System.err.println(r.bodyString()); } catch (QiniuException ex2) { //ignore } } } catch (Exception e) { e.printStackTrace(); } return ""; } }4、文件上传Controller() //获取文件名 String fileName = avatorFile.getOriginalFilename(); FileInputStream inputStream = (FileInputStream) avatorFile.getInputStream(); //为文件重命名:uuid+filename fileName = UUID.randomUUID()+ fileName; //上传后文件路径 String storeAvatorPath = qiNiuYunConfig.uploadToQiNiu(inputStream, fileName); //System.out.println(storeAvatorPath); File dest = new File(fileName);
2021年02月02日
323 阅读
0 评论
1 点赞
2021-02-01
vue单页面标题设置 title
推荐使用vue-wechat-title插件安装npm install vue-wechat-title --save用法1,在 main.js 中引入import VueWechatTitle from 'vue-wechat-title'Vue.use(VueWechatTitle)2,在路由文件 index.js 中给每个路由添加 title// 挂载路由const router = new Router({ mode: 'history', routes:[ { path: '/', name: 'Index', component: Index, meta: { title: '首页' // 标题设置 } }]});3,在 app.vue 中修改 router-view 组件<router-view v-wechat-title='$route.meta.title'></router-view>自定义加载的图片地址 默认是 ./favicon.ico 可以是相对或者绝对的<div v-wechat-title="$route.meta.title" img-set="/static/logo.png"></div>
2021年02月01日
312 阅读
0 评论
0 点赞
1
2
3