随笔分类 -  utils

Object转换List
摘要:public static <T> List<T> castList(Object obj, Class<T> clazz) { List<T> result = new ArrayList<T>(); if (obj instanceof List<?>) { for (Object o : (L 阅读全文
posted @ 2020-12-03 16:19 西门夜说 阅读(1812) 评论(0) 推荐(0)
LinkedHashMap转对象
摘要:对象 对象 = JSON.parseObject(JSON.toJSONString(这里是LinkedHashMap对象), new TypeReference<这里是需要转换成的对象>() { }); 阅读全文
posted @ 2020-11-09 00:48 西门夜说 阅读(4057) 评论(0) 推荐(0)
java返回数据的封装
摘要:package entity; /** * 返回结果实体类 */ public class Result<T> { private boolean flag;//是否成功 private Integer code;//返回码 private String message;//返回消息 private 阅读全文
posted @ 2020-06-02 00:22 西门夜说 阅读(963) 评论(0) 推荐(0)
java 处理树形结构工具类
摘要:<dependency> <groupId>javax.validation</groupId> <artifactId>validation-api</artifactId> <version>2.0.1.Final</version></dependency> package com.ytkj. 阅读全文
posted @ 2020-02-29 21:24 西门夜说 阅读(1946) 评论(0) 推荐(0)
DateTimeUtils 日期工具类
摘要:import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.DateFormatUtils; import java.text.ParseException; import java.text.S 阅读全文
posted @ 2020-02-25 15:46 西门夜说 阅读(1166) 评论(0) 推荐(0)
阿里云短信服务工具类
摘要:application.yml: 去阿里云短信服务模块自己申请 accessKeyId:accessKeySecret: 编写配置类读取配置文件 @ConfigurationProperties(prefix = "ximen.sms") @Component public class SmsPro 阅读全文
posted @ 2020-02-09 00:20 西门夜说 阅读(801) 评论(0) 推荐(0)
vue.config.js
摘要:const path = require("path"); const resolve = function(dir) { return path.join(__dirname, dir); }; module.exports = { publicPath: "./", outputDir: "di 阅读全文
posted @ 2020-02-03 11:04 西门夜说 阅读(547) 评论(0) 推荐(0)
vue 实时显示年月日时分秒星期上下午
摘要:export default class GlobalHeader extends Vue { time: any = '' timeFormate(dt: any) { let yy = dt.getFullYear(); let mm = dt.getMonth() + 1; let dd = 阅读全文
posted @ 2020-01-20 09:18 西门夜说 阅读(1295) 评论(0) 推荐(0)
数组转化树函数
摘要://数组转化为树 function arraytotree(arr) { var top = [], sub = [], tempObj = {}; arr.forEach(function (item) { if (item.parentId 0) { // 顶级分类 top.push(item) 阅读全文
posted @ 2020-01-19 00:29 西门夜说 阅读(349) 评论(0) 推荐(0)
vue 对axios get pust put delete 封装
摘要:axios.js import axios from 'axios'; import Qs from 'qs'; import {Message} from 'element-ui'; axios.defaults.baseURL = "/api"; // 设置请求超时时间 axios.defaul 阅读全文
posted @ 2020-01-05 02:32 西门夜说 阅读(4927) 评论(0) 推荐(2)
java返回分页结果集的封装
摘要:package com.leyou.common; import java.util.List; public class PageResult<T> { private long total;//总条数 private Integer totalPage;//总页数 private List<T> 阅读全文
posted @ 2020-01-04 21:09 西门夜说 阅读(2012) 评论(0) 推荐(1)
vue axios的封装
摘要:在根目录上创建一个vue.config.js文件 const path = require("path"); const resolve = function(dir) { return path.join(__dirname, dir); }; module.exports = { publicP 阅读全文
posted @ 2019-12-29 04:31 西门夜说 阅读(418) 评论(0) 推荐(0)
java返回数据的封装
摘要:public class Result<T> { private Integer code; private String msg; private T data; public Result() { super(); } public Result(Integer code, String msg 阅读全文
posted @ 2019-12-29 00:40 西门夜说 阅读(2482) 评论(0) 推荐(1)
接口调用post请求参数在body中
摘要:package com.ynhrm.common.utils; import com.alibaba.fastjson.JSONObject; import lombok.Data; import org.apache.http.Consts; import org.apache.http.clie 阅读全文
posted @ 2019-11-28 01:26 西门夜说 阅读(30122) 评论(0) 推荐(0)