首页>代码>spring+spring mvc+hibernate开发工程财务管理辅助系统>/FMS/src/com/mvc/controller/common/CommonController.java
package com.mvc.controller.common; import javax.servlet.http.HttpSession; import net.sf.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.mvc.controller.base.BaseController; import com.mvc.framework.constant.GlobalConstant; import com.mvc.pageModel.base.Json; import com.mvc.pageModel.base.SessionInfo; import com.mvc.pageModel.sys.UploadInfo; import com.mvc.service.common.CommonServiceI; @Controller @RequestMapping("/common") public class CommonController extends BaseController{ @Autowired private CommonServiceI commonService; @RequestMapping("/upload") @ResponseBody public Json upload(UploadInfo info,HttpSession session) { Json j = new Json(); try { SessionInfo sessionInfo = (SessionInfo) session.getAttribute(GlobalConstant.SESSION_INFO); if(sessionInfo!=null) { info.setUserId(sessionInfo.getId()); } int count=commonService.upload(info,session); j.setSuccess(true); j.setMsg(count+""); }catch (Exception e) { e.printStackTrace(); j.setMsg(e.getMessage()); } System.out.println("###### result : "+JSONObject.fromObject(j).toString()); return j; } @RequestMapping("/save") @ResponseBody public Json save(UploadInfo info,HttpSession session) { Json j = new Json(); try { SessionInfo sessionInfo = (SessionInfo) session.getAttribute(GlobalConstant.SESSION_INFO); if(sessionInfo!=null) { info.setUserId(sessionInfo.getId()); info.setOrgId(sessionInfo.getOrgId()); } commonService.save(info); j.setSuccess(true); j.setMsg("上传成功!"); }catch (Exception e) { e.printStackTrace(); j.setMsg(e.getMessage()); } return j; } @RequestMapping("/tip") @ResponseBody public Json tip(String tableName,HttpSession session) { Json json=new Json(); String result=""; try { SessionInfo sessionInfo = (SessionInfo) session.getAttribute(GlobalConstant.SESSION_INFO); result=commonService.tip(tableName,sessionInfo.getOrgId()); json.setMsg(result); } catch(Exception e) { e.printStackTrace(); } return json; } }
最近下载更多
qiaoxiansheng LV6
2023年8月8日
zhaoyangwfd LV17
2022年11月29日
1083912911 LV4
2022年4月18日
getset LV8
2022年3月25日
dchengl7300 LV3
2021年12月15日
wanglinddad LV54
2021年9月23日
1029162867 LV13
2021年6月7日
窗边的小豆豆 LV1
2021年5月7日
lizhoutao LV11
2020年12月11日
caochengbo LV6
2020年11月1日
最近浏览更多
educationAAA LV4
4月18日
荣》Cowboy LV12
4月11日
fff2003 LV6
2023年12月23日
WBelong LV7
2023年12月11日
fesfefe LV13
2023年10月20日
qiaoxiansheng LV6
2023年8月8日
dzlwindy LV8
2023年6月29日
1083912911 LV4
2023年6月28日
chenhs
2023年6月20日
暂无贡献等级
6389181 LV7
2023年6月1日