随笔分类 - 日常
摘要:字符串长度都是调用String类的length()方法,通常这样就可以,但是现在项目中需要汉字的长度是2,所以说需要换个写法 public static int stringLength(String str) { int stringLength = 0; try { if (str != nul
阅读全文
摘要:oracle数据库,定义的TIMESTAMP类型,从数据库中取出作时间对比的时候,发现取出是Sun Oct 24 20:49:20 CST 2021这种格式,需要转换为常见的日期格式作对比 public static void main( String[] args ) { String t1 =
阅读全文
摘要:查看配置 show variables like '%increment%'; 如果: auto_increment_increment=2 执行: set @@global.auto_increment_increment = 1; set @@auto_increment_increment =
阅读全文
摘要:上传到指定的路径,并以当前的日期分类 public String add(MultipartFile file) throws Exception { String path = null;// 文件路径 if (file != null) {// 判断上传的文件是否为空 String type =
阅读全文
摘要:添加依赖 <!--阿里云存储--> <dependency> <groupId>com.aliyun.oss</groupId> <artifactId>aliyun-sdk-oss</artifactId> <version>3.10.2</version> </dependency> <!--
阅读全文
摘要:今天遇到了条件中使用时间参数,数据库是Oracle的,查阅MyBatis Plus QueryWrapper 默认提供的几个方式都不行, 这种时间查询 // 预警时间 if (warning.getWarningTimeParams() != null && warning.getWarningTi
阅读全文
摘要:首先在启动类似添加注解 @EnableTransactionManagement 然后在service的实现方法上添加注解 @Transactional(rollbackFor = CustomException.class) 这里使用自定义异常进行处理,抛自定义异常进行数据的回滚 package
阅读全文
摘要:Mybaits-plus 中,两张表组合查询,xml方式 在FlowMapper接口中自定义接口 public interface FlowMapper extends BaseMapper<Flow> { List<Flow> pageList(FlowDTO dto); } 手动添加FlowMa
阅读全文
摘要:查询状态 0 的有数据但是不显示 需要在数据库默认设置的字段长度设置为1
阅读全文
摘要:使用oracle数据库时,mybatis-plus设置自增,添加数据的时候失败 @TableId(value = "ID", type = IdType.AUTO) private Integer id; ; ORA-01400: 无法将 NULL 插入 ("JIANG"."T_PRODUCT"."
阅读全文
摘要:主要根据概率返回每次抽到的奖品, 以下是抽奖工具类 package com.ruoyi.project.dy.utils; import java.util.ArrayList; import java.util.List; import java.util.Random; /** * @descr
阅读全文

浙公网安备 33010602011771号