diff --git a/src/main/java/com/peteralbus/controller/AdminController.java b/src/main/java/com/peteralbus/controller/AdminController.java index a40a2c5..df4ec23 100644 --- a/src/main/java/com/peteralbus/controller/AdminController.java +++ b/src/main/java/com/peteralbus/controller/AdminController.java @@ -1,9 +1,16 @@ package com.peteralbus.controller; +import com.peteralbus.entity.Activity; +import com.peteralbus.service.ActivityService; +import com.peteralbus.util.PrincipalUtil; +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 org.springframework.web.servlet.ModelAndView; +import java.util.List; + /** * The type Admin controller. * @@ -13,15 +20,25 @@ import org.springframework.web.servlet.ModelAndView; @RequestMapping("/admin") public class AdminController { - /** - * Admin home page model and view. - * - * @return the model and view - */ - @RequestMapping("/index") - public ModelAndView adminHomePage() + @Autowired + ActivityService activityService; + @RequestMapping("/activities") + public ModelAndView activities() { - return new ModelAndView("/jsp/admin/home.jsp"); + ModelAndView modelAndView=PrincipalUtil.getBasicModelAndView(); + List activityList=activityService.adminActivityList(); + modelAndView.addObject("activityList",activityList); + modelAndView.setViewName("/jsp/admin/activities.jsp"); + return modelAndView; + } + @ResponseBody + @RequestMapping("/restoreActivity") + public String restoreActivity(Long activityId) + { + if(activityService.restore(activityId)>0) + { + return "success"; + } + return "error"; } - } diff --git a/src/main/java/com/peteralbus/dao/ActivityDao.java b/src/main/java/com/peteralbus/dao/ActivityDao.java index c5ac9b9..67b3f1a 100644 --- a/src/main/java/com/peteralbus/dao/ActivityDao.java +++ b/src/main/java/com/peteralbus/dao/ActivityDao.java @@ -39,6 +39,21 @@ public interface ActivityDao extends BaseMapper */ List getTeacherList(Long activityId); + /** + * Admin activity list list. + * + * @return the list + */ + List adminActivityList(); + + /** + * Restore int. + * + * @param activityId the activity id + * @return the int + */ + int restore(Long activityId); + /** * Gets count. * diff --git a/src/main/java/com/peteralbus/dao/GroupDao.java b/src/main/java/com/peteralbus/dao/GroupDao.java index 4e74be4..eb549c9 100644 --- a/src/main/java/com/peteralbus/dao/GroupDao.java +++ b/src/main/java/com/peteralbus/dao/GroupDao.java @@ -6,9 +6,17 @@ import org.apache.ibatis.annotations.Mapper; /** * The interface Group dao. + * * @author PeterAlbus */ @Mapper public interface GroupDao extends BaseMapper { + /** + * Restore int. + * + * @param activityId the activity id + * @return the int + */ + int restore(Long activityId); } diff --git a/src/main/java/com/peteralbus/dao/ManageDao.java b/src/main/java/com/peteralbus/dao/ManageDao.java index 1d41443..e732b5f 100644 --- a/src/main/java/com/peteralbus/dao/ManageDao.java +++ b/src/main/java/com/peteralbus/dao/ManageDao.java @@ -11,4 +11,11 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface ManageDao extends BaseMapper { + /** + * Restore int. + * + * @param activityId the activity id + * @return the int + */ + int restore(Long activityId); } diff --git a/src/main/java/com/peteralbus/dao/ParticipateDao.java b/src/main/java/com/peteralbus/dao/ParticipateDao.java index 347229b..6886d2a 100644 --- a/src/main/java/com/peteralbus/dao/ParticipateDao.java +++ b/src/main/java/com/peteralbus/dao/ParticipateDao.java @@ -11,4 +11,11 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface ParticipateDao extends BaseMapper { + /** + * Restore int. + * + * @param activityId the activity id + * @return the int + */ + int restore(Long activityId); } diff --git a/src/main/java/com/peteralbus/dao/RecordDao.java b/src/main/java/com/peteralbus/dao/RecordDao.java index fa57bd8..41bf65e 100644 --- a/src/main/java/com/peteralbus/dao/RecordDao.java +++ b/src/main/java/com/peteralbus/dao/RecordDao.java @@ -11,4 +11,11 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface RecordDao extends BaseMapper { + /** + * Restore int. + * + * @param participationId the participation id + * @return the int + */ + int restore(Long participationId); } diff --git a/src/main/java/com/peteralbus/service/ActivityService.java b/src/main/java/com/peteralbus/service/ActivityService.java index ad43ba8..6889446 100644 --- a/src/main/java/com/peteralbus/service/ActivityService.java +++ b/src/main/java/com/peteralbus/service/ActivityService.java @@ -57,7 +57,13 @@ public class ActivityService */ public int updateActivity(Activity activity) { - return activityDao.updateById(activity); + Activity old=activityDao.selectById(activity.getActivityId()); + old.setActivityName(activity.getActivityName()); + old.setActivityType(activity.getActivityType()); + old.setActivityIntroduction(activity.getActivityIntroduction()); + old.setMaxPeople(activity.getMaxPeople()); + old.setMinPeople(activity.getMinPeople()); + return activityDao.updateById(old); } /** @@ -186,4 +192,26 @@ public class ActivityService result=activityDao.deleteById(activityId); return result; } + + public List adminActivityList() + { + return activityDao.adminActivityList(); + } + + public int restore(Long activityId) + { + int result=0; + result=activityDao.restore(activityId); + manageDao.restore(activityId); + groupDao.restore(activityId); + participateDao.restore(activityId); + QueryWrapper participateQueryWrapper=new QueryWrapper<>(); + participateQueryWrapper.eq("activity_id",activityId); + List participateList=participateDao.selectList(participateQueryWrapper); + for(Participate participate:participateList) + { + recordDao.restore(participate.getParticipationId()); + } + return result; + } } diff --git a/src/main/resources/mapper/ActivityDao.xml b/src/main/resources/mapper/ActivityDao.xml index 27889b3..5c3d85f 100644 --- a/src/main/resources/mapper/ActivityDao.xml +++ b/src/main/resources/mapper/ActivityDao.xml @@ -17,6 +17,12 @@ select user.user_id,username,real_name,user_phone,avatar_src from activity,user,manage where activity.activity_id=#{activityId} and manage.activity_id=activity.activity_id and manage.user_id=user.user_id and manage.is_delete=0 and user.is_delete=0 + + + update activity set is_delete=0 where activity_id=#{activityId} + diff --git a/src/main/resources/mapper/GroupDao.xml b/src/main/resources/mapper/GroupDao.xml new file mode 100644 index 0000000..a7f7c05 --- /dev/null +++ b/src/main/resources/mapper/GroupDao.xml @@ -0,0 +1,9 @@ + + + + + update `group` set is_delete=0 where activity_id=#{activityId} + + \ No newline at end of file diff --git a/src/main/resources/mapper/ManageDao.xml b/src/main/resources/mapper/ManageDao.xml new file mode 100644 index 0000000..6832309 --- /dev/null +++ b/src/main/resources/mapper/ManageDao.xml @@ -0,0 +1,9 @@ + + + + + update manage set is_delete=0 where activity_id=#{activityId} + + \ No newline at end of file diff --git a/src/main/resources/mapper/ParticipateDao.xml b/src/main/resources/mapper/ParticipateDao.xml new file mode 100644 index 0000000..a73cf70 --- /dev/null +++ b/src/main/resources/mapper/ParticipateDao.xml @@ -0,0 +1,9 @@ + + + + + update participate set is_delete=0 where activity_id=#{activityId} + + \ No newline at end of file diff --git a/src/main/resources/mapper/RecordDao.xml b/src/main/resources/mapper/RecordDao.xml new file mode 100644 index 0000000..26ce412 --- /dev/null +++ b/src/main/resources/mapper/RecordDao.xml @@ -0,0 +1,9 @@ + + + + + update record set is_delete=0 where participation_id=#{participationId} + + \ No newline at end of file diff --git a/src/main/webapp/css/main.css b/src/main/webapp/css/main.css index f30b7f2..87baacb 100644 --- a/src/main/webapp/css/main.css +++ b/src/main/webapp/css/main.css @@ -31,3 +31,7 @@ body{ align-items: center; justify-content:center; } + +.el-table .warning-row { + --el-table-tr-bg-color: var(--el-color-warning-lighter); +} diff --git a/src/main/webapp/jsp/admin/activities.jsp b/src/main/webapp/jsp/admin/activities.jsp new file mode 100644 index 0000000..0ca213b --- /dev/null +++ b/src/main/webapp/jsp/admin/activities.jsp @@ -0,0 +1,222 @@ +<%-- + Created by IntelliJ IDEA. + User: peteralbus + Date: 2021/12/21 + Time: 18:13 + To change this template use File | Settings | File Templates. +--%> +<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> +<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + + 主页 + + + + + + + + + + + + +
+
+ <%@ include file="/jsp/header.html" %> +
+
+
+ + + <%@ include file="/jsp/aside.html" %> + + + +
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
+ <%@ include file="/jsp/foot.html" %> +
+
+ + + diff --git a/src/main/webapp/jsp/aside.html b/src/main/webapp/jsp/aside.html index 29bfd28..9927911 100644 --- a/src/main/webapp/jsp/aside.html +++ b/src/main/webapp/jsp/aside.html @@ -21,6 +21,12 @@ + + + + + + diff --git a/src/main/webapp/jsp/student/applyActivity.jsp b/src/main/webapp/jsp/student/applyActivity.jsp index cc660e0..8d88075 100644 --- a/src/main/webapp/jsp/student/applyActivity.jsp +++ b/src/main/webapp/jsp/student/applyActivity.jsp @@ -202,7 +202,7 @@ }, newGroup(){ this.$messageBox.confirm( - '参与社会实践活动后不可更改小组,不可退出,确认申请?', + '担任组长意味着责任,若还有组员,不可退出活动,确认申请?', '警告', { confirmButtonText: '确认', @@ -236,7 +236,7 @@ }, joinGroup(id){ this.$messageBox.confirm( - '参与社会实践活动后不可更改小组,不可退出,确认申请?', + '确认申请该小组参与社会实践活动?', '警告', { confirmButtonText: '确认', diff --git a/src/main/webapp/jsp/teacher/manageGroup.jsp b/src/main/webapp/jsp/teacher/manageGroup.jsp index 7fe04d8..d049935 100644 --- a/src/main/webapp/jsp/teacher/manageGroup.jsp +++ b/src/main/webapp/jsp/teacher/manageGroup.jsp @@ -58,9 +58,9 @@ border >