Status.java 2.07 KB
Newer Older
罗绍泽 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
package com.jw.app.business.utils;

import java.util.HashMap;
import java.util.Map;

public class Status {

	public Status() {
		
	}
	
	public static final int INSERT_OK = 1;
	public static final int UPDATE_OK = 2;
	public static final int INSERT_ERR = 3;
	public static final int UPDATE_ERR = 4;
	public static final int DELETE_OK = 5;
	public static final int DELETE_ERR = 6;
	public static final int PASS_OK = 7;
	public static final int PASS_ERR = 8;
	public static final int INSERT_OK_RETURNID = 11;
	
	
	public static Map<String,Object> getStatus(int status){
		Map<String,Object> m = new HashMap<String,Object>();
		switch(status){
		  case 1:{
			  m.put("NAME", "1");
			  m.put("VALUE", "保存成功!");
			  break;
		  }
		  case 2:{
			  m.put("NAME", "2");
			  m.put("VALUE", "更新成功!");
			  break;
		  }
		  case 3:{
			  m.put("NAME", "-1");
			  m.put("VALUE", "保存失败!");
			  break;
		  }
		  case 4:{
			  m.put("NAME", "-2");
			  m.put("VALUE", "更新失败!");
			  break;
		  }
		  case 5:{
			  m.put("NAME", "3");
			  m.put("VALUE", "删除成功!");
			  break;
		  }
		  case 6:{
			  m.put("NAME", "-3");
			  m.put("VALUE", "删除失败!");
			  break;
		  }
		  case 7:{
			  m.put("NAME", "4");
			  m.put("VALUE", "密码修改成功!");
			  break;
		  }
		  case 8:{
			  m.put("NAME", "-4");
			  m.put("VALUE", "密码修改失败!");
			  break;
		  }
		  default:{
			  m.put("NAME", "0");
			  m.put("VALUE", "返回有误!");
			  break;
		  }
		}
		return m;
	}
	
	public static Map<String,Object> getStatusErrorMessage(String message){
		Map<String,Object> m = new HashMap<String,Object>();
		m.put("NAME", "-999");
		m.put("VALUE", "失败,("+message+")!");
		return m;
	}
	
	public static Map<String,Object> getStatus(int status,String uuid){
		Map<String,Object> m = new HashMap<String,Object>();
		switch(status){
		  case 11:{
			  m.put("NAME", "11");
			  m.put("VALUE", "保存成功!");
			  m.put("RETURNUUID", uuid);
			  break;
		  }
		  default:{
			  m.put("NAME", "0");
			  m.put("VALUE", "返回有误!");
			  break;
		  }
		}
		return m;
	}

}