- 博客(11)
- 收藏
- 关注
原创 通过MultipartFile获取图片宽高
MultipartFile转File再获取 MultipartFile multipartFile = uploadReq.getFile(); // 获取请求传过来的MultipartFile String fileName = multipartFile.getOriginalFilename(); String prefix=fileNam...
2018-10-11 16:03:20
11954
原创 Spring Boot中@Valid方法常用注解
使用背景请求数据校验(目前我只在这块使用过)使用方式在请求实体中加上注解,示例:(注意内部类的校验需要额外加上@Valid注解)@Datapublic class Demo1 extends BaseReq { @NotBlank(message = "名称不能为空") @Length(min = 1, max = 25, message = "名称只能有1-25个...
2018-10-10 11:02:50
4197
原创 使用Calendar遇到的坑
Calendar.HOUR和Calendar.HOUR_OF_DAY背景:需要判断某个时间段(该时间段不会跨天)是否在当天,于是用到Calender获取当天的开始和结束时间。 错误使用如下:Calendar todayStart = Calendar.getInstance();todayStart.set(Calendar.HOUR, 0);todayStart.set(Cal...
2018-09-13 16:46:23
3028
原创 LeetCode专栏L020_Valid_Parentheses
问题描述: Given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[’ and ‘]’, determine if the input string is valid.The brackets must close in the correct order, “()” and “()[]{}” are all val
2017-05-17 15:26:37
213
原创 LeetCode专栏L013_Roman_to_Integer
问题描述: Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.中文大意: 将罗马字符转换成相应的数字。输入的数字在1-3999之间。解题思路: 从前往后扫描。 res为最后的结果。记录一个pre一个cur,pre表示res已经
2017-05-11 20:04:07
265
原创 LeetCode专栏L009_Palindrome_Number
问题描述: Determine whether an integer is a palindrome. Do this without extra space.中文大意: 判断一个数是不是回文数,注意不能用额外空间。解题思路: 1.变成字符串比较。但是不能用额外空间,此处不可行。 2.反转数字后比较。参照L007_Reverse_Integer,我们知道反转后的数值可能超出范围,故不可
2017-05-11 17:41:55
221
原创 LeetCode专栏L007_Reverse_Integer
问题描述: Reverse digits of an integer.Example1: x = 123, return 321 Example2: x = -123, return -321Note: The input is assumed to be a 32-bit signed integer. Your function should return 0 when the reve
2017-05-11 13:13:47
372
原创 访问控制符
private → default → protected → public 访问控制级别由小到大private:这个成员只能在当前类的内部被访问。default:可以被相同包下的其他类访问。protected:可以被相同包下的其他类访问,也可以被不同包的子类访问。一般情况下,用protected修饰的方法,通常是希望子类来重写这个方法。public:可以被所有类访问。
2017-05-04 18:51:56
353
原创 LeetCode专栏L001_Two_Sum
问题描述: Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use the s
2017-04-28 11:02:41
237
原创 java静态初始化块、普通初始化块、构造器执行顺序
package test;class Root { static { System.out.println("Root的静态初始化块"); } { System.out.println("Root的普通初始化块"); } public Root() { System.out.println("Root的无参构造器"
2017-04-25 20:05:07
552
原创 ASP.NET WriteFile下载文件
/// 使用WriteFile下载文件 /// </summary> /// <param name="filePath">相对路径</param> public void WriteFile(string filePath) { try { string _pre_path = filePath;
2017-04-21 13:11:23
981
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人