package com.qm.action; import java.util.List; import java.util.Map; import org.apache.struts2.interceptor.SessionAware; import com.opensymphony.xwork2.ActionSupport; import com.qm.entity.Diary; import com.qm.service.IDiaryService; /** * 日记控制层 * @author quanmin * */ public class DiaryAction extends ActionSupport implements SessionAware { /** * */ private static final long serialVersionUID = 1L; private Diary diary; private IDiaryService diaryService; private Map<String, Object> sessionMap; /** * 添加 * @return * @throws Exception */ public String add() throws Exception{ if(diary.getDiaryId()==null){ diaryService.add(diary); }else{ diaryService.update(diary); } return "add"; } /** * 查找所有 * @return * @throws Exception */ public String findAll() throws Exception{ List<Diary> diaryList=diaryService.findAll(); sessionMap.put("diaryList", diaryList); return "findAll"; } /** * 通过id查找 * @return * @throws Exception */ public String findById() throws Exception{ this.diary=diaryService.findById(diary.getDiaryId()); return "findById"; } /** * 删除 * @return * @throws Exception */ public String delete() throws Exception{ diaryService.delete(diary.getDiaryId()); return "delete"; } public void setSession(Map<String, Object> sessionMap) { this.sessionMap=sessionMap; } public Diary getDiary() { return diary; } public void setDiary(Diary diary) { this.diary = diary; } public void setDiaryService(IDiaryService diaryService) { this.diaryService = diaryService; } }

wanglinddad LV55
2022年3月18日
adim10912 LV2
2022年3月5日
and123456 LV11
2022年2月7日
977903096 LV10
2021年12月23日
15966848095 LV22
2021年11月15日
SOLEIL. LV3
2021年6月19日
15525425383 LV6
2021年5月23日
rongfan LV14
2021年4月6日
yyy777 LV5
2021年2月4日
ExamplesDYC LV13
2020年11月21日

Peny_ZH LV5
2024年9月21日
educationAAA LV11
2024年5月8日
WBelong LV8
2023年12月11日
拜托你仔细听 LV3
2023年9月21日
zj20020510 LV5
2023年9月18日
周敏国 LV9
2023年8月21日
xuxin2000
2023年8月17日
暂无贡献等级
枫眠啊啊啊啊啊啊啊啊
2023年7月28日
暂无贡献等级
刘洋66666 LV1
2023年7月14日
3416059514 LV1
2023年6月23日