- 博客(73)
- 收藏
- 关注
原创 每天设备都有变化的情况下统计每天的设备
select a.gmt_create ,sum(cur) from (select count(1) cu ,to_char(gmt_create::timestamp,‘YYYY-MM-dd’) as gmt_create from am_property_standing_book group by to_char(gmt_create::timestamp,‘YYYY-MM-dd’) ) a join (select count(1) cur,to_char(gmt_create::times
2023-03-17 19:46:42
161
原创 es 条件查询简单封装
package com.example.demo.es.dto;import lombok.Data;import lombok.EqualsAndHashCode;import java.io.Serializable;import java.util.List;import java.util.Map;@Datapublic class EsDto implements Serializable {private Integer from;private Integer size;p
2021-09-11 18:08:16
544
原创 jwt根据token获取用户信息
注:JWT_SECERT为加的盐public static Claims parseJWT(String jwt) throws Exception {SecretKey secretKey = generalKey();return Jwts.parser().setSigningKey(secretKey).parseClaimsJws(jwt).getBody();}public static SecretKey generalKey() {byte[] encodedKey = B
2021-07-19 09:56:21
2911
原创 sql 递归查询
with recursive r as(select * from SYS_CODE where 1=1AND id = #{id}union allselect c.* from SYS_CODE c,r where r.ID = c.PID)select r.* from r order by r.ID
2021-07-14 09:32:31
136
原创 sqlserver查询表结构
SELECTtab.name AS tableName,col.name AS column_name,per.value AS column_comment,col.is_identity AS column_key,type.name AS data_type,col.max_length AS column_lengthFROMsys.columns colINNER JOIN sys.tables tab ON col.object_id = tab.object_idLEFT
2021-07-06 11:07:45
138
原创 java8函数式编程去重例子
public static void main(String[] args) { List list = new ArrayList(); list.stream().filter(get(m->((Map)m).get(""))).collect(Collectors.toList());}public static Predicate get(Function predicate){ Set set = ConcurrentHashMap.newKeySet()
2021-06-23 09:39:14
180
原创 使用socket匹配http头部及正文
String s = “HTTP/1.1 200 OK\nConnection:Keep-Alive\nContent-Type:text/plain;charset=UTF-8\nAccept:/\nKeep-Alive:timeout=60\nDate:”+new Date() +"\r\n\r\n正文";
2021-06-20 01:51:53
178
原创 springboot 含有 pom.xml dependencyManagement标签打包不成功
org.springframework.boot spring-boot-maven-plugin repackage ...
2021-06-10 10:26:12
307
原创 java webservice设置环境变量
bat文件写入setx _JAVA_OPTIONS -Djava.net.preferIPv4Stack=true重启生效
2021-03-21 07:18:30
223
原创 logbak记录日志
logback-spring.xml配置日志<?xml version="1.0" encoding="UTF-8"?> <!-- 彩色日志 --><!-- 彩色日志依赖的渲染类 --><conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
2021-02-04 15:44:05
156
原创 swagger doc需要引入的jar及配置
<dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger-ui</artifactId> <version>2.9.2</version> </dependency> <dependency> <groupId>io.springfox</groupId> <
2020-12-07 14:39:53
1146
2
原创 分库分表触发器
CREATE OR REPLACE FUNCTION info_trigger()RETURNS TRIGGER AS $$declare exists_year int default 0;declare infos varchar default ‘test_’;declare strSql varchar default ‘’;BEGIN infos:= infos||split_part(NEW.date ,'-', 1)||'_'||split_part(NEW.date ,'-',
2020-11-25 16:48:54
238
原创 postgre存储过程加游标
CREATE OR REPLACE FUNCTION get_film_titles()RETURNS text AS $$– 声明游标DECLAREids int4 default 703;titles TEXT DEFAULT ‘’;rec_film RECORD;cur_films CURSOR FOR SELECT * FROM jobs ;BEGIN– 打开游标OPEN cur_films ;LOOP– 获取记录放入filmFETCH cur_films INTO r
2020-09-19 11:36:23
491
原创 javaweb允许任何使用
@Configurationpublic class CorsConfig implements WebMvcConfigurer {@Beanpublic WebMvcConfigurer corsConfigurer(){return new WebMvcConfigurer() {@Overridepublic void addCorsMappings(CorsRegistry registry) {registry.addMapping("/**").allowedOrigins("
2020-09-17 14:41:56
307
1
原创 线程池实例
public Executor asyncServiceExecutor() {ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();//配置核心线程数executor.setCorePoolSize(10);//配置最大线程数executor.setMaxPoolSize(80);//配置队列大小executor.setQueueCapacity(1000);//配置线程池中的线程的名称前缀executor.setT
2020-09-11 15:05:08
342
原创 postgre安装好插件后,需要添加支持
CREATE EXTENSION postgis;CREATE EXTENSION pgrouting;CREATE EXTENSION postgis_topology;CREATE EXTENSION fuzzystrmatch;CREATE EXTENSION postgis_tiger_geocoder;
2020-09-07 17:38:38
140
原创 左连接数据大于左表数据
以前以为左连接以左表为主表,返回的结果集不会大于左表,今天做了个项目发现大于左表数据,总结以后尽量用id(主键)做连接
2020-08-18 15:24:22
1109
3
原创 数据库时间比较
TIMESTAMPDIFF(DAY,‘2012-10-01’,‘2013-01-13’);其中DAY可选参数有可以比较FRAC_SECOND、SECOND、 MINUTE、 HOUR、 DAY、 WEEK、 MONTH、 QUARTER或 YEAR几种类型,第二个和第三个参数是待比较的两个时间
2020-08-18 10:31:25
325
1
原创 动态加载数据源
public String getDataSource(DataSourceEntity dataSourceEntity) {DruidDataSource druidDataSource = new DruidDataSource( );druidDataSource.setUrl(dataSourceEntity.getUrl());druidDataSource.setUsername(dataSourceEntity.getUserName());druidDataSource.setP
2020-06-09 08:46:33
415
1
原创 myeclipse激活ACTIVATION_KEY为null
本人是激活过myeclipse后重装的,ACTIVATION_KEY一直为空,自己网上找了好久,都不见效,最后无意中点了一下rebuild key,然后点击active,结果出来,总结,遇到问题多思考,多动手,多点点...
2020-04-13 14:15:18
1102
1
原创 获取html的片段代码
etree_html = etree.HTML(html.text) sContent = etree_html.xpath('//*[@class="m-down"]')[0]sContent = etree.tostring(sContent,encoding='utf-8')
2020-03-05 11:11:56
258
原创 JAVASE maven打成可运行jar
<build><plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <configur...
2020-01-30 11:49:03
266
原创 springboot启动时执行任务CommandLineRunner
平常开发中有可能需要实现在项目启动后执行的功能,SpringBoot提供的一种简单的实现方案就是添加一个model并实现CommandLineRunner接口,实现功能的代码放在实现的run方法中...
2019-12-12 15:27:09
88
原创 小程序post请求
需要设置 header: { “Content-Type”: “application/x-www-form-urlencoded”},wx.request({url: app.globalData.url + “/tasks/getPtilteAndTasks”,method:“POST”,header: { “Content-Type”: “application/x-www-for...
2019-11-27 17:29:13
119
原创 页面加载前触发
(function ($) { var userAgentInfo = navigator.userAgent; var mobileAgents = [ "Android", "iPhone", "SymbianOS", "Windows Phone", "iPad","iPod"]; var mobile_flag = false; //根...
2019-11-09 18:18:36
174
原创 linux端口映射
firewall-cmd --zone=public–add-port=80/tcp --permanentfirewall-cmd --add-forward-port=port=8081:proto=tcp:toport=8080:toaddr=10.1.1.46 --permanent
2019-08-22 10:19:54
147
原创 向私服传递jar
<repository>snapshotshttp://xxx.xxx.xxx.xxx/maven-releases/setting.xml配置snapshots(和上面的id对应)用户名密码
2019-08-19 18:12:24
80
原创 自定义异常
1.首先定义一个异常继承异常类,(extends Exception)2.根据给定的条件抛出异常(throw 定义的异常)3.调用这个方法,try…catch…捕获异常
2019-07-26 18:19:35
72
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人