待学习
计算机网络:ipv6 部分
echarts 网课:前边布局,后面地图
ztree 的使用
jstree 的 demo
java 底层:2 进制,10 进制,移位,源码,补码,反码
前端关于滚动条的各个属性:clientHeight offsetHeight scrollHeight offsetTop scrollTop
redis 实战
js 高级
mysql 游标的使用
idea 工具的系统使用
传入集合循环查询并用union组合
实例:接口
/** * selectOverrunData:查询一个单次计划某个行别某个速度级下各个超限类型的占比 * * @param testTaskId 测试任务id * @param xb 行别 * @param speedLevel 速度级 * @param type 超限还是大值 * @param labelList 通道名称集合 * @return * @author Zhangyuhan * @date 2021/7/8 15:03 */ List<Map<String, Object>> selectStatisticalInformation(@Param("testTaskId") String testTaskId, @Param("xb") String xb, ...
mybatis中$和#的使用场景
group by 字段 ,order by 字段,表名,字段名,如果是动态的用$
limit 用#
其他的用#
判断字符串相等时的注意事项
mybatis 映射文件中,if 标签判断字符串相等,两种方式:
因为 mybatis 映射文件,是使用的 ognl 表达式,所以在判断字符串 sex 变量是否是字符串 Y 的时候,
<if test="sex=='Y'.toString()"><if test = 'sex== "Y"'>
注意:不能使用
<if test="sex=='Y'">and 1=1</if>
因为 mybatis 会把’Y’解析为字符,所以不能这样写 会报 NumberFormatException
MyBatis 是使用的 OGNL 表达式来进行解析的,这个地方有一个坑需要注意下,单引号内有一个字符的情况下,OGNL 会将其以 java 中的 char 类型进行解析,那么此时 char 类型与参数 String 类型用等号进行比较的时候结果都是 false。解决方案也很简单,就是讲 test 中的单个字符用双引号括起来。
<wher ...
批量插入和批量更新
批量插入<insert id="insertTgAfterCorrectData"> insert into dtjc_tg_after_correct_data( id, left_low ) values <foreach item="item" index="index" collection="list" separator=","> ( #{item.id}, #{item.left_low} ) </foreach> </insert>
批量更新更新多条数据,每条数据都不一样背景描述:通常如果需要一次更新多条数据有两个方式,(1)在业务代码中循环遍历逐条更新。(2)一次性更新所有数据(更准确的说是一条 ...
在maven库上添加手动添加第三方jar包
进入到放这个 jar 包的文件夹,运行 cmd
然后根据下面的例子手动自己可以尝试着添加
mvn install:install-file -Dfile=aspose-words-16.4.0-jdk16.jar -DgroupId=com.aspose.word -DartifactId=aspose.words -Dversion=16.4.0-jdk16 -Dpackaging=jar -DgeneratePom=true
<dependency> <groupId>com.aspose.word</groupId> <artifactId>aspose.words</artifactId> <version>16.4.0-jdk16</version></dependency>
实现if-else
<choose> <when test="item.tdName == 'hor_acceleration'"> '0' as horAcceleration, </when> <otherwise> hor_acceleration as horAcceleration, </otherwise></choose>
批量插入大数据
思路分析批量插入这个问题,我们用 JDBC 操作,其实就是两种思路吧:
用一个 for 循环,把数据一条一条的插入(这种需要开启批处理)。
生成一条插入 sql,类似这种 insert into user(username,address) values(‘aa’,‘bb’),(‘cc’,‘dd’)…。到底哪种快呢?
我们从两方面来考虑这个问题:
插入 SQL 本身执行的效率。
网络 I/O。
先说第一种方案,就是用 for 循环循环插入:
这种方案的优势在于,JDBC 中的 PreparedStatement 有预编译功能,预编译之后会缓存起来,后面的 SQL 执行会比较快并且 JDBC 可以开启批处理,这个批处理执行非常给力。
劣势在于,很多时候我们的 SQL 服务器和应用服务器可能并不是同一台,所以必须要考虑网络 IO,如果网络 IO 比较费时间的话,那么可能会拖慢 SQL 执行的速度。
再来说第二种方案,就是生成一条 SQL 插入:
这种方案的优势在于只有一次网络 IO,即使分片处理也只是数次网络 IO,所以这种方案不会在网络 IO 上花费太多时间。
当 ...
项目打成jar包时,将项目下的文件,以及所有的依赖打成一个jar包
例子:在做一个单机的用 maven 管理的 swing 项目时,引入了 poi,但是打成的 jar 包里没有 poi 的依赖,导致用 exe4j 转换出的 exe 程序报错(Caused by: java.lang.NoClassDefFoundError)
这种错误就是没有将依赖打包进去导致的,所以最好打包成单个 jar 包。
解决办法:在 maven 里加入以下插件
<plugin> <artifactId>maven-assembly-plugin</artifactId> <configuration> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> </configuration></plugin>
在项目的根目录下执行(在执行以下任意操作前别忘了 clean。清除以前的 target 文件夹)mvn assembly:as ...
将普通项目托付给maven管理
如需将一个 java 项目托付给 maven 管理。在项目的根目录下,建个 pom.xml 把以下内容复制进去。同时右键把该项目标记为 maven 项目(不同的 idea 版本该操作的名称可能不一样)
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <!--组id--> <g ...
and() 和 or()的嵌套使用
and 里面嵌套 or 如下使用
QueryWrapper<ErrorData> ew = new QueryWrapper<>();ew.eq("dcjh_id", csrwInfo.getCsrwID()).and(wrapper -> wrapper.eq("wtlx", "0").or().eq("wtlx", "1"));// where dcjh_id = '' and (wtlx = '0' or wtlx = '1'),注意:这里是一个lambda表达式List<ErrorData> dataList = errorDataService.list(ew);
项目的jar包都正常引用了,但是build时就是提示jar包不存在的解决办法
如题,编译和打包都是正常的,pom 文件中依赖存在并且没有报错。找到相应包的引用位置,也能正常访问包中的内容。而且提示的一般都是基础的 jar 包找不到,比如单元测试用到的 jar 包等。。。
情形一:
其他同事提交代码时把 idea 中的 .iml 文件也一起提交了,该文件中配置的 jdk lib 路径与自己电脑中的该路径不一致。
解决方法很简单,执行一下 maven update 即可,也可以手动修改 .iml 文件中的该路径。
情形二:
排除情形一出现的原因,或使用情形一中的方法解决无效时,可以使用以下命令更新不完整依赖:
mvn -U idea:idea
需要注意的是,该命令使用的插件早在 13 年就已经停止维护,所以有可能出现各种问题,比如我遇到过的空指针异常。
情形三:
使用情形二中的方法解决无效时,可以使用以下方法再次尝试
ctrl + alt + shift + s 或 在界面菜单选择 File —> Project Structure
点击 Libraries 找到提示不存在的 jar 包(这里以 junit 为例),选中,然后右键打开菜单,选择 Conver ...
自带的分页插件的使用
建一个 page 对象传入前台的 page,和 limit 参数(推荐使用泛型,限定返回的参数类型,例子的话应该是 Page\)
调用 dao 或者 service 层时传入 page 对象
Page pages = new Page(Integer.valueOf(page), Integer.valueOf(limit));List<Map> list = dtjcXmGeneralreportService.getCxList(pages, csrwId,xlId,xb,ppbzId,Integer.valueOf(topSpeed));
service 接口层
List<Map> getCxList(Page pages, String csrwId, String xlId, String xb,String bz,Integer topSpeed);
service 层
@Override public List<Map> getCxList(Page pages, String csrwId, String xlId, String x ...
使用QueryWrapper关于时间日期比较的问题
首先明确。springmvc 默认不支持将前台传过来的日期/日期时间字符串在到达 controller 层之前直接转成 Date/LocalDate/LocalDateTime 类型的,所以接收还是要用字符串类型接收
mp 的条件构造器不支持时间日期字符串与 mysql 的 date/datetime 类型的字段的比较
所以在比较的时候。要这么写
//query:startDate->String,endDate->String,例子:2020-08-01//jcrq:mysql->date类型的// 应该同样适用2020-08-01 08:00:00的字符串和mysql中datetime类型的比较// 可以这么理解。统一转成时间戳再进行比较QueryWrapper<TSjfxJcjl> qw = new QueryWrapper<>();qw .apply(!StringUtils.isEmpty(query.getStartDate()), "UNIX_TIMESTAMP(jcrq) >= UNIX_TIM ...
常用api整理
public static final Object parse(String text); // 把JSON文本parse为JSONObject或者JSONArraypublic static final JSONObject parseObject(String text); // 把JSON文本parse成JSONObjectpublic static final <T> T parseObject(String text, Class<T> clazz); // 把JSON文本parse为JavaBeanpublic static final JSONArray parseArray(String text); // 把JSON文本parse成JSONArraypublic static final <T> List<T> parseArray(String text, Class<T> clazz); //把JSON文本parse成JavaBean集合public static final String toJSON ...
容器滚动条出现的条件
容器出现滚动条的条件:1,容器有固定的高度,2,容器的内容高度,超出了容器的高度,如果容器未设定高度,则它会向父亲,祖先找到有高度的容器,并在其身上显示滚动条
向静态类注入bean
方式1@Componentpublic class DtjcProjectGeneralReportUtil { @Autowired private IDataAnalysisService dataAnalysisService; private static IDataAnalysisService staticDataAnalysisService; @PostConstruct public void init() { staticDataAnalysisService = dataAnalysisService; } // 这里是静态方法,该方法请调用静态bean public static String getDtcjGeneralReportTestTaskId(String projectId) { String TestTaskId = ""; TestTaskId = staticDataAnalysisServic ...
node的环境安装
nvm建议先安装 nvm,而不是直接安装 node
nvm 是什么nvm 全英文也叫 node.js version management,是一个 nodejs 的版本管理工具,为了解决 node.js 各种版本存在不兼容现象可以通过它可以安装和切换不同版本的 node.js。可在点此在上下载最新版本
nvm 命令提示
nvm arch:显示 node 是运行在 32 位还是 64 位。
nvm install <version> [arch] :安装 node, version 是特定版本也可以是最新稳定版本 latest。可选参数 arch 指定安装 32 位还是 64 位版本,默认是系统位数。可以添加—insecure 绕过远程服务器的 SSL。
nvm list [available] :显示已安装的列表。可选参数 available,显示可安装的所有版本。list 可简化为 ls。
nvm on :开启 node.js 版本管理。
nvm off :关闭 node.js 版本管理。
nvm proxy [url] :设置下载代理。不加可选参数 url,显示当前代理 ...
openFeign的全方位简单讲解
OpenFeign 全方位讲解_Young 丶的博客-CSDN 博客_openfeign
自适应宽度的input框
解决办法 1:div 的 contenteditable=”true”属性。能实现一行编辑。待解决的问题:需要禁止回车换行,同时还有编辑完之后光标不会回到最开始,光标会保留在你最后编辑的地方
<div class="dict_val1" contenteditable="true" id="lineLength"></div>
div[contenteditable] { height: 0.1458rem; line-height: 0.1458rem; /*重要*/ width: auto; min-width: 0.1458rem; white-space: nowrap; overflow: hidden; outline: none; /*重要*/ color: #001631; padding: 0 0.0677rem;}
开启编辑状态的话只需把 outline 的 none 去掉就行,改为默认状态或自定义属性如 outline:#00FF00 do ...