資源簡介
本項(xiàng)目使用spring spring mybatis框架
分頁使用 pagehelper插件
封裝了base dao service學(xué)生自己查看,每一個(gè)方法都有注釋
每一個(gè)controller大約300行代碼 共15個(gè)controller
依次還有dao service等
有手機(jī)短信發(fā)送功能
后臺登陸地址 http://localhost+端口號+/xymh/login/toLogin.do
前臺登陸地址 http://localhost+端口號+/xymh/login/index.do
注意:在用戶點(diǎn)擊完關(guān)注以后,那么發(fā)布相應(yīng)的內(nèi)容 關(guān)注的人就可以收到消息提示
/*****************************配置注意*****************************************
1..Tomcat的server.xml文件添加虛擬映射,即打開后增加一下代碼:
2..將文件中名稱為my的文件夾 copy到 d盤中 目錄結(jié)構(gòu)為 D:\my
代碼片段和文件信息
package?com.my.xymh.base;
import?net.sf.json.JSONArray;
import?net.sf.json.JSONobject;
import?net.sf.json.JsonConfig;
import?org.slf4j.Logger;
import?org.slf4j.LoggerFactory;
import?com.my.xymh.utils.HttpConstants;
import?com.my.xymh.utils.JsonDateValueProcessor;
import?java.io.Serializable;
import?java.util.Collection;
import?java.util.Date;
import?java.util.Map;
import?java.util.Set;
/**
?*?Controller基類
?*/
public?class?baseController?{
protected?Logger?logger?=?LoggerFactory.getLogger(this.getClass());
protected?final?static?String?DATE_FORMATE?=?“yyyy-MM-dd“;
/**
?*?返回服務(wù)端處理結(jié)果
?*?
?*?@param?obj
?*????????????服務(wù)端輸出對象
?*?@return?輸出處理結(jié)果給前段JSON格式數(shù)據(jù)
?*/
public?String?responseResult(object?obj)?{
JSONobject?jsonObj?=?null;
if?(obj?!=?null)?{
logger.info(“后端返回對象:{}“?obj);
JsonConfig?jsonConfig?=?new?JsonConfig();
jsonConfig.registerJsonValueProcessor(Date.class?new?JsonDateValueProcessor());
jsonObj?=?JSONobject.fromobject(obj?jsonConfig);
logger.info(“后端返回?cái)?shù)據(jù):“?+?jsonObj);
}
logger.info(“輸出結(jié)果:{}“?jsonObj.toString());
return?jsonObj.toString();
}
/**
?*?返回成功
?*?
?*?@param?obj
?*????????????輸出對象
?*?@return?輸出成功的JSON格式數(shù)據(jù)
?*/
public?String?responseSuccess(object?obj)?{
JSONobject?jsonObj?=?null;
if?(obj?!=?null)?{
logger.info(“后端返回對象:{}“?obj);
JsonConfig?jsonConfig?=?new?JsonConfig();
jsonConfig.registerJsonValueProcessor(Date.class?new?JsonDateValueProcessor());
jsonObj?=?JSONobject.fromobject(obj?jsonConfig);
}
logger.info(“輸出結(jié)果:{}“?jsonObj.toString());
return?jsonObj.toString();
}
/**
?*?返回成功
?*?
?*?@param?obj
?*????????????輸出對象
?*?@return?輸出成功的JSON格式數(shù)據(jù)
?*/
public?String?responseArraySuccess(object?obj)?{
JSONArray?jsonObj?=?null;
if?(obj?!=?null)?{
logger.info(“后端返回對象:{}“?obj);
JsonConfig?jsonConfig?=?new?JsonConfig();
jsonConfig.registerJsonValueProcessor(Date.class?new?JsonDateValueProcessor());
jsonObj?=?JSONArray.fromobject(obj?jsonConfig);
logger.info(“后端返回?cái)?shù)據(jù):“?+?jsonObj);
}
logger.info(“輸出結(jié)果:{}“?jsonObj.toString());
return?jsonObj.toString();
}
/**
?*?返回成功
?*?
?*?@param?obj
?*????????????輸出對象
?*?@return?輸出成功的JSON格式數(shù)據(jù)
?*/
public?String?responseSuccess(object?obj?String?msg)?{
JSONobject?jsonObj?=?null;
JSONobject?jsonObj2?=?null;
if?(obj?!=?null)?{
logger.info(“后端返回對象:{}“?obj);
JsonConfig?jsonConfig?=?new?JsonConfig();
//jsonConfig.registerJsonValueProcessor(Date.class?new?JsonDateValueProcessor());
jsonObj?=?JSONobject.fromobject(obj);
jsonObj2?=?new?JSONobject();
jsonObj2.put(“datas“?jsonObj);
jsonObj2.put(“message“?msg);
logger.info(“后端返回?cái)?shù)據(jù):“?+?jsonObj2);
}
logger.info(“輸出結(jié)果:{}“?jsonObj2.toString());
return?jsonObj2.toString();
}
/**
?*?返回失敗
?*?
?*?@param?errorMsg
?*????????????錯(cuò)誤信息
?*?@return?輸出失敗的JSON格式數(shù)據(jù)
?*/
public?String?responseFail(String?
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2017-02-19?22:15??my\
?????文件??????207500??2016-10-06?09:45??my\93708a108b6611e662f0871fae7565a54-120Z1141H3.jpg
?????目錄???????????0??2017-02-19?22:15??my\ueditor\
?????文件???????19761??2017-02-18?22:44??my\ueditor\1487429055006056468.jpg
?????文件???????74099??2017-02-18?22:47??my\ueditor\1487429248115074027.jpg
?????文件???????19761??2017-02-18?22:47??my\ueditor\1487429277944078359.jpg
?????文件??????158141??2017-02-18?23:04??my\ueditor\1487430290289093901.jpg
?????文件???????90058??2017-02-18?23:09??my\ueditor\1487430560778022595.jpg
?????文件???????90058??2017-02-18?23:09??my\ueditor\1487430596395009236.jpg
?????文件??????235245??2017-02-18?23:22??my\ueditor\1487431324363010853.jpg
?????文件???????37732??2017-02-19?15:23??my\ueditor\1487489002134051902.jpg
?????文件???????11999??2017-02-19?15:23??my\ueditor\1487489009576073888.jpg
?????文件??????158141??2017-02-19?20:06??my\ueditor\1487506003970083165.jpg
?????文件???????52364??2017-02-19?20:09??my\ueditor\1487506172712076608.jpg
?????目錄???????????0??2018-05-01?10:03??my\upload\
?????目錄???????????0??2017-02-19?22:15??代碼\
?????目錄???????????0??2017-02-19?22:15??代碼\xymh\
?????文件????????9916??2018-03-19?09:38??代碼\xymh\.classpath
?????文件????????1179??2018-03-19?09:46??代碼\xymh\.project
?????目錄???????????0??2018-05-01?09:45??代碼\xymh\.settings\
?????文件?????????567??2017-02-17?17:25??代碼\xymh\.settings\.jsdtscope
?????文件??????????80??2018-03-19?09:38??代碼\xymh\.settings\com.genuitec.eclipse.migration.prefs
?????文件??????????57??2018-05-01?09:45??代碼\xymh\.settings\org.eclipse.core.resources.prefs
?????文件?????????364??2017-02-17?17:25??代碼\xymh\.settings\org.eclipse.jdt.core.prefs
?????文件?????????541??2017-02-17?17:29??代碼\xymh\.settings\org.eclipse.wst.common.component
?????文件?????????345??2018-03-19?09:38??代碼\xymh\.settings\org.eclipse.wst.common.project.facet.core.xm
?????文件??????????49??2017-02-17?17:25??代碼\xymh\.settings\org.eclipse.wst.jsdt.ui.superType.container
?????文件???????????6??2017-02-17?17:25??代碼\xymh\.settings\org.eclipse.wst.jsdt.ui.superType.name
?????目錄???????????0??2017-02-19?22:15??代碼\xymh\WebContent\
?????目錄???????????0??2017-02-19?22:15??代碼\xymh\WebContent\me
?????文件??????????39??2017-02-17?17:30??代碼\xymh\WebContent\me
............此處省略958個(gè)文件信息
評論
共有 條評論