@@ -0,0 +1,2426 @@
+package net.iotlabs.db;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.HashMap;%0A%0Aimport org.apache.ibatis.session.SqlSession;%0A%0Aimport com.google.gson.Gson;%0A%0Apublic class CommonDao %7B%0A%09%0A    private Gson gson = new Gson();%0A    %0A%09public HashMap%3CString, String%3E commonSelectOne(String query, HashMap p) %7B%0A%09%09%0A%09%09HashMap result = null;%0A%09%09SqlSession session = MyBatisManager.getSqlMapper().openSession();%0A        try %7B%0A        %09result = (HashMap%3CString, String%3E)session.selectOne(query, p);%0A        %7D finally %7B%0A        %09session.close();%0A        %7D%0A        return result;%0A%09%7D%0A%09%0A%09public HashMap%3CString, Object%3E commonSelectOneObject(String query, HashMap p) %7B%0A%09%09%0A%09%09HashMap result = null;%0A%09%09SqlSession session = MyBatisManager.getSqlMapper().openSession();%0A        try %7B%0A        %09result = (HashMap%3CString, Object%3E)session.selectOne(query, p);%0A        %7D finally %7B%0A        %09session.close();%0A        %7D%0A        return result;%0A%09%7D%0A%09%0A%09public ArrayList%3CHashMap%3E commonSelectList(String query, HashMap p) %7B%0A        ArrayList%3CHashMap%3E list = new ArrayList();%0A        SqlSession session = MyBatisManager.getSqlMapper().openSession();%0A        try %7B%0A        %09list = (ArrayList%3CHashMap%3E) session.selectList(query, p);%0A        %7D finally %7B%0A        %09session.close();%0A        %7D%0A        return list;%0A%09%7D%0A%09%0A%09public int commonInsert(String query, HashMap p) %7B%0A%09%09%0A        int result = 0;%0A        SqlSession session = MyBatisManager.getSqlMapper().openSession();%0A        try %7B%0A        %09result = session.insert(query, p);%0A        %09if (result == 1) %7B %0A        %09%09session.commit();%0A        %09%7D else %7B%0A        %09%09session.rollback();%0A        %09%7D%0A        %7D finally %7B%0A        %09session.close();%0A        %7D%0A        return result;%0A%09%7D%0A%09%0A%09%0A%09public int commonUpdate( String query, HashMap p)%7B%0A%09%09%0A        int result = 0;%0A        SqlSession session = MyBatisManager.getSqlMapper().openSession();%0A        try %7B%0A        %09result = session.update(query, p);%0A        %09if (result == 1) %7B %0A        %09%09session.commit();%0A        %09%7D else %7B%0A        %09%09session.rollback();%0A        %09%7D%0A        %7D finally %7B%0A        %09session.close();%0A        %7D%0A        return result;%0A%09%7D%0A%09%0A%09public int commonDelete( String query, HashMap p)%7B%0A%09%09%0A%09%09%0A        int count = 0;%0A        SqlSession session = MyBatisManager.getSqlMapper().openSession();%0A        try %7B%0A        %09count = session.delete(query, p);%0A        %09session.commit();%0A        %7D finally %7B%0A        %09session.close();%0A        %7D%0A        %0A        return count;%0A%09%7D%0A%7D%0A

Add a CommonDao