package com.action; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import org.apache.struts2.ServletActionContext; import com.dao.TShouruDAO; import com.dao.TXiaofeiDAO; import com.model.TUser; import com.opensymphony.xwork2.ActionSupport; public class tongjiAction extends ActionSupport { private String message; private String path; private TShouruDAO shouruDAO; private TXiaofeiDAO xiaofeiDAO; public String tongji_meiri() { HttpServletRequest req=ServletActionContext.getRequest(); HttpSession sess=req.getSession(); TUser user=(TUser)sess.getAttribute("user"); String shijian=""; if(req.getParameter("shijian")==null) { shijian=new SimpleDateFormat("yyyy-MM-dd").format(new Date()); } else { shijian=req.getParameter("shijian"); } String sql ="from TShouru where shijian=? and userId="+user.getUserId(); Object c[]={shijian}; List shouruList=shouruDAO.getHibernateTemplate().find(sql,c); req.setAttribute("shouruList", shouruList); String sql1 ="from TXiaofei where shijian=? and userId="+user.getUserId(); Object c1[]={shijian}; List xiaofeiList=xiaofeiDAO.getHibernateTemplate().find(sql1,c1); req.setAttribute("xiaofeiList", xiaofeiList); req.setAttribute("shijian", shijian); return ActionSupport.SUCCESS; } public String tongji_meiyue() { HttpServletRequest req=ServletActionContext.getRequest(); HttpSession sess=req.getSession(); TUser user=(TUser)sess.getAttribute("user"); String shijian=""; if(req.getParameter("shijian")==null) { shijian=new SimpleDateFormat("yyyy-MM").format(new Date()); } else { shijian=req.getParameter("shijian"); } System.out.println(shijian+"RRR"); String sql ="from TShouru where shijian like '%"+shijian+"%'"+" and userId="+user.getUserId(); List shouruList=shouruDAO.getHibernateTemplate().find(sql); req.setAttribute("shouruList", shouruList); String sql1 ="from TXiaofei where shijian like '%"+shijian+"%'"+" and userId="+user.getUserId(); List xiaofeiList=xiaofeiDAO.getHibernateTemplate().find(sql1); req.setAttribute("xiaofeiList", xiaofeiList); req.setAttribute("shijian", shijian); return ActionSupport.SUCCESS; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public String getPath() { return path; } public void setPath(String path) { this.path = path; } public TShouruDAO getShouruDAO() { return shouruDAO; } public void setShouruDAO(TShouruDAO shouruDAO) { this.shouruDAO = shouruDAO; } public TXiaofeiDAO getXiaofeiDAO() { return xiaofeiDAO; } public void setXiaofeiDAO(TXiaofeiDAO xiaofeiDAO) { this.xiaofeiDAO = xiaofeiDAO; } }
最近下载更多
skook7 LV2
5月27日
微信网友_6508798513811456 LV5
2023年6月17日
zzw123zzw LV6
2022年10月28日
zhaoyangwfd LV17
2022年10月11日
srl2881552 LV10
2022年9月6日
地上有草 LV12
2022年5月11日
wanglinddad LV55
2022年3月8日
encoun LV3
2022年1月5日
形水灯 LV4
2021年11月8日
lsc860911 LV11
2021年6月2日