ReturnObject:定义返回结果
public class ReturnObject { private String code;//处理成功或者失败的标记;1---成功;0----失败 private String message;//成功或者失败的提示 private Object retDate;//其他返回的信息 public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public Object getRetDate() { return retDate; } public void setRetDate(Object retDate) { this.retDate = retDate; }
constant:设置code的值
public class Constant { //设置工具类DateUtils中code的值 public static final String RETURN_OBJECT_CODE_SUCCESS = "1"; public static final String RETURN_OBJECT_CODE_FAIL = "0"; //保存当前用户的key public static final String SESSION_USER = "sessionUser"; }
UUID:获取uuid
/** * @author 获取UUID的值 * @description: TODO * @date 2023/2/16 17:12 */ public class UUIDUtils { public static String getUUID(){ return UUID.randomUUID().toString().replaceAll("-",""); } }
DateUtils:时间格式化
public class DateUtils { // 因为是工具类,所以怎么好用怎么来 //static:可直接通过类名调用 /** * 对指定对象进行格式化:yyyy-MM-dd HH:mm:ss * @param date * @return */ public static String formateDateTime(Date date){ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String str = sdf.format(date); return str; } /** * 对指定对象进行格式化:yyyy-MM-dd * @param date * @return */ public static String formateDate(Date date){ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); String str = sdf.format(date); return str; } /** * 对指定对象进行格式化:HH:mm:ss * @param date * @return */ public static String formateTime(Date date){ SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); String str = sdf.format(date); return str; } }
...
标签:code,return,String,static,common,date,public From: https://www.cnblogs.com/dbconfig1/p/17188269.html