zysnba
- 浏览: 165717 次
- 性别:
- 来自: 北京
社区版块
- ( 0)
- ( 0)
- ( 0)
最新评论
文章列表
需要引入hutool----工具类
public static string dayofweek(date date) {
int day = dateutil.dayofweek(date);
switch (day) {
case 1:
return "星期天";
case 2:
return "星期一";
case 3:
return " ...
package com.xxx;
import cn.hutool.core.date.datetime;
import cn.hutool.core.date.dateunit;
import cn.hutool.core.date.dateutil;
import cn.hutool.core.util.numberutil;
import org.apache.commons.lang3.stringutils;
import org.apache.commons.lang3.math.numberutils;
import java.text.decimalformat;
import ...
package com.utils;
import java.math.bigdecimal;
import java.util.random;
public class randomutil {
private static final string symbols = "0123456789"; // 数字
private static final string symbols_str = "0123456789abcdefghijklmnopqrstuvwxyz";
/*
* @description: 获取 ...
获取最近10天过生日的sql
- 博客分类:
- 获取最近10天过生日的sql
select
*
from
demo
where
datediff(
cast(
concat(
year ('2023-12-27'),
date_format(birthday, '-%m-%d')
) as date
),
cast(
date_format('2023-12-27', '%y-%m-%d') as date
)
) between 0
and 10
or
datediff(
cast(
concat(
year ('2023-12-27') 1,
date_format(birthday, ...
boot数据校验,全局异常
- 博客分类:
- 数据校验,全局异常
package com.exception;
import com.utils.result;
import lombok.extern.slf4j.slf4j;
import org.springframework.context.support.defaultmessagesourceresolvable;
import org.springframework.dao.duplicatekeyexception;
import org.springframework.validation.bindexception;
import org.springframework.validati ...
select
*,
dayofyear(now()) 7,
dayofyear(birthday)
from
demo
where
birthday >= date_format('2023-08-10', '%y-%m-%d')
and
birthday <= date_format(
date_add('2023-08-10', interval 7 day),
'%y-%m-%d'
)
or dayofyear(birthday) 7 >= ...
public static void main(string[] args) {
listtestlist = new arraylist<>();
test test= new test ();
test.setid(1);
test.setcode("aasdf");
testlist.add(test);
test test2= new test ();
test2.setid(2);
test2.setcode("aasd ...
package com.common;
import lombok.data;
import java.util.arraylist;
import java.util.list;
import java.util.stream.collectors;
/**
* @author zys
* @date 2023/08/2 14:12
*/
@data
public class demo {
private string name;
private int age;
public static list getdemo1() {
...
package com.test.config;
import org.springframework.context.annotation.bean;
import org.springframework.context.annotation.configuration;
import springfox.documentation.builders.apiinfobuilder;
import springfox.documentation.builders.pathselectors;
import springfox.documentation.builders.requesthand ...
使用 classloader.getresourceasstream() 方法
可以使用类加载器来获取资源文件的输入流。该方法接受一个资源文件路径参数,返回一个 inputstream 对象。
inputstream inputstream = getclass().getclassloader().getresourceasstream("file.txt");
注意,该方法返回的资源文件路径是相对于类加载器的根路径。因此,对于 resources 目录下的文件,需要在文件名前加上 "classpath:" 前缀。例如: "classpath ...
第一步引入jar
implementation 'org.freemarker:freemarker:2.3.30'
第二步
新建word,标题和图片为例
插入--文档部件--域---选择autotextlist--新值输入${title}即可。
图片的要在文档里面插入一个图片,然后另存为xml格式即可。
找到编辑器找到图片的代码,替换${image}即可。
标题:${title}
图片:${image}
第三步
public static void main(string[] args) {
try {
configur ...
public class calculateutil {
/**
* @param a 单数 33
* @param b 总数 222
* a / b 计算百分比22/222
* @return
*/
public static string calculateutil(bigdecimal a, bigdecimal b){
string percent =
b == null ? "-" :
b.co ...
查看java进程的命令
- 博客分类:
- 查看java进程的命令
查看java进程的命令
1、查看进程
netstat -ntlp
2、杀掉进程
kill -9 xxxxx
3、启动项目
nohup java -jar demo.jar --server.port=8080 --spring.profiles.active=test & tail -f nohup.out
nohup java -jar demo.jar --server.port=8080 --spring.profiles.active=pro & tail -f nohup.out
4、查看启动日志动态100行
tail -f -n 100 internal ...
https://blog.csdn.net/qiuhaoqian/article/details/120942134
list joincountlist = totaltlist.stream()
.filter(item -> testlist.stream().map(e -> e.getstudentid()).collect(collectors.tolist())
.contains(item.getstudentid())).collect(collectors.tolist());