注释 #3

Merged
p6zkavi9o merged 9 commits from branch-sunhaiwen into develop_idea 1 year ago

@ -1,127 +1,151 @@
package com.rabbiter.association.controller;
//声明该Java类所在的包名为com.rabbiter.association.controller。
import com.rabbiter.association.service.UsersService;
//导入UsersService类用于处理用户相关的业务逻辑。
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
//导入slf4j日志框架的Logger和LoggerFactory用于记录日志。
import org.springframework.beans.factory.annotation.Autowired;
//导入Autowired注解用于自动装配依赖。
import org.springframework.stereotype.Controller;
//导入Controller注解表明该类是一个Spring MVC中的控制器。
import org.springframework.util.ObjectUtils;
//用于对象工具操作
import org.springframework.web.bind.annotation.GetMapping;
//等用于处理Web请求映射
import org.springframework.web.bind.annotation.PostMapping;
//专门用于处理HTTP POST请求的映射
import org.springframework.web.bind.annotation.RequestMapping;
//用来处理请求映射的注解
import org.springframework.web.bind.annotation.ResponseBody;
//用于将方法的返回值直接作为响应体写入HTTP响应中
import com.rabbiter.association.entity.Users;
//等导入实体类和工具类。
import com.rabbiter.association.handle.CacheHandle;
//用于处理缓存相关操作
import com.rabbiter.association.utils.IDUtils;
//用于处理各种标识符
import com.rabbiter.association.msg.R;
//R类用于资源的引用管理
import com.rabbiter.association.msg.PageData;
//用于表示页面数据相关的结构
import com.rabbiter.association.entity.Activities;
//导入名为Activities的实体类这个类位于com.rabbiter.association.entity包下
import com.rabbiter.association.service.ActivitiesService;
/**
*
*
*ActivitiesServicecom.rabbiter.association.service
*
*
*/
@Controller
@RequestMapping("/activities")
@Controller//注解将该类标记为Spring MVC的控制器。
@RequestMapping("/activities")//指定了该控制器处理的基本URL路径为/activities。
public class ActivitiesController extends BaseController {
//定义了名为ActivitiesController的类它继承自BaseController类。
protected static final Logger Log = LoggerFactory.getLogger(ActivitiesController.class);
//创建一个Logger对象用于记录ActivitiesController类中的日志信息。
@Autowired
private CacheHandle cacheHandle;
//使用Autowired注解自动注入CacheHandle类型的依赖用于处理缓存相关操作。
@Autowired
private UsersService usersService;
//自动注入UsersService用于用户相关业务。
@Autowired
private ActivitiesService activitiesService;
//自动注入ActivitiesService用于活动相关业务。
@RequestMapping("")
public String index() {
return "pages/Activities";
}
//当访问根路径(相对于/activities该方法返回名为"pages/Activities"的视图名称。
@GetMapping("/info")
//@GetMapping表示处理HTTP GET请求/info是相对于/activities的路径。
// 该方法用于处理查找指定活动信息的请求接受一个id参数
// 返回包含活动信息的成功响应或者错误响应
@ResponseBody
public R getInfo(String id) {
//在日志中记录查找指定活动信息的操作及对应的id
Log.info("查找指定活动信息ID{}", id);
//通过activitiesService的getOne方法根据id获取活动信息
Activities activities = activitiesService.getOne(id);
//使用R.successData方法将获取到的活动信息包装在成功响应中并返回
return R.successData(activities);
}
@GetMapping("/page")
//该方法接收一个id参数通过activitiesService.getOne(id)获取指定id的活动信息然后使用R.successData(activities)返回包含活动信息的成功响应。
@GetMapping("/page")//处理/page路径的GET请求。
@ResponseBody
public R getPageInfos(Long pageIndex, Long pageSize,
String token, String teamName, String activeName) {
//首先通过usersService.getOne(cacheHandle.getUserInfoCache(token))获取用户信息,如果用户不存在则返回登录信息不存在的错误。
Users user = usersService.getOne(cacheHandle.getUserInfoCache(token));
if(ObjectUtils.isEmpty(user)) {
//如果用户为空,表示登录信息不存在,返回错误提示要求重新登录
return R.error("登录信息不存在,请重新登录");
}
// 根据用户类型进行不同的分页查询操作
if (user.getType() == 0) {
//在日志中记录普通用户分页查找活动信息的操作及相关参数
Log.info("分页查找活动信息,当前页码:{}"
+ "每页数据量:{}, 模糊查询,社团名称:{},活动名称:{}", pageIndex,
pageSize, teamName, activeName);
//调用activitiesService的getPageAll方法进行普通的分页查询
PageData page = activitiesService.getPageAll(pageIndex, pageSize, teamName, activeName);
//使用R.successData方法将获取到的分页数据包装在成功响应中并返回
return R.successData(page);
} else {
//在日志中记录特定用户类型分页查找活动信息的操作及相关参数
Log.info("分页查找活动信息,当前页码:{}"
+ "每页数据量:{}, 模糊查询,社团名称:{},活动名称:{}", pageIndex,
pageSize, teamName, activeName);
//调用activitiesService的getPageByUserId方法进行特定用户的分页查询
PageData page = activitiesService.getPageByUserId(pageIndex, pageSize, user.getId(), teamName, activeName);
//使用R.successData方法将获取到的分页数据包装在成功响应中并返回
return R.successData(page);
}
}
@PostMapping("/add")
//根据用户类型user.getType()不同分别调用activitiesService.getPageAll普通情况或activitiesService.getPageByUserId特定用户类型来进行分页查询活动信息最后返回包含分页数据的成功响应。
@PostMapping("/add")//处理/add路径的POST请求。
@ResponseBody
public R addInfo(Activities activities) {
//使用IDUtils的makeIDByCurrent方法为传入的活动对象设置id
activities.setId(IDUtils.makeIDByCurrent());
//在日志中记录添加活动信息的操作及传入的活动对象参数
Log.info("添加活动信息,传入参数:{}", activities);
//调用activitiesService的add方法添加活动信息
activitiesService.add(activities);
//返回表示操作成功的响应
return R.success();
}
@PostMapping("/upd")
//为传入的Activities对象设置id通过IDUtils.makeIDByCurrent()然后使用activitiesService.add(activities)添加活动信息,最后返回成功响应。
@PostMapping("/upd")//处理/upd路径的POST请求。
@ResponseBody
public R updInfo(Activities activities) {
//在日志中记录修改活动信息的操作及传入的活动对象参数
Log.info("修改活动信息,传入参数:{}", activities);
//调用activitiesService的update方法修改活动信息
activitiesService.update(activities);
//返回表示操作成功的响应
return R.success();
}
@PostMapping("/del")
//通过activitiesService.update(activities)修改活动信息,然后返回成功响应。
@PostMapping("/del")//处理/del路径的POST请求。
@ResponseBody
public R delInfo(String id) {
//在日志中记录删除活动信息的操作及对应的id
Log.info("删除活动信息, ID:{}", id);
//通过activitiesService的getOne方法根据id获取要删除的活动信息
Activities activities = activitiesService.getOne(id);
//调用activitiesService的delete方法删除活动信息
activitiesService.delete(activities);
//返回表示操作成功的响应
return R.success();
}
}
}
//先通过activitiesService.getOne(id)获取要删除的活动对象,然后使用`activitiesService.delete

@ -1,133 +1,163 @@
package com.rabbiter.association.controller;
//声明该Java类所在的包名为com.rabbiter.association.controller。
import com.rabbiter.association.service.UsersService;
//导入UsersService类用于处理用户相关的业务逻辑。
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
//导入slf4j日志框架的Logger和LoggerFactory用于记录日志。
import org.springframework.beans.factory.annotation.Autowired;
//导入Autowired注解用于自动装配依赖。
import org.springframework.stereotype.Controller;
//导入Controller注解表明该类是一个Spring MVC中的控制器。
import org.springframework.util.ObjectUtils;
//用于对象工具操作
import org.springframework.web.bind.annotation.GetMapping;
//等用于处理Web请求映射
import org.springframework.web.bind.annotation.PostMapping;
//专门用于处理HTTP POST请求的映射
import org.springframework.web.bind.annotation.RequestMapping;
//用来处理请求映射的注解
import org.springframework.web.bind.annotation.ResponseBody;
//用于将方法的返回值直接作为响应体写入HTTP响应中
import com.rabbiter.association.entity.Users;
//等导入实体类和工具类。
import com.rabbiter.association.handle.CacheHandle;
//用于处理缓存相关操作
import com.rabbiter.association.utils.DateUtils;
//这里的import用于引入名为DateUtils的类这个类位于com.rabbiter.association.utils包下
// 通常这个DateUtils类可能包含一些与日期操作相关的工具方法例如日期格式化、日期计算等
import com.rabbiter.association.utils.IDUtils;
//用于处理各种标识符
import com.rabbiter.association.msg.R;
//R类用于资源的引用管理
import com.rabbiter.association.msg.PageData;
//用于表示页面数据相关的结构
import com.rabbiter.association.entity.Notices;
//导入Notices实体类位于com.rabbiter.association.entity包下
import com.rabbiter.association.service.NoticesService;
//导入NoticesService服务类它可能位于com.rabbiter.association.service包下
import com.rabbiter.association.utils.StringUtils;
//导入StringUtils工具类位于com.rabbiter.association.utils包下
/**
*
*
*/
//系统请求响应控制器
//通知记录
// 该类被标记为Spring的Controller用于处理Web请求并返回视图或数据
@Controller
//这个注解定义了这个控制器处理的请求的基本路径为"/notices"
@RequestMapping("/notices")
public class NoticesController extends BaseController {
//创建一个Logger对象用于记录日志这里记录的是NoticesController类中的日志
protected static final Logger Log = LoggerFactory.getLogger(NoticesController.class);
//使用Spring的依赖注入自动装配CacheHandle对象
@Autowired
private CacheHandle cacheHandle;
//使用Spring的依赖注入自动装配NoticesService对象
@Autowired
private NoticesService noticesService;
//使用Spring的依赖注入自动装配UsersService对象
@Autowired
private UsersService usersService;
//处理根路径("/notices"的GET请求返回名为"pages/Notices"的视图
@RequestMapping("")
public String index() {
return "pages/Notices";
}
//处理"/notices/info"的GET请求该请求期望一个名为"id"的字符串参数
// 用于查找指定ID的通知记录并将结果以JSON格式返回通过@ResponseBody注解
@GetMapping("/info")
@ResponseBody
public R getInfo(String id) {
//在日志中记录查找指定通知记录的操作输出通知记录的ID
Log.info("查找指定通知记录ID{}", id);
//通过noticesService获取指定ID的通知记录
Notices notices = noticesService.getOne(id);
//将获取到的通知记录封装在R对象中并标记为成功然后返回
return R.successData(notices);
}
//处理"/notices/page"的GET请求该请求期望多个参数包括页码、每页数据量、用户令牌、通知标题和社团名称
// 根据用户类型进行不同的分页查询操作并将结果以JSON格式返回通过@ResponseBody注解
@GetMapping("/page")
@ResponseBody
public R getPageInfos(Long pageIndex, Long pageSize,
String token, String title, String teamName) {
//通过usersService和cacheHandle根据令牌获取用户信息
Users user = usersService.getOne(cacheHandle.getUserInfoCache(token));
//如果获取到的用户为空,表示登录信息不存在,返回错误信息
if(ObjectUtils.isEmpty(user)) {
return R.error("登录信息不存在,请重新登录");
}
//如果用户类型为0表示普通查询
if (user.getType() == 0) {
//在日志中记录分页查找通知记录的操作,输出当前页码、每页数据量、通知标题和社团名称
Log.info("分页查找指通知记录,当前页码:{}"
+ "每页数据量:{}, 模糊查询,通知标题:{},社团名称:{}", pageIndex,
pageSize, title, teamName);
//通过noticesService进行普通的分页查询操作获取一页通知记录
PageData page = noticesService.getPageAll(pageIndex, pageSize, title, teamName);
//将查询到的一页通知记录封装在R对象中并标记为成功然后返回
return R.successData(page);
} else {
//如果用户类型不为0表示查询与指定用户相关的通知记录
// 在日志中记录分页查找指定用户相关通知记录的操作,输出当前页码、每页数据量、通知标题和社团名称
Log.info("分页查找指定用户相关通知记录,当前页码:{}"
+ "每页数据量:{}, 模糊查询,通知标题:{},社团名称:{}", pageIndex,
pageSize, title, teamName);
//通过noticesService进行与指定用户相关的分页查询操作获取一页通知记录
PageData page = noticesService.getPageById(pageIndex, pageSize, user.getId(), title, teamName);
//将查询到的一页通知记录封装在R对象中并标记为成功然后返回
return R.successData(page);
}
}
//处理"/notices/add"的POST请求期望一个Notices对象作为参数
// 用于添加通知记录,添加成功后返回成功信息(通过@ResponseBody注解
@PostMapping("/add")
@ResponseBody
public R addInfo(Notices notices) {
//使用IDUtils为通知记录生成一个唯一的ID
notices.setId(IDUtils.makeIDByCurrent());
//使用DateUtils获取当前日期并设置为通知记录的创建时间
notices.setCreateTime(DateUtils.getNowDate("yyyy-MM-dd"));
//如果通知记录的团队ID为空字符串将其设置为null
if(StringUtils.isNullOrEmpty(notices.getTeamId())){
notices.setTeamId(null);
}
//在日志中记录添加通知记录的操作,输出传入的通知记录参数
Log.info("添加通知记录,传入参数:{}", notices);
//通过noticesService添加通知记录
noticesService.add(notices);
//返回表示成功的R对象
return R.success();
}
//处理"/notices/upd"的POST请求期望一个Notices对象作为参数
// 用于修改通知记录,修改成功后返回成功信息(通过@ResponseBody注解
@PostMapping("/upd")
@ResponseBody
public R updInfo(Notices notices) {
//在日志中记录修改通知记录的操作,输出传入的通知记录参数
Log.info("修改通知记录,传入参数:{}", notices);
//通过noticesService修改通知记录
noticesService.update(notices);
//返回表示成功的R对象
return R.success();
}
//处理"/notices/del"的POST请求期望一个名为"id"的字符串参数
// 用于删除指定ID的通知记录删除成功后返回成功信息通过@ResponseBody注解
@PostMapping("/del")
@ResponseBody
public R delInfo(String id) {
// 在日志中记录删除通知记录的操作输出通知记录的ID
Log.info("删除通知记录, ID:{}", id);
// 通过noticesService获取指定ID的通知记录
Notices notices = noticesService.getOne(id);
// 通过noticesService删除通知记录
noticesService.delete(notices);
// 返回表示成功的R对象
return R.success();
}

@ -1,138 +1,157 @@
package com.rabbiter.association.controller;
//声明该Java类所在的包名为com.rabbiter.association.controller。
import com.rabbiter.association.service.PayLogsService;
import com.rabbiter.association.service.UsersService;
//导入UsersService类用于处理用户相关的业务逻辑。
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
//导入slf4j日志框架的Logger和LoggerFactory用于记录日志。
import org.springframework.beans.factory.annotation.Autowired;
////导入Autowired注解用于自动装配依赖。
import org.springframework.stereotype.Controller;
//导入Controller注解表明该类是一个Spring MVC中的控制器。
import org.springframework.util.ObjectUtils;
//用于对象工具操作
import org.springframework.web.bind.annotation.GetMapping;
//等用于处理Web请求映射
import org.springframework.web.bind.annotation.PostMapping;
//专门用于处理HTTP POST请求的映射
import org.springframework.web.bind.annotation.RequestMapping;
//用来处理请求映射的注解
import org.springframework.web.bind.annotation.ResponseBody;
//用于将方法的返回值直接作为响应体写入HTTP响应中
import com.rabbiter.association.entity.Users;
//等导入实体类和工具类。
import com.rabbiter.association.handle.CacheHandle;
//用于处理缓存相关操作
import com.rabbiter.association.utils.DateUtils;
//这里的import用于引入名为DateUtils的类这个类位于com.rabbiter.association.utils包下
// 通常这个DateUtils类可能包含一些与日期操作相关的工具方法例如日期格式化、日期计算等
import com.rabbiter.association.utils.IDUtils;
//用于处理各种标识符
import com.rabbiter.association.msg.R;
//R类用于资源的引用管理
import com.rabbiter.association.msg.PageData;
//用于表示页面数据相关的结构
import com.rabbiter.association.entity.PayLogs;
//导入com.rabbiter.association.entity包下的PayLogs类
//系统请求响应控制器
// 缴费记录
/**
*
*
*/
@Controller
@RequestMapping("/payLogs")
public class PayLogsController extends BaseController {
// 创建一个日志记录器用于记录PayLogsController类中的日志信息
protected static final Logger Log = LoggerFactory.getLogger(PayLogsController.class);
// 使用Spring的自动装配功能将CacheHandle注入到这个类中
@Autowired
private CacheHandle cacheHandle;
// 使用Spring的自动装配功能将UsersService注入到这个类中
@Autowired
private UsersService usersService;
//使用Spring的自动装配功能,将PayLogsService注入到这个类中
@Autowired
private PayLogsService payLogsService;
// 处理根路径("/payLogs")的请求,返回一个视图名称,用于显示缴费记录页面
@RequestMapping("")
public String index() {
return "pages/PayLogs";
}
// 处理"/payLogs/info"的GET请求根据传入的id查找指定缴费记录并以JSON格式返回结果
@GetMapping("/info")
@ResponseBody
public R getInfo(String id) {
// 在日志中记录查找指定缴费记录的操作和传入的id
Log.info("查找指定缴费记录ID{}", id);
PayLogs payLogs = payLogsService.getOne(id);
return R.successData(payLogs);
}
//处理"/payLogs/page"的GET请求根据不同用户类型进行分页查询缴费记录并以JSON格式返回结果
@GetMapping("/page")
@ResponseBody
public R getPageInfos(Long pageIndex, Long pageSize,
String token, String teamName, String userName) {
//根据token获取用户信息
Users user = usersService.getOne(cacheHandle.getUserInfoCache(token));
//如果用户信息为空,返回错误信息,表示登录信息不存在,请重新登录
if(ObjectUtils.isEmpty(user)) {
return R.error("登录信息不存在,请重新登录");
}
//如果用户类型为0普通用户
if (user.getType() == 0) {
//在日志中记录分页查看全部缴费记录的操作和相关参数
Log.info("分页查看全部缴费记录,当前页码:{}"
+ "每页数据量:{}, 模糊查询,团队名称:{},用户姓名:{}", pageIndex,
pageSize, teamName, userName);
//调用payLogsService的getPageInfo方法进行分页查询
PageData page = payLogsService.getPageInfo(pageIndex, pageSize, null, teamName, userName);
return R.successData(page);
} else if (user.getType() == 1) {
// 如果用户类型为1团队管理员
// 在日志中记录团队管理员查看缴费记录的操作和相关参数
Log.info("团队管理员查看缴费记录,当前页码:{}"
+ "每页数据量:{}, 模糊查询,团队名称:{},用户姓名:{}", pageIndex,
pageSize, teamName, userName);
//调用payLogsService的getManPageInfo方法进行分页查询
PageData page = payLogsService.getManPageInfo(pageIndex, pageSize, user.getId(), teamName, userName);
return R.successData(page);
} else {
// 其他类型用户
// 在日志中记录分页查询用户相关缴费记录的操作和相关参数
Log.info("分页用户相关缴费记录,当前页码:{}"
+ "每页数据量:{}, 模糊查询,团队名称:{},用户姓名:{}", pageIndex,
pageSize, teamName, userName);
//调用payLogsService的getPageInfo方法进行分页查询
PageData page = payLogsService.getPageInfo(pageIndex, pageSize, user.getId(), teamName, null);
return R.successData(page);
}
}
//处理"/payLogs/add"的POST请求添加缴费记录并返回操作成功的结果
@PostMapping("/add")
@ResponseBody
public R addInfo( PayLogs payLogs) {
//为缴费记录生成一个唯一的id
payLogs.setId(IDUtils.makeIDByCurrent());
//设置缴费记录的创建时间为当前时间
payLogs.setCreateTime(DateUtils.getNowDate());
//在日志中记录添加缴费记录的操作和传入的参数
Log.info("添加缴费记录,传入参数:{}", payLogs);
//调用payLogsService的add方法添加缴费记录
payLogsService.add(payLogs);
return R.success();
}
//处理"/payLogs/upd"的POST请求修改缴费记录并返回操作成功的结果
@PostMapping("/upd")
@ResponseBody
public R updInfo(PayLogs payLogs) {
//在日志中记录修改缴费记录的操作和传入的参数
Log.info("修改缴费记录,传入参数:{}", payLogs);
//调用payLogsService的update方法修改缴费记录
payLogsService.update(payLogs);
return R.success();
}
//处理"/payLogs/del"的POST请求根据传入的id删除缴费记录并返回操作成功的结果
@PostMapping("/del")
@ResponseBody
public R delInfo(String id) {
Log.info("删除缴费记录, ID:{}", id);
//在日志中记录删除缴费记录的操作和传入的id
PayLogs payLogs = payLogsService.getOne(id);
payLogsService.delete(payLogs);
//调用payLogsService的delete方法删除缴费记录
return R.success();
}
}

@ -1,76 +1,125 @@
package com.rabbiter.association.dao;
//声明了Java代码所属的包名为com.rabbiter.association.dao
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//用于处理分页相关的功能
import org.apache.ibatis.annotations.Param;
//在MyBatis框架中用于给SQL语句中的参数命名
import org.apache.ibatis.annotations.Select;
//用于在接口方法上标记对应的SQL查询语句
import org.springframework.stereotype.Repository;
//这个接口主要用于数据库访问操作
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
//是MyBatis Plus框架中的基础映射器接口
import com.rabbiter.association.entity.Activities;
//用于在Java代码中表示表中的数据结构
import java.util.Map;
/**
*
*
*/
//用于存储查询结果等情况
//数据层处理接口
//活动信息
@Repository("activitiesDao")
//用于将ActivitiesDao接口标记为一个数据访问层DAO组件
public interface ActivitiesDao extends BaseMapper<Activities> {
//定义一个名为ActivitiesDao的公共接口并且这个接口继承自BaseMapper<Activities>
//这意味着ActivitiesDao接口将继承BaseMapper接口中针对Activities实体类的数据库操作方法
// 分页查看全部活动信息
//@param page 分页信息
//@param activeName 活动名称
//@param teamName 团队名称
// @return
/**
*
* @param page
* @param activeName
* @param teamName
* @return
*/
@Select("<script>" +
//是MyBatis Plus中用于标识动态SQL脚本的开始
"SELECT " +
//这是SQL查询语句的开始部分用于选择要查询的字段
"a.id, a.name, a.comm, a.detail, a.ask, a.total, " +
//列出要查询的activities表中的字段
"a.active_time activeTime, a.team_id teamId, t.name teamName " +
//这里将a.activetime字段别名为activeTimea.teamid字段别名为teamId同时查询teams表中的name字段并别名为teamName
"FROM activities a, teams t " +
//这是SQL查询中的FROM子句指定要查询的表为activities表别名为a和teams表
"<where>" +
//用于指定查询的条件
"a.team_id = t.id " +
//表示activities表中的team_id字段等于teams表中的id字段用于关联这两个表
"<if test='teamName != null and teamName.trim() != &quot;&quot; '>" +
//这是MyBatis Plus中的动态SQL语句的条件判断部分
"AND t.name LIKE CONCAT('%', #{teamName}, '%') " +
//如果满足上面的teamName条件则在查询条件中添加一个LIKE语句用于模糊查询teams表中的name字段包含teamName参数值的记录
"</if>" +
//动态SQL条件判断部分的结束标记
"<if test='activeName != null and activeName.trim() != &quot;&quot; '>" +
//对activeName参数的动态SQL条件判断
"AND a.name LIKE CONCAT('%', #{activeName}, '%') " +
//如果满足上面的activeName条件则在查询条件中添加一个LIKE语句用于模糊查询activities表中的name字段包含activeName参数值的记录
"</if>" +
//动态SQL条件判断部分的结束标记
"</where>" +
//WHERE子句的结束标记
"ORDER BY a.active_time DESC" +
//这是SQL查询中的ORDER BY子句用于按照activities表中的active_time字段降序排列查询结果
"</script>")
//是MyBatis Plus中动态SQL脚本的结束标记
public Page<Map<String, Object>> qryPageAll(Page<Map<String, Object>> page,
//定义一个名为qryPageAll的公共方法返回类型为Page<Map<String, Object>>
// 接受一个Page<Map<String, Object>>类型的参数page用于分页信息以及两个字符串类型的参数activeName和teamName用于查询条件
@Param("activeName") String activeName,
//使用@Param注解给activeName参数命名以便在SQL语句中准确引用这个参数
@Param("teamName") String teamName);
//使用@Param注解给teamName参数命名以便在SQL语句中准确引用这个参数
//开始对qryPageByMemId方法进行多行注释
//分页查询指定成员相关的活动信息
//这是对qryPageByMemId方法功能的简要描述表明这个方法用于分页查询与指定成员相关的活动信息
// @param page 分页信息
//说明page参数是用于传递分页相关的信息
// @param memId 成员ID
//说明memId参数是用于指定成员的唯一标识符用于查询与该成员相关的活动信息
// @param activeName 活动名称
//说明activeName参数是用于指定活动名称的可能用于在查询时根据活动名称进行筛选
// @param teamName 团队名称
//说明teamName参数是用于指定团队名称的可能用于在查询时根据团队名称进行筛选
// @return
//这是对方法返回值的注释
//表示这个方法将返回一个Page<Map<String, Object>>类型的结果即包含查询结果的分页对象其中每个结果项是一个Map<String, Object>类型,可能用于存储查询结果中的不同字段值
/**
*
* @param page
* @param memId ID
* @param activeName
* @param teamName
* @return
*/
@Select("<script>" +
//这是MyBatis框架中的Select注解开始定义一个动态SQL查询语句。<script>标签可能是MyBatis Plus中用于标识动态SQL脚本的开始
"SELECT " +
//这是SQL查询语句的开始部分用于选择要查询的字段
"a.id, a.name, a.comm, a.detail, a.ask, a.total, " +
//列出要查询的activities表中的字段
"a.active_time activeTime, a.team_id teamId, t.name teamName " +
//继续列出要查询的字段
"FROM activities a, teams t " +
//这是SQL查询中的FROM子句指定要查询的表为activities表别名为a和teams表
"<where>" +
//这是SQL查询中的WHERE子句的开始标记用于指定查询的条件
"a.team_id = t.id AND a.team_id IN (SELECT team_id FROM members WHERE user_id = #{memId}) " +
//这是一个查询条件
"<if test='teamName != null and teamName.trim() != &quot;&quot; '>" +
//这是MyBatis Plus中的动态SQL语句的条件判断部分
"AND t.name LIKE CONCAT('%', #{teamName}, '%') " +
//如果满足上面的teamName条件则在查询条件中添加一个LIKE语句用于模糊查询teams表中的name字段包含teamName参数值的记录
"</if>" +
//动态SQL条件判断部分的结束标记
"<if test='activeName != null and activeName.trim() != &quot;&quot; '>" +
//这是对activeName参数的动态SQL条件判断
"AND a.name LIKE CONCAT('%', #{activeName}, '%') " +
//如果满足上面的activeName条件则在查询条件中添加一个LIKE语句用于模糊查询activities表中的name字段包含activeName参数值的记录
"</if>" +
//动态SQL条件判断部分的结束标记
"</where>" +
//WHERE子句的结束标记
"ORDER BY a.active_time DESC" +
//这是SQL查询中的ORDER BY子句用于按照activities表中的active_time字段降序排列查询结果
"</script>")
//这是MyBatis Plus中动态SQL脚本的结束标记
public Page<Map<String, Object>> qryPageByMemId(Page<Map<String, Object>> page,
//定义一个名为qryPageByMemId的公共方法返回类型为Page<Map<String, Object>>
@Param("memId") String memId,
//使用@Param注解给memId参数命名以便在SQL语句中准确引用这个参数
@Param("activeName") String activeName,
//使用@Param注解给activeName参数命名以便在SQL语句中准确引用这个参数
@Param("teamName") String teamName);
//使用@Param注解给teamName参数命名
}

@ -1,115 +1,180 @@
package com.rabbiter.association.dao;
//声明了Java代码所属的包名为com.rabbiter.association.dao
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
////用于处理分页相关的功能
import org.apache.ibatis.annotations.Param;
//在MyBatis框架中用于给SQL语句中的参数命名
import org.apache.ibatis.annotations.Select;
//用于在接口方法上标记对应的SQL查询语句
import org.springframework.stereotype.Repository;
//这个接口主要用于数据库访问操作
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
//是MyBatis Plus框架中的基础映射器接口
import com.rabbiter.association.entity.Notices;
//导入Notices实体类
import java.util.List;
//导入List接口用于处理查询结果集为列表形式的数据是Java集合框架中的一部分
import java.util.Map;
//导入Map接口用于处理键值对形式的数据可能在查询结果以键值对形式返回时使用
//数据层处理接口
// 通知记录
/**
*
*
*/
@Repository("noticesDao")
//用于将该接口标记为一个数据访问层DAO的组件并指定其名称为noticesDao方便在Spring容器中进行依赖注入等操作
public interface NoticesDao extends BaseMapper<Notices> {
//定义一个名为NoticesDao的公共接口它继承自BaseMapper<Notices>接口。这意味着它将继承BaseMapper接口中针对Notices实体类的通用数据库操作方法
//获取系统通知
// @return
/**
*
* @return
*/
@Select("<script>" +
//是MyBatis Plus中用于标识动态SQL脚本的开始
"SELECT " +
//这是SQL查询语句的开始部分用于选择要查询的字段
"id, title, detail, create_time createTime, team_id teamId " +
//列出要查询的activities表中的字段
"FROM notices " +
//这是SQL查询中的FROM子句
"WHERE team_id IS NULL " +
//用于指定查询的条件
"ORDER BY create_time DESC " +
//这是SQL查询中的ORDER BY子句
"</script>")
//是MyBatis Plus中动态SQL脚本的结束标记
public List<Notices> qrySysNotices();
//这是一个接口方法名为qrySysNotices返回类型为List<Notices>
//它的功能可能是查询系统通知通过上面的Select注解对应的SQL语句查询结果将以Notices实体类的列表形式返回
//查询指定社团管理员相关通知信息列表
//@param manId 社团管理ID
// @return
/**
*
* @param manId ID
* @return
*/
@Select("<script>" +
//是MyBatis Plus中用于标识动态SQL脚本的开始
"SELECT " +
//这是SQL查询语句的开始部分用于选择要查询的字段
"id, title, detail, create_time createTime, team_id teamId " +
//列出要查询的activities表中的字段
"FROM notices " +
//这是SQL查询中的FROM子句
"WHERE (team_id IS NULL) OR (team_id IN (SELECT team_id FROM members WHERE user_id = #{manId})) " +
//用于指定查询的条件
"ORDER BY create_time DESC " +
//这是SQL查询中的ORDER BY子句
"</script>")
//是MyBatis Plus中动态SQL脚本的结束标记
public List<Notices> qryManNotices(String manId);
//这是一个接口方法名为qryManNotices接受一个String类型的参数manId返回类型为List<Notices>
//它的功能可能是查询指定社团管理员相关的通知信息列表通过上面的Select注解对应的SQL语句查询结果将以Notices实体类的列表形式返回
//查询指定社团成员相关通知信息列表
// @param memId 社团成员ID
//@return
/**
*
* @param memId ID
* @return
*/
@Select("<script>" +
//是MyBatis Plus中用于标识动态SQL脚本的开始
"SELECT " +
//这是SQL查询语句的开始部分用于选择要查询的字段
"id, title, detail, create_time createTime, team_id teamId " +
//列出要查询的activities表中的字段
"FROM notices " +
//这是SQL查询中的FROM子句
"WHERE (team_id IS NULL) OR (team_id IN (SELECT team_id FROM members WHERE user_id = #{memId})) " +
//用于指定查询的条件
"ORDER BY create_time DESC " +
//这是SQL查询中的ORDER BY子句
"</script>")
//是MyBatis Plus中动态SQL脚本的结束标记
public List<Notices> qryMemNotices(String memId);
//这是一个接口方法名为qryMemNotices接受一个String类型的参数memId返回类型为List<Notices>
//它的功能可能是查询指定社团成员相关的通知信息列表通过上面的Select注解对应的SQL语句查询结果将以Notices实体类的列表形式返回
//分页查找全部通知信息
// @param page 分页参数
// @param title 通知标题
// @param teamName 团队名称
// @return
/**
*
* @param page
* @param title
* @param teamName
* @return
*/
@Select("<script>" +
//是MyBatis Plus中用于标识动态SQL脚本的开始
"SELECT " +
//这是SQL查询语句的开始部分用于选择要查询的字段
"n.id, n.title, n.detail, n.create_time createTime, n.team_id teamId, t.name teamName " +
//列出要查询的activities表中的字段
"FROM notices n LEFT JOIN teams t ON n.team_id = t.id " +
//这是SQL查询中的FROM子句
"<where>" +
//用于指定查询的条件
"<if test='teamName != null and teamName.trim() != &quot;&quot; '>" +
//这是MyBatis Plus中的动态SQL语句的条件判断部分
"t.name LIKE CONCAT('%', #{teamName}, '%') " +
// 是MyBatis Plus中的动态SQL语句的条件判断部分
"</if>" +
//动态SQL条件判断部分的结束标记
"<if test='title != null and title.trim() != &quot;&quot; '>" +
//对test参数的动态SQL条件判断
"AND n.title LIKE CONCAT('%', #{title}, '%') " +
//包含title参数值的记录
"</if>" +
//动态SQL条件判断部分的结束标记
"</where>" +
//用于指定查询的条件
"ORDER BY n.create_time DESC " +
//这是SQL查询中的ORDER BY子句
"</script>")
//是MyBatis Plus中动态SQL脚本的结束标记
public Page<Map<String, Object>> qryPageAll(Page<Map<String, Object>> page,
//这是一个接口方法名为qryPageAll接受一个Page<Map<String, Object>>类型的参数page
//它的功能可能是分页查找全部通知信息通过上面的Select注解对应的SQL语句查询结果将以Map<String, Object>的分页形式返回
@Param("title") String title,
//使用@Param注解给title参数命名以便在SQL语句中准确引用这个参数
@Param("teamName") String teamName);
//使用@Param注解给teamName参数命名以便在SQL语句中准确引用这个参数
///获取指定用户相关的通知信息
// @param page 分页参数
// @param userId 指定用户ID
// @param title 通知标题
// @param teamName 团队名称
// @return
/**
*
* @param page
* @param userId ID
* @param title
* @param teamName
* @return
*/
@Select("<script>" +
//是MyBatis Plus中用于标识动态SQL脚本的开始
"SELECT " +
//这是SQL查询语句的开始部分用于选择要查询的字段
"n.id, n.title, n.detail, n.create_time createTime, n.team_id teamId, t.name teamName " +
//列出要查询的activities表中的字段
"FROM notices n JOIN teams t ON n.team_id = t.id " +
//这是SQL查询中的FROM子句
"<where>" +
//用于指定查询的条件
"team_id IN (SELECT team_id FROM members WHERE user_id = #{userId}) " +
"<if test='teamName != null and teamName.trim() != &quot;&quot; '>" +
//对test参数的动态SQL条件判断
"AND t.name LIKE CONCAT('%', #{teamName}, '%') " +
//包含teamName参数值的记录
"</if>" +
//动态SQL条件判断部分的结束标记
"<if test='title != null and title.trim() != &quot;&quot; '>" +
//对test参数的动态SQL条件判断
"AND n.title LIKE CONCAT('%', #{title}, '%') " +
//包含title参数值的记录
"</if>" +
//动态SQL条件判断部分的结束标记
"</where>" +
//用于指定查询的条件
"ORDER BY n.create_time DESC " +
//这是SQL查询中的ORDER BY子句
"</script>")
//是MyBatis Plus中动态SQL脚本的结束标记
public Page<Map<String, Object>> qryPageById(Page<Map<String, Object>> page,
//这是一个接口方法名为qryPageById接受一个Page<Map<String, Object>>类型的参数
//它的功能可能是获取指定用户相关的通知信息通过上面的Select注解对应的SQL语句查询结果将以`Map
@Param("userId") String userId,
//使用@Param注解给userID参数命名以便在SQL语句中准确引用这个参数
@Param("title") String title,
//使用@Param注解给title参数命名以便在SQL语句中准确引用这个参数
@Param("teamName") String teamName);
//使用@Param注解给teamName参数命名以便在SQL语句中准确引用这个参数
}

@ -1,76 +1,126 @@
package com.rabbiter.association.dao;
//声明了Java代码所属的包名为com.rabbiter.association.dao
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//用于处理分页相关的功能
import org.apache.ibatis.annotations.Param;
//在MyBatis框架中用于给SQL语句中的参数命名
import org.apache.ibatis.annotations.Select;
//用于在接口方法上标记对应的SQL查询语句
import org.springframework.stereotype.Repository;
//这个接口主要用于数据库访问操作
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
//是MyBatis Plus框架中的基础映射器接口
import com.rabbiter.association.entity.PayLogs;
//导入PayLogs实体类
import java.util.Map;
//导入Map接口用于处理键值对形式的数据可能在查询结果以键值对形式返回时使用
// 数据层处理接口
// 缴费记录
/**
*
*
*/
@Repository("payLogsDao")
//用于将payLogsDao接口标记为一个数据访问层DAO组件
public interface PayLogsDao extends BaseMapper<PayLogs> {
//定义一个名为PayLogsDao的公共接口它继承自BaseMapper<Notices>接口。这意味着它将继承BaseMapper接口中针对Notices实体类的通用数据库操作方法
// 分页查询费用记录
// @param page 分页参数
// @param userId 用户ID
// @param teamName 社团名称
// @param userName 用户姓名
// @return
/**
*
* @param page
* @param userId ID
* @param teamName
* @param userName
* @return
*/
@Select("<script>" +
//是MyBatis Plus中用于标识动态SQL脚本的开始
"SELECT " +
//这是SQL查询语句的开始部分用于选择要查询的字段
"pl.id, pl.create_time createTime, pl.total, pl.team_id teamId, pl.user_id userId, " +
//列出要查询的activities表中的字段
"t.name teamName, u.name userName, u.gender userGender, u.age userAge, u.phone userPhone " +
//这部分是查询teams表中的name字段别名为teamName、users表中的name别名为userName、gender别名为userGender、age别名为userAge、phone别名为userPhone字段
"FROM pay_logs pl, teams t, users u " +
//这一行指定了要从pay_logs、teams和users这三个表中查询数据
"<where> " +
//这是SQL中的WHERE子句的开始部分用于设置查询的条件
"pl.user_id = u.id AND pl.team_id = t.id " +
//这是连接paylogs表与users表、paylogs表与teams表的关联条件通过userid和teamid字段进行关联
"<if test='teamName != null and teamName.trim() != &quot;&quot; '>" +
//这是一个MyBatis Plus中的动态SQL条件判断如果teamName不为空且去除前后空格后不为空字符串则执行下面的SQL片段
"AND t.name LIKE CONCAT('%', #{teamName}, '%') " +
//如果满足前面teamName的条件就添加一个WHERE子句条件使得teams表中的name字段模糊匹配teamName变量的值
"</if>" +
//这是前面if条件判断的结束部分
"<if test='userName != null and userName.trim() != &quot;&quot; '>" +
//这是一个针对userName的动态SQL条件判断如果userName不为空且去除前后空格后不为空字符串则执行下面的SQL片段
"AND u.name LIKE CONCAT('%', #{userName}, '%') " +
//如果满足前面userName的条件就添加一个WHERE子句条件使得users表中的name字段模糊匹配userName变量的值
"</if>" +
//前面if条件判断的结束部分
"<if test='userId != null and userId.trim() != &quot;&quot; '>" +
//这是一个针对userId的动态SQL条件判断如果userId不为空且去除前后空格后不为空字符串则执行下面的SQL片段
"AND pl.user_id = #{userId} " +
//如果满足前面userId的条件就添加一个WHERE子句条件使得paylogs表中的userid等于userId变量的值
"</if>" +
//是前面if条件判断的结束部分
"</where>" +
//这是WHERE子句的结束部分
"ORDER BY pl.create_time DESC " +
//这是SQL语句中的ORDER BY子句按照paylogs表中的createtime字段降序排列查询结果
"</script>")
//这是MyBatis Plus中动态SQL脚本的结束部分
public Page<Map<String, Object>> qryPageInfo(Page<Map<String, Object>> page,
//这是定义一个名为qryPageInfo的方法该方法返回一个Page<Map<String, Object>>类型的结果接受一个Page<Map<String, Object>>类型的参数page
@Param("userId") String userId,
//这是为方法参数userId添加@Param注解指定在SQL中可以使用#{userId}这种方式引用该参数
@Param("teamName") String teamName,
//这是为方法参数teamName添加@Param注解指定在SQL中可以使用#{teamName}这种方式引用该参数
@Param("userName") String userName);
//这是为方法参数userName添加@Param注解指定在SQL中可以使用#{userName}这种方式引用该参数
@Select("<script>" +
//这是开始定义另一个@Select注解同样使用<script>标记动态SQL脚本的开始
"SELECT " +
//这是新的SQL查询语句的开始部分用于选择要查询的字段
"pl.id, pl.create_time createTime, pl.total, pl.team_id teamId, pl.user_id userId, " +
//这是要查询的pay_logs表中的一些字段与前面类似
"t.name teamName, u.name userName, u.gender userGender, u.age userAge, u.phone userPhone " +
//这是要查询teams表和users表中的一些字段与前面类似
"FROM pay_logs pl, teams t, users u " +
//这是指定要从pay_logs、teams和users这三个表中查询数据与前面类似
"<where> " +
//这是新的WHERE子句的开始部分
"pl.user_id = u.id AND pl.team_id = t.id " +
//这是连接paylogs表与users表、paylogs表与teams表的关联条件与前面类似
"<if test='teamName != null and teamName.trim() != &quot;&quot; '>" +
//这是一个针对teamName的动态SQL条件判断与前面类似
"AND t.name LIKE CONCAT('%', #{teamName}, '%') " +
//如果满足前面teamName的条件就添加一个WHERE子句条件与前面类似
"</if>" +
//这是前面if条件判断的结束部分
"<if test='userName != null and userName.trim() != &quot;&quot; '>" +
//这是一个针对userName的动态SQL条件判断与前面类似
"AND u.name LIKE CONCAT('%', #{userName}, '%') " +
//如果满足前面userName的条件就添加一个WHERE子句条件与前面类似
"</if>" +
//这是前面if条件判断的结束部分
"<if test='userId != null and userId.trim() != &quot;&quot; '>" +
//这是一个针对userId的动态SQL条件判断与前面类似
"AND (pl.user_id = #{userId} OR t.manager = #{userId}) " +
//如果满足前面userId的条件就添加一个WHERE子句条件这里是paylogs表中的userid等于userId变量的值或者teams表中的manager等于userId变量的值
"</if>" +
//这是前面if条件判断的结束部分
"</where>" +
//这是WHERE子句的结束部分
"ORDER BY pl.create_time DESC " +
//这是按照paylogs表中的createtime字段降序排列查询结果与前面类似
"</script>")
//这是新的动态SQL脚本的结束部分
public Page<Map<String, Object>> qryManPageInfo(Page<Map<String, Object>> page,
//这是定义一个名为qryManPageInfo的方法该方法返回一个Page<Map<String, Object>>类型的结果接受一个Page<Map<String, Object>>类型的参数page
@Param("userId") String userId,
//这是为方法参数userId添加@Param注解指定在SQL中可以使用#{userId}这种方式引用该参数
@Param("teamName") String teamName,
//这是为方法参数teamName添加@Param注解指定在SQL中可以使用#{teamName}这种方式引用该参数
@Param("userName") String userName);
//这是为方法参数userName添加@Param注解指定在SQL中可以使用#{userName}这种方式引用该参数
}

@ -1,161 +1,183 @@
package com.rabbiter.association.entity;
// 定义包名为com.rabbiter.association.entity表示这个类所在的包
import com.baomidou.mybatisplus.annotation.TableField;
// 导入MyBatis Plus的TableField注解用于标识实体类中的字段与数据库表字段的映射关系
import com.baomidou.mybatisplus.annotation.TableId;
// 导入MyBatis Plus的TableId注解用于标识实体类中的主键字段与数据库表主键字段的映射关系
import com.baomidou.mybatisplus.annotation.TableName;
// 导入MyBatis Plus的TableName注解用于标识实体类对应的数据库表名
import java.io.Serializable;
// 导入Serializable接口用于标记这个类可以被序列化方便在网络传输或存储
//数据实体类
// 活动信息
/**
*
*
*/
@TableName(value = "activities")
// 使用TableName注解指定这个实体类对应的数据库表名为"activities"
public class Activities implements Serializable {
private static final long serialVersionUID = 1L;
// 定义序列化版本号,用于在序列化和反序列化过程中确保版本兼容性
// 记录ID
/**
* ID
*/
@TableId(value = "id")
// 使用TableId注解指定数据库表中名为"id"的字段为主键字段对应实体类中的id属性
private String id;
// 以下是各个属性的get和set方法用于获取和设置属性的值
// 活动名称
/**
*
*/
@TableField(value = "name")
// 使用TableField注解指定数据库表中名为"name"的字段与实体类中的name属性相对应
private String name;
/**
*
*/
// 活动概述
@TableField(value = "comm")
// 使用TableField注解指定数据库表中名为"comm"的字段与实体类中的comm属性相对应
private String comm;
/**
*
*/
// 活动详情
@TableField(value = "detail")
// 使用TableField注解指定数据库表中名为"detail"的字段与实体类中的detail属性相对应
private String detail;
/**
*
*/
//活动要求
@TableField(value = "ask")
// 使用TableField注解指定数据库表中名为"ask"的字段与实体类中的ask属性相对应
private String ask;
/**
*
*/
// 报名人数
@TableField(value = "total")
// 使用TableField注解指定数据库表中名为"total"的字段与实体类中的total属性相对应
private Integer total;
/**
*
*/
@TableField(value = "active_time")
// 使用TableField注解指定数据库表中名为"active_time"的字段与实体类中的active_time属性相对应
private String activeTime;
/**
*
*/
//发布社团
@TableField(value = "team_id")
private String teamId;
// 使用TableField注解指定数据库表中名为"team_id"的字段与实体类中的team_id属性相对应
public String getId(){
// 定义一个名为getId的方法返回类型为String
// 该方法用于获取id属性的值
public String getId() {
return id;
}
public void setId(String id){
// 定义一个名为setId的方法接受一个String类型的参数id
// 该方法用于设置id属性的值
public void setId(String id) {
this.id = id;
}
public String getName(){
// 定义一个名为getName的方法返回类型为String
// 该方法用于获取name属性的值
public String getName() {
return name;
}
public void setName(String name){
// 定义一个名为setName的方法接受一个String类型的参数name
// 该方法用于设置name属性的值
public void setName(String name) {
this.name = name;
}
public String getComm(){
// 定义一个名为getComm的方法返回类型为String
// 该方法用于获取comm属性的值
public String getComm() {
return comm;
}
public void setComm(String comm){
// 定义一个名为setComm的方法接受一个String类型的参数comm
// 该方法用于设置comm属性的值
public void setComm(String comm) {
this.comm = comm;
}
public String getDetail(){
// 定义一个名为getDetail的方法返回类型为String
// 该方法用于获取detail属性的值
public String getDetail() {
return detail;
}
public void setDetail(String detail){
// 定义一个名为setDetail的方法接受一个String类型的参数detail
// 该方法用于设置detail属性的值
public void setDetail(String detail) {
this.detail = detail;
}
public String getAsk(){
// 定义一个名为getAsk的方法返回类型为String
// 该方法用于获取ask属性的值
public String getAsk() {
return ask;
}
public void setAsk(String ask){
// 定义一个名为setAsk的方法接受一个String类型的参数ask
// 该方法用于设置ask属性的值
public void setAsk(String ask) {
this.ask = ask;
}
public Integer getTotal(){
// 定义一个名为getTotal的方法返回类型为Integer
// 该方法用于获取total属性的值
public Integer getTotal() {
return total;
}
public void setTotal(Integer total){
// 定义一个名为setTotal的方法接受一个Integer类型的参数total
// 该方法用于设置total属性的值
public void setTotal(Integer total) {
this.total = total;
}
public String getActiveTime(){
// 定义一个名为getActiveTime的方法返回类型为String
// 该方法用于获取activeTime属性的值
public String getActiveTime() {
return activeTime;
}
public void setActiveTime(String activeTime){
// 定义一个名为setActiveTime的方法接受一个String类型的参数activeTime
// 该方法用于设置activeTime属性的值
public void setActiveTime(String activeTime) {
this.activeTime = activeTime;
}
public String getTeamId(){
// 定义一个名为getTeamId的方法返回类型为String
// 该方法用于获取teamId属性的值
public String getTeamId() {
return teamId;
}
public void setTeamId(String teamId){
// 定义一个名为setTeamId的方法接受一个String类型的参数teamId
// 该方法用于设置teamId属性的值
public void setTeamId(String teamId) {
this.teamId = teamId;
}
// 重写toString方法用于返回对象的字符串表示形式
// 在这个方法中,按照特定的格式将对象的各个属性组合成一个字符串
@Override
public String toString() {
return "Activities [id=" + id
return "Activities [id=" + id
+ ", name=" + name
+ ", comm=" + comm
+ ", detail=" + detail
@ -165,5 +187,4 @@ public class Activities implements Serializable {
+ ", teamId=" + teamId
+ "]";
}
}

@ -1,106 +1,122 @@
package com.rabbiter.association.entity;
// 定义包名为com.rabbiter.association.entity表示这个类所在的包
import com.baomidou.mybatisplus.annotation.TableField;
// 导入MyBatis Plus的TableField注解用于标识实体类中的字段与数据库表字段的映射关系
import com.baomidou.mybatisplus.annotation.TableId;
// 导入MyBatis Plus的TableId注解用于标识实体类中的主键字段与数据库表主键字段的映射关系
import com.baomidou.mybatisplus.annotation.TableName;
// 导入MyBatis Plus的TableName注解用于标识实体类对应的数据库表名
import java.io.Serializable;
// 导入Serializable接口用于标记这个类可以被序列化方便在网络传输或存储
// 数据实体类
// 通知记录
/**
*
*
*/
@TableName(value = "notices")
// 使用TableName注解指定这个实体类对应的数据库表名为"notices"
public class Notices implements Serializable {
private static final long serialVersionUID = 1L;
// 定义序列化版本号,用于在序列化和反序列化过程中确保版本兼容性
// 记录ID
/**
* ID
*/
@TableId(value = "id")
// 使用TableId注解指定数据库表中名为"id"的字段为主键字段对应实体类中的id属性
private String id;
/**
*
*/
// 通知标题
@TableField(value = "title")
// 使用TableField注解指定数据库表中名为"title"的字段与实体类中的title属性相对应
private String title;
/**
*
*/
// 通知详情
@TableField(value = "detail")
// 使用TableField注解指定数据库表中名为"detail"的字段与实体类中的detail属性相对应
private String detail;
/**
*
*/
// 发布时间
@TableField(value = "create_time")
// 使用TableField注解指定数据库表中名为"create_time"的字段与实体类中的create_time属性相对应
private String createTime;
/**
*
*/
// 发布社团
@TableField(value = "team_id")
// 使用TableField注解指定数据库表中名为"team_id"的字段与实体类中的team_id属性相对应
private String teamId;
public String getId(){
// 定义一个名为getId的方法返回类型为String
// 该方法用于获取id属性的值
public String getId() {
return id;
}
public void setId(String id){
// 定义一个名为setId的方法接受一个String类型的参数id
// 该方法用于设置id属性的值
public void setId(String id) {
this.id = id;
}
// 定义一个名为getTitle的方法返回类型为String
// 该方法用于获取title属性的值
public String getTitle(){
return title;
}
// 定义一个名为setTitle的方法接受一个String类型的参数title
// 该方法用于设置title属性的值
public void setTitle(String title){
this.title = title;
}
public String getDetail(){
// 定义一个名为getDetail的方法返回类型为String
// 该方法用于获取detail属性的值
public String getDetail() {
return detail;
}
public void setDetail(String detail){
// 定义一个名为setDetail的方法接受一个String类型的参数detail
// 该方法用于设置detail属性的值
public void setDetail(String detail) {
this.detail = detail;
}
// 定义一个名为getCreateTime的方法返回类型为createTime
// 该方法用于获取createTime属性的值
public String getCreateTime(){
return createTime;
}
// 定义一个名为setCreateTime的方法接受一个String类型的参数createTime
// 该方法用于设置createTime属性的值
public void setCreateTime(String createTime){
this.createTime = createTime;
}
public String getTeamId(){
// 定义一个名为getTeamId的方法返回类型为String
// 该方法用于获取teamId属性的值
public String getTeamId() {
return teamId;
}
public void setTeamId(String teamId){
// 定义一个名为setTeamId的方法接受一个String类型的参数teamId
// 该方法用于设置teamId属性的值
public void setTeamId(String teamId) {
this.teamId = teamId;
}
// 重写toString方法用于返回对象的字符串表示形式
// 在这个方法中,按照特定的格式将对象的各个属性组合成一个字符串
@Override
public String toString() {

@ -1,106 +1,123 @@
package com.rabbiter.association.entity;
// 定义包名为com.rabbiter.association.entity表示这个类所在的包
import com.baomidou.mybatisplus.annotation.TableField;
// 导入MyBatis Plus的TableField注解用于标识实体类中的字段与数据库表字段的映射关系
import com.baomidou.mybatisplus.annotation.TableId;
// 导入MyBatis Plus的TableId注解用于标识实体类中的主键字段与数据库表主键字段的映射关系
import com.baomidou.mybatisplus.annotation.TableName;
// 导入MyBatis Plus的TableName注解用于标识实体类对应的数据库表名
import java.io.Serializable;
// 导入Serializable接口用于标记这个类可以被序列化方便在网络传输或存储
// 数据实体类
// 缴费记录
/**
*
*
*/
@TableName(value = "pay_logs")
//使用TableName注解指定这个实体类对应的数据库表名为"pay_logs"
public class PayLogs implements Serializable {
private static final long serialVersionUID = 1L;
// 定义序列化版本号,用于在序列化和反序列化过程中确保版本兼容性
// 记录ID
/**
* ID
*/
@TableId(value = "id")
// 使用TableId注解指定数据库表中名为"id"的字段为主键字段对应实体类中的id属性
private String id;
/**
*
*/
// 缴费时间
@TableField(value = "create_time")
// 使用TableId注解指定数据库表中名为"create_time"的字段为主键字段对应实体类中的createTime属性
private String createTime;
/**
*
*/
//缴纳费用
@TableField(value = "total")
// 使用TableId注解指定数据库表中名为"total"的字段为主键字段对应实体类中的total属性
private Double total;
/**
*
*/
//收费社团
@TableField(value = "team_id")
// 使用TableId注解指定数据库表中名为"team_id"的字段为主键字段对应实体类中的team_id属性
private String teamId;
/**
*
*/
// 缴费用户
@TableField(value = "user_id")
// 使用TableId注解指定数据库表中名为"user_id"的字段为主键字段对应实体类中的user_id属性
private String userId;
public String getId(){
// 定义一个名为getId的方法返回类型为String
// 该方法用于获取id属性的值
public String getId() {
return id;
}
public void setId(String id){
// 定义一个名为setId的方法接受一个String类型的参数id
// 该方法用于设置id属性的值
public void setId(String id) {
this.id = id;
}
// 定义一个名为getCreateTime的方法返回类型为createTime
// 该方法用于获取createTime属性的值
public String getCreateTime(){
return createTime;
}
// 定义一个名为setCreateTime的方法接受一个String类型的参数createTime
// 该方法用于设置createTime属性的值
public void setCreateTime(String createTime){
this.createTime = createTime;
}
public Double getTotal(){
// 定义一个名为getTotal的方法返回类型为Integer
// 该方法用于获取total属性的值
public Integer getTotal() {
return total;
}
public void setTotal(Double total){
// 定义一个名为setTotal的方法接受一个Integer类型的参数total
// 该方法用于设置total属性的值
public void setTotal(Integer total) {
this.total = total;
}
public String getTeamId(){
// 定义一个名为getTeamId的方法返回类型为String
// 该方法用于获取teamId属性的值
public String getTeamId() {
return teamId;
}
public void setTeamId(String teamId){
// 定义一个名为setTeamId的方法接受一个String类型的参数teamId
// 该方法用于设置teamId属性的值
public void setTeamId(String teamId) {
this.teamId = teamId;
}
// 定义一个名为getUserId的方法返回类型为String
// 该方法用于获取teamId属性的值
public String getUserId(){
return userId;
}
// 定义一个名为setUserId的方法接受一个String类型的参数userId
// 该方法用于设置userId属性的值
public void setUserId(String userId){
this.userId = userId;
}
// 重写toString方法用于返回对象的字符串表示形式
// 在这个方法中,按照特定的格式将对象的各个属性组合成一个字符串
@Override
public String toString() {

@ -1,34 +1,35 @@
package com.rabbiter.association.service;
//定义了一个Java包package名为com.rabbiter.association.service
import com.rabbiter.association.msg.PageData;
//当前的Java类中需要使用com.rabbiter.association.msg包中的PageData类
import com.rabbiter.association.entity.Activities;
//使得在当前的Java类中能够使用com.rabbiter.association.entity包中的Activities类
// 业务层处理
// 活动信息
/**
*
*
*/
public interface ActivitiesService extends BaseService<Activities, String> {
//Activities接口它继承自BaseService
// 这里的BaseService是处理PayLogs类型对象并且以String作为主键类型的服务接口
// 分页查询活动信息信息
// @param pageIndex 当前页码
// @param pageSize 每页数据量
// @param activeName 活动名称
// @param teamName 团队名称
// @return
/**
*
* @param pageIndex
* @param pageSize
* @param activeName
* @param teamName
* @return
*/
public PageData getPageAll(Long pageIndex, Long pageSize, String activeName, String teamName);
/**
*
* @param pageIndex
* @param pageSize
* @param userId ID
* @param activeName
* @param teamName
* @return
*/
// 分页查询指定成员相关活动信息信息
// @param pageIndex 当前页码
// @param pageSize 每页数据量
// @param userId 指定成员ID
// @param activeName 活动名称
// @param teamName 团队名称
// @return
public PageData getPageByUserId(Long pageIndex, Long pageSize, String userId, String activeName, String teamName);
}

@ -1,55 +1,56 @@
package com.rabbiter.association.service;
//定义了一个Java包package名为com.rabbiter.association.service
import com.rabbiter.association.msg.PageData;
//当前的Java类中需要使用com.rabbiter.association.msg包中的PageData类
import com.rabbiter.association.entity.Notices;
//使得在当前的Java类中能够使用com.rabbiter.association.entity包中的Activities类
import java.util.List;
/**
*
*
*/
// 业务层处理
// 通知记录
public interface NoticesService extends BaseService<Notices, String> {
//NoticesService接口它继承自BaseService
// 这里的BaseService是处理PayLogs类型对象并且以String作为主键类型的服务接口
// 获取系统发布的通知信息
// @return
/**
*
* @return
*/
public List<Notices> getSysNotices();
/**
*
* @param manId ID
* @return
*/
// 获取社团管理员相关的通知信息
// @param manId 社团管理员ID
// @return
public List<Notices> getManNotices(String manId);
/**
*
* @param memId ID
* @return
*/
// 获取社团成员相关通知信息
// @param memId 社团成员ID
// @return
//
public List<Notices> getMemNotices(String memId);
/**
*
* @param pageIndex
* @param pageSize
* @param title
* @param teamName
* @return
*/
// 分页查询通知记录信息
// @param pageIndex 当前页码
// @param pageSize 每页数据量
// @param title 通知标题
// @param teamName 社团名称
// @return
public PageData getPageAll(Long pageIndex, Long pageSize, String title, String teamName);
/**
*
* @param pageIndex
* @param pageSize
* @param userId ID
* @param title
* @param teamName
* @return
*/
// 分页查询指定用户相关通知记录信息
// @param pageIndex 当前页码
// @param pageSize 每页数据量
// @param userId 用户ID
// @param title 通知标题
// @param teamName 社团名称
// @return
public PageData getPageById(Long pageIndex, Long pageSize, String userId, String title, String teamName);
}

@ -1,34 +1,35 @@
package com.rabbiter.association.service;
//定义了一个Java包package名为com.rabbiter.association.service
import com.rabbiter.association.msg.PageData;
//使得在当前的Java类中能够使用com.rabbiter.association.entity包中的Activities类
import com.rabbiter.association.entity.PayLogs;
//使得在当前的Java类中能够使用com.rabbiter.association.entity包中的PayLogs类
// 业务层处理
// 缴费记录
/**
*
*
*/
public interface PayLogsService extends BaseService<PayLogs, String> {
//PayLogsService接口它继承自BaseService
// 这里的BaseService是处理PayLogs类型对象并且以String作为主键类型的服务接口
// 团队管理员分页查询缴费记录信息
// @param pageIndex 当前页码
// @param pageSize 每页数据量
// @param userId 用户编号
// @param teamName 团队名称
// @param userName 用户姓名
// @return
/**
*
* @param pageIndex
* @param pageSize
* @param userId
* @param teamName
* @param userName
* @return
*/
public PageData getManPageInfo(Long pageIndex, Long pageSize, String userId, String teamName, String userName);
/**
*
* @param pageIndex
* @param pageSize
* @param userId
* @param teamName
* @param userName
* @return
*/
// 分页查询缴费记录信息
// @param pageIndex 当前页码
// @param pageSize 每页数据量
// @param userId 用户编号
// @param teamName 团队名称
// @param userName 用户姓名
// @return
public PageData getPageInfo(Long pageIndex, Long pageSize, String userId, String teamName, String userName);
}

@ -1,107 +1,129 @@
package com.rabbiter.association.service.impl;
//导入MyBatis Plus的查询条件包装类用于构建数据库查询条件
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//导入MyBatis Plus的分页插件相关类用于进行分页操作
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//导入Spring框架中用于自动注入的注解相关类
import org.springframework.beans.factory.annotation.Autowired;
//用于标记该类为Spring中的服务层组件
import org.springframework.stereotype.Service;
//导入Spring框架中的事务传播行为和事务相关注解
import org.springframework.transaction.annotation.Propagation;
//导入活动日志数据访问对象接口,用于操作活动日志相关的数据库操作
import org.springframework.transaction.annotation.Transactional;
//导入活动日志数据访问对象接口,用于操作活动日志相关的数据库操作
import com.rabbiter.association.dao.ActiveLogsDao;
//导入团队数据访问对象接口,用于操作团队相关的数据库操作
import com.rabbiter.association.dao.TeamsDao;
//导入活动日志实体类,用于表示活动日志的对象结构
import com.rabbiter.association.entity.ActiveLogs;
//导入团队实体类,用于表示团队的对象结构
import com.rabbiter.association.entity.Teams;
//导入分页数据类,可能用于封装分页相关的数据(如当前页、每页大小、总记录数等)
import com.rabbiter.association.msg.PageData;
//导入活动实体类,用于表示活动的对象结构
import com.rabbiter.association.entity.Activities;
//导入活动数据访问对象接口,用于操作活动相关的数据库操作
import com.rabbiter.association.dao.ActivitiesDao;
//导入活动服务接口,该类实现此接口
import com.rabbiter.association.service.ActivitiesService;
//导入日期工具类,可能用于处理日期相关的操作(如获取当前日期等)
import com.rabbiter.association.utils.DateUtils;
//导入ID生成工具类可能用于生成唯一的ID
import com.rabbiter.association.utils.IDUtils;
//导入Java的Map接口用于存储键值对数据可能在数据库查询结果转换等场景使用
import java.util.Map;
//导入Map接口用于处理键值对形式的数据可能在查询结果以键值对形式返回时使用
@Service("activitiesService")
//该类实现了ActivitiesService接口作为活动相关业务逻辑的实现类
public class ActivitiesServiceImpl implements ActivitiesService {
//使用Spring的自动注入功能注入TeamsDao实例用于团队数据访问操作
@Autowired
private TeamsDao teamsDao;
//使用Spring的自动注入功能注入ActiveLogsDao实例用于活动日志数据访问操作
@Autowired
private ActiveLogsDao activeLogsDao;
//使用Spring的自动注入功能注入ActivitiesDao实例用于活动数据访问操作
@Autowired
private ActivitiesDao activitiesDao;
//实现ActivitiesService接口中的add方法用于添加活动并关联相关的活动日志
@Override
@Transactional
public void add(Activities activities) {
//在活动数据访问对象中插入活动记录
activitiesDao.insert(activities);
//根据活动关联的团队ID从团队数据访问对象中查询团队信息
Teams teams = teamsDao.selectById(activities.getTeamId());
//创建一个新的活动日志对象
ActiveLogs activeLog = new ActiveLogs();
//使用ID生成工具类为活动日志生成一个唯一的ID
activeLog.setId(IDUtils.makeIDByCurrent());
//设置活动日志中的活动ID为刚插入的活动的ID
activeLog.setActiveId(activities.getId());
//设置活动日志中的用户ID为团队的管理者ID
activeLog.setUserId(teams.getManager());
//使用日期工具类获取当前日期,并设置为活动日志的创建时间
activeLog.setCreateTime(DateUtils.getNowDate());
//在活动日志数据访问对象中插入活动日志记录
activeLogsDao.insert(activeLog);
}
//实现ActivitiesService接口中的update方法用于更新活动信息
@Override
@Transactional
public void update(Activities activities) {
//在活动数据访问对象中根据活动ID更新活动信息
activitiesDao.updateById(activities);
}
//实现ActivitiesService接口中的delete方法用于删除活动及其相关的活动日志
@Override
@Transactional
public void delete(Activities activities) {
//创建一个查询条件包装器用于查询与指定活动ID相关的活动日志
QueryWrapper<ActiveLogs> qw = new QueryWrapper<ActiveLogs>();
qw.eq("active_id", activities.getId());
//根据查询条件删除活动日志
activeLogsDao.delete(qw);
//在活动数据访问对象中根据活动ID删除活动记录
activitiesDao.deleteById(activities);
}
//实现ActivitiesService接口中的getOne方法用于根据活动ID获取单个活动信息
@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
public Activities getOne(String id) {
//在活动数据访问对象中根据活动ID查询活动信息
Activities activities = activitiesDao.selectById(id);
//返回查询到的活动信息
return activities;
}
//实现ActivitiesService接口中的getPageAll方法用于获取所有活动可能按条件分页的相关信息
@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
public PageData getPageAll(Long pageIndex, Long pageSize, String activeName, String teamName) {
//使用活动数据访问对象进行分页查询所有活动(根据活动名称和团队名称可能进行筛选)
Page<Map<String, Object>> page =
activitiesDao.qryPageAll(new Page<Map<String, Object>>(pageIndex, pageSize), activeName, teamName);
//调用parsePage方法将查询结果转换为PageData类型并返回
return parsePage(page);
}
//将MyBatis Plus的分页查询结果转换为自定义的PageData类型的方法
@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
public PageData getPageByUserId(Long pageIndex, Long pageSize, String userId, String activeName, String teamName) {
//创建一个新的PageData对象传入当前页、每页大小、总记录数和查询到的记录数据
Page<Map<String, Object>> page =
activitiesDao.qryPageByMemId(new Page<Map<String, Object>>(pageIndex, pageSize), userId, activeName, teamName);
//返回转换后的PageData对象
return parsePage(page);
}
/**
*
*/
public PageData parsePage(Page<Map<String, Object>> p) {
PageData pageData = new PageData(p.getCurrent(), p.getSize(), p.getTotal(), p.getRecords());
// 转化分页查询的结果
//定义一个名为parsePage的方法它接受一个Page<Map<String, Object>>类型的参数p这个Page可能是某种分页数据结构其中包含了以字符串为键Object为值的映射
public PageData parsePage(Page<Map<String, Object>> p) {
//创建一个新的PageData对象
PageData pageData = new PageData(p.getCurrent(), p.getSize(), p.getTotal(), p.getRecords());
//返回创建并初始化好的PageData对象
return pageData;
}
}

@ -1,57 +1,79 @@
package com.rabbiter.association.service.impl;
//导入MyBatis Plus的查询条件包装类用于构建数据库查询条件
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//导入Spring框架中用于自动注入的注解相关类
import org.springframework.beans.factory.annotation.Autowired;
//用于标记该类为Spring中的服务层组件
import org.springframework.stereotype.Service;
//导入Spring框架中的事务传播行为和事务相关注解
import org.springframework.transaction.annotation.Propagation;
//导入活动日志数据访问对象接口,用于操作活动日志相关的数据库操作
import org.springframework.transaction.annotation.Transactional;
//导入活动日志数据访问对象接口,用于操作活动日志相关的数据库操作
import com.rabbiter.association.dao.TeamsDao;
//导入活动日志实体类,用于表示活动日志的对象结构
import com.rabbiter.association.entity.Teams;
//导入MyBatis Plus的查询条件包装类用于构建数据库查询条件
import com.rabbiter.association.msg.PageData;
//导入活动实体类,用于表示活动的对象结构
import com.rabbiter.association.entity.Notices;
//导入活动数据访问对象接口,用于操作活动相关的数据库操作
import com.rabbiter.association.dao.NoticesDao;
//导入活动服务接口,该类实现此接口
import com.rabbiter.association.service.NoticesService;
//导入日期工具类,可能用于处理日期相关的操作(如获取当前日期等)
import com.rabbiter.association.utils.StringUtils;
//导入活动服务接口,该类实现此接口
import java.util.ArrayList;
//导入ArrayList接口用于处理键值对形式的数据可能在查询结果以键值对形式返回时使用
import java.util.HashMap;
//导入HashMap接口用于处理键值对形式的数据可能在查询结果以键值对形式返回时使用
import java.util.List;
//导入List接口用于处理键值对形式的数据可能在查询结果以键值对形式返回时使用
import java.util.Map;
//导入Map接口用于处理键值对形式的数据可能在查询结果以键值对形式返回时使用
@Service("noticesService")
//将这个类标记为一个名为"noticesService"的服务以便在Spring框架中进行管理
public class NoticesServiceImpl implements NoticesService {
@Autowired
private NoticesDao noticesDao;
// 自动注入NoticesDao实例用于数据库操作相关的通知功能
private NoticesDao noticesDao;
@Autowired
private TeamsDao teamsDao;
@Autowired
// 自动注入TeamsDao实例用于与团队相关的数据库操作
private TeamsDao teamsDao;
@Override
@Transactional
public void add(Notices notices) {
noticesDao.insert(notices);
// 定义一个事务,保证这个方法在一个事务环境中执行
public void add(Notices notices) {
// 调用noticesDao的insert方法将通知插入数据库
noticesDao.insert(notices);
}
@Override
@Transactional
public void update(Notices notices) {
//定义一个事务,保证这个方法在一个事务环境中执行
public void update(Notices notices) {
// 调用noticesDao的updateById方法根据通知的id更新通知
noticesDao.updateById(notices);
}
@Override
@Transactional
public void delete(Notices notices) {
// 定义一个事务,保证这个方法在一个事务环境中执行
public void delete(Notices notices) {
// 调用noticesDao的deleteById方法根据通知的id删除通知
noticesDao.deleteById(notices);
}
@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
// 定义一个事务设置为只读且传播行为为SUPPORTS用于查询单个通知
public Notices getOne(String id) {
// 调用noticesDao的selectById方法根据id查询通知
Notices notices = noticesDao.selectById(id);
@ -60,7 +82,9 @@ public class NoticesServiceImpl implements NoticesService {
@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
public List<Notices> getSysNotices(){
// 定义一个事务设置为只读且传播行为为SUPPORTS用于查询系统通知
public List<NoticesgetSysNotices() {
// 调用noticesDao的qrySysNotices方法查询系统通知列表
List<Notices> list = noticesDao.qrySysNotices();
@ -69,8 +93,9 @@ public class NoticesServiceImpl implements NoticesService {
@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
public List<Notices> getManNotices(String manId){
// 定义一个事务设置为只读且传播行为为SUPPORTS用于查询指定人员的通知
public List<NoticesgetManNotices(String manId) {
// 调用noticesDao的qryManNotices方法查询指定人员id的通知列表
List<Notices> list = noticesDao.qryManNotices(manId);
return list;
@ -78,8 +103,9 @@ public class NoticesServiceImpl implements NoticesService {
@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
public List<Notices> getMemNotices(String memId){
// 定义一个事务设置为只读且传播行为为SUPPORTS用于查询指定成员的通知
public List<NoticesgetMemNotices(String memId) {
// 调用noticesDao的qryMemNotices方法查询指定成员id的通知列表
List<Notices> list = noticesDao.qryMemNotices(memId);
return list;
@ -87,8 +113,9 @@ public class NoticesServiceImpl implements NoticesService {
@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
public PageData getPageAll(Long pageIndex, Long pageSize, String title, String teamName){
// 定义一个事务设置为只读且传播行为为SUPPORTS用于分页查询所有通知
public PageData getPageAll(Long pageIndex, Long pageSize, String title, String teamName) {
// 调用noticesDao的qryPageAll方法进行分页查询传入页码、每页大小、标题和团队名称
Page<Map<String, Object>> page =
noticesDao.qryPageAll(new Page<Map<String, Object>>(pageIndex, pageSize), title, teamName);
@ -97,55 +124,68 @@ public class NoticesServiceImpl implements NoticesService {
@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
public PageData getPageById(Long pageIndex, Long pageSize, String userId, String title, String teamName){
// 定义一个事务设置为只读且传播行为为SUPPORTS用于根据用户id分页查询通知
public PageData getPageById(Long pageIndex, Long pageSize, String userId, String title, String teamName) {
// 调用noticesDao的qryPageById方法进行分页查询传入页码、每页大小、用户id、标题和团队名称
Page<Map<String, Object>> page =
noticesDao.qryPageById(new Page<Map<String, Object>>(pageIndex, pageSize), userId, title, teamName);
return parsePage(page);
}
/**
*
* @param notices
* @return
*/
public List<Map<String, Object>> parseList(List<Notices> notices){
List<Map<String, Object>> resl = new ArrayList<Map<String, Object>>();
// 查询列表结果转换
// @param notices
// @return
public List<Map<String, Object>> parseList(List<Notices> notices){
//创建一个用于存储转换结果的List<Map<String, Object>>
List<Map<String, Object>> resl = new ArrayList<Map<String, Object>>();
for (Notices notice : notices) {
//为每个通知创建一个临时的Map用于存储转换后的结果
Map<String, Object> temp = new HashMap<String, Object>();
// 将通知的id放入临时Map
temp.put("id", notice.getId());
//将通知的标题放入临时Map
temp.put("title", notice.getTitle());
//将通知的详细内容放入临时Map
temp.put("detail", notice.getDetail());
//将通知的创建时间放入临时Map
temp.put("createTime", notice.getCreateTime());
if(StringUtils.isNotNullOrEmpty(notice.getTeamId())){
//如果通知的团队id不为空
// 根据团队id查询团队信息
Teams teams = teamsDao.selectById(notice.getTeamId());
//将团队名称放入临时Map
temp.put("teamId", notice.getTeamId());
//将是否属于团队标志设为true
temp.put("teamName", teams.getName());
temp.put("isTeam", true);
}else{
//如果通知的团队id为空将是否属于团队标志设为false
temp.put("isTeam", false);
}
//将转换后的临时Map添加到结果List中
resl.add(temp);
}
return resl;
}
/**
*
*/
// 转化分页查询的结果
// 将分页查询结果转换为 PageData
// @param p 分页查询结果
// @return 转换后的 PageData
public PageData parsePage(Page<Map<String, Object>> p) {
PageData pageData = new PageData(p.getCurrent(), p.getSize(), p.getTotal(), p.getRecords());
// 创建一个PageData对象将传入的Page中的当前页码、每页大小、总记录数和记录列表传入
return pageData;
}
}

@ -1,88 +1,107 @@
package com.rabbiter.association.service.impl;
//导入MyBatis Plus的查询条件包装类用于构建数据库查询条件
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//导入Spring框架中用于自动注入的注解相关类
import com.rabbiter.association.service.PayLogsService;
//导入Spring框架中用于自动注入的注解相关类
import org.springframework.beans.factory.annotation.Autowired;
//用于标记该类为Spring中的服务层组件
import org.springframework.stereotype.Service;
//导入Spring框架中的事务传播行为和事务相关注解
import org.springframework.transaction.annotation.Propagation;
//导入活动日志数据访问对象接口,用于操作活动日志相关的数据库操作
import org.springframework.transaction.annotation.Transactional;
//导入活动日志数据访问对象接口,用于操作活动日志相关的数据库操作
import com.rabbiter.association.dao.TeamsDao;
//导入活动日志实体类,用于表示活动日志的对象结构
import com.rabbiter.association.dao.UsersDao;
//导入活动日志实体类,用于表示活动日志的对象结构
import com.rabbiter.association.msg.PageData;
//导入活动实体类,用于表示活动的对象结构
import com.rabbiter.association.entity.PayLogs;
//导入活动服务接口,该类实现此接口
import com.rabbiter.association.dao.PayLogsDao;
//导入活动服务接口,该类实现此接口
import java.util.Map;
//导入Map接口用于处理键值对形式的数据可能在查询结果以键值对形式返回时使用
@Service("payLogsService")
//表示这是一个名为payLogsService的服务类由Spring框架管理
public class PayLogsServiceImpl implements PayLogsService {
@Autowired
//自动注入PayLogsDao实例用于操作PayLogs相关的数据库操作
private PayLogsDao payLogsDao;
@Autowired
//自动注入TeamsDao实例可能用于与团队相关的数据库操作从名字推测
private TeamsDao teamsDao;
@Autowired
// 自动注入UsersDao实例可能用于与用户相关的数据库操作从名字推测
private UsersDao usersDao;
@Override
@Transactional
//该方法被标记为事务性方法,在执行数据库插入操作时提供事务管理
public void add(PayLogs payLogs) {
payLogsDao.insert(payLogs);
// 调用PayLogsDao的insert方法将payLogs对象插入数据库
}
@Override
@Transactional
// 该方法被标记为事务性方法,在执行数据库更新操作时提供事务管理
public void update(PayLogs payLogs) {
payLogsDao.updateById(payLogs);
// 调用PayLogsDao的updateById方法根据payLogs对象的id更新数据库中的记录
}
@Override
@Transactional
// 该方法被标记为事务性方法,在执行数据库删除操作时提供事务管理
public void delete(PayLogs payLogs) {
payLogsDao.deleteById(payLogs);
// 调用PayLogsDao的deleteById方法根据payLogs对象的id删除数据库中的记录
}
@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
// 该方法被标记为事务性方法设置为只读事务且传播行为为SUPPORTS
public PayLogs getOne(String id) {
PayLogs payLogs = payLogsDao.selectById(id);
// 调用PayLogsDao的selectById方法根据id从数据库中查询PayLogs对象
return payLogs;
}
@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
//该方法被标记为事务性方法设置为只读事务且传播行为为SUPPORTS
public PageData getManPageInfo(Long pageIndex, Long pageSize, String userId, String teamName, String userName) {
Page<Map<String, Object>> page =
payLogsDao.qryManPageInfo(new Page<Map<String, Object>>(pageIndex, pageSize), userId, teamName, userName);
//调用PayLogsDao的qryManPageInfo方法传入分页信息、用户id、团队名称和用户名称查询相关页面信息结果为一个包含Map<String, Object>的分页对象
return parsePage(page);
}
@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
//该方法被标记为事务性方法设置为只读事务且传播行为为SUPPORTS
public PageData getPageInfo(Long pageIndex, Long pageSize, String userId, String teamName, String userName) {
Page<Map<String, Object>> page =
payLogsDao.qryPageInfo(new Page<Map<String, Object>>(pageIndex, pageSize), userId, teamName, userName);
//调用PayLogsDao的qryPageInfo方法传入分页信息、用户id、团队名称和用户名称查询相关页面信息结果为一个包含Map<String, Object>的分页对象
return parsePage(page);
}
/**
*
*/
// 转化分页查询的结果
public PageData parsePage(Page<Map<String, Object>> p) {
PageData pageData = new PageData(p.getCurrent(), p.getSize(), p.getTotal(), p.getRecords());
//创建一个PageData对象使用传入的分页对象p中的当前页、每页大小、总记录数和记录列表进行初始化
return pageData;
}

@ -1,323 +1,386 @@
<template>
<div class="fater-body-show">
<el-card shadow="never">
<div
class="el-card-header"
slot="header"
style="font-size: 26px"
>
<i class="iconfont icon-r-find" style="font-size: 26px"></i>
信息查询
</div>
<div>
<el-form :inline="true" :model="qryForm">
<el-form-item>
<el-input
v-model="qryForm.title"
placeholder="输入通知标题…"
autocomplete="off"
></el-input>
</el-form-item>
<el-form-item>
<el-input
v-model="qryForm.teamName"
placeholder="输入团队名称"
autocomplete="off"
></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="getPageLikeInfo()" style="font-size: 18px"
> 搜索</el-button>
</el-form-item>
</el-form>
</div>
</el-card>
<!-- 父组件的主体部分 -->
<div class="fater-body-show">
<!-- 卡片组件无边框 -->
<el-card shadow="never">
<!-- 卡片头部包含一个图标和标题 -->
<div class="el-card-header" slot="header" style="font-size: 26px">
<!-- 图标 -->
<i class="iconfont icon-r-find" style="font-size: 26px"></i>
<!-- 标题 -->
信息查询
</div>
<!-- 卡片内容 -->
<div>
<!-- 内联表单组件 -->
<el-form :inline="true" :model="qryForm">
<!-- 表单输入项用于输入通知标题 -->
<el-form-item>
<el-input
v-model="qryForm.title"
placeholder="输入通知标题…"
autocomplete="off"
></el-input>
</el-form-item>
<!-- 表单输入项用于输入团队名称 -->
<el-form-item>
<el-input
v-model="qryForm.teamName"
placeholder="输入团队名称"
autocomplete="off"
></el-input>
</el-form-item>
<!-- 表单按钮用于搜索 -->
<el-form-item>
<el-button type="primary" @click="getPageLikeInfo()" style="font-size: 18px">
搜索
</el-button>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card shadow="never">
<div v-if="userType != 2" slot="header">
<el-button
type="primary"
style="font-size: 18px"
@click="showAddWin()"
>
新增</el-button
>
</div>
<div>
<el-table
v-loading="loading"
element-loading-text="拼命加载中"
element-loading-spinner="el-icon-loading"
element-loading-background="rgba(124, 124, 124, 0.8)"
:data="pageInfos"
border
>
<el-table-column
align="center"
type="index"
></el-table-column>
<el-table-column
align="center"
prop="title"
label="通知标题"
></el-table-column>
<el-table-column
align="center"
prop="teamId"
label="发布社团"
>
<template slot-scope="scope">
<el-tag v-if="scope.row.teamName" type="success">{{
scope.row.teamName
}}</el-tag>
<el-tag v-else type="warning">系统通知</el-tag>
</template>
</el-table-column>
<el-table-column
align="center"
prop="createTime"
label="发布时间"
></el-table-column>
<el-table-column
align="center"
prop="detail"
label="通知详情"
></el-table-column>
<el-table-column
v-if="userType == 0"
align="center"
label="操作处理"
fixed="right"
width="140"
>
<template slot-scope="scope">
<el-button
type="danger" style="font-size: 18px"
@click="delInfo(scope.row.id)"
> 删除</el-button>
</template>
</el-table-column>
<el-table-column
v-if="userType == 1"
align="center"
label="操作处理"
fixed="right"
width="140"
>
<template slot-scope="scope">
<el-button
v-if="scope.row.teamId"
type="danger" style="font-size: 18px"
@click="delInfo(scope.row.id)"
> 删除</el-button>
<el-button v-else type="danger" disabled style="font-size: 18px"
> 删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
v-if="pageTotal >= 0"
style="margin-top: 15px"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="pageIndex"
:page-sizes="[5, 10, 20, 50]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="totalInfo"
>
</el-pagination>
</div>
</el-card>
<!-- 另一个卡片组件无边框 -->
<el-card shadow="never">
<!-- 卡片头部根据用户类型显示不同的按钮 -->
<div v-if="userType!= 2" slot="header">
<!-- 新增按钮 -->
<el-button
type="primary"
style="font-size: 18px"
@click="showAddWin()"
>
新增
</el-button>
</div>
<!-- 卡片内容 -->
<div>
<!-- 表格组件加载中时显示加载动画 -->
<el-table
v-loading="loading"
element-loading-text="拼命加载中"
element-loading-spinner="el-icon-loading"
element-loading-background="rgba(124, 124, 124, 0.8)"
:data="pageInfos"
border
>
<!-- 表格列索引 -->
<el-table-column align="center" type="index"></el-table-column>
<!-- 表格列通知标题 -->
<el-table-column align="center" prop="title" label="通知标题"></el-table-column>
<!-- 表格列发布社团 -->
<el-table-column
align="center"
prop="teamId"
label="发布社团"
>
<!-- 表格行模板根据团队名称显示不同的标签 -->
<template slot-scope="scope">
<el-tag v-if="scope.row.teamName" type="success">{{ scope.row.teamName }}</el-tag>
<el-tag v-else type="warning">系统通知</el-tag>
</template>
</el-table-column>
<!-- 表格列发布时间 -->
<el-table-column
align="center"
prop="createTime"
label="发布时间"
></el-table-column>
<!-- 表格列通知详情 -->
<el-table-column
align="center"
prop="detail"
label="通知详情"
></el-table-column>
<!-- 表格列操作处理 -->
<el-table-column
v-if="userType == 0"
align="center"
label="操作处理"
fixed="right"
width="140"
>
<!-- 表格行模板删除按钮 -->
<template slot-scope="scope">
<el-button
type="danger"
style="font-size: 18px"
@click="delInfo(scope.row.id)"
>
删除
</el-button>
</template>
</el-table-column>
<!-- 表格列操作处理 -->
<el-table-column
v-if="userType == 1"
align="center"
label="操作处理"
fixed="right"
width="140"
>
<!-- 表格行模板根据团队 ID 判断是否显示删除按钮 -->
<template slot-scope="scope">
<el-button
v-if="scope.row.teamId"
type="danger"
style="font-size: 18px"
@click="delInfo(scope.row.id)"
>
删除
</el-button>
<el-button v-else type="danger" disabled style="font-size: 18px">
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<el-pagination
v-if="pageTotal >= 0"
style="margin-top: 15px"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="pageIndex"
:page-sizes="[5, 10, 20, 50]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="totalInfo"
>
</el-pagination>
</div>
</el-card>
<el-dialog title="添加信息" width="600px" :visible.sync="showAddFlag">
<el-form label-width="90px" :model="noticesForm">
<el-form-item label="通知标题">
<el-input
v-model="noticesForm.title"
placeholder="请输入通知标题…"
autocomplete="off"
></el-input>
</el-form-item>
<el-form-item v-if="userType == 1" label="发布社团">
<el-select
style="width: 100%"
v-model="noticesForm.teamId"
placeholder="请选择发布社团…"
>
<el-option
v-for="(item, index) in teams"
:key="index"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="通知详情">
<el-input
type="textarea"
rows="5"
v-model="noticesForm.detail"
placeholder="请输入通知详情…"
autocomplete="off"
></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="showAddFlag = false" style="font-size: 18px"
>
</el-button
>
<el-button
type="primary"
@click="addInfo()"
style="font-size: 18px"
>
</el-button
>
</div>
</el-dialog>
</div>
<!-- 对话框组件用于添加信息 -->
<el-dialog title="添加信息" width="600px" :visible.sync="showAddFlag">
<!-- 表单组件标签宽度为 90px -->
<el-form label-width="90px" :model="noticesForm">
<!-- 表单输入项通知标题 -->
<el-form-item label="通知标题">
<el-input
v-model="noticesForm.title"
placeholder="请输入通知标题…"
autocomplete="off"
></el-input>
</el-form-item>
<!-- 表单输入项发布社团 -->
<el-form-item v-if="userType == 1" label="发布社团">
<el-select
style="width: 100%"
v-model="noticesForm.teamId"
placeholder="请选择发布社团…"
>
<!-- 下拉选项 -->
<el-option
v-for="(item, index) in teams"
:key="index"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<!-- 表单输入项通知详情 -->
<el-form-item label="通知详情">
<el-input
type="textarea"
rows="5"
v-model="noticesForm.detail"
placeholder="请输入通知详情…"
autocomplete="off"
></el-input>
</el-form-item>
</el-form>
<!-- 对话框底部包含取消和确定按钮 -->
<div slot="footer" class="dialog-footer">
<!-- 取消按钮 -->
<el-button @click="showAddFlag = false" style="font-size: 18px">
</el-button>
<!-- 确定按钮 -->
<el-button
type="primary"
@click="addInfo()"
style="font-size: 18px"
>
</el-button>
</div>
</el-dialog>
</div>
</template>
<style>
</style>
<script>
// API
import {
getManTeamList,
getLoginUser,
getPageNotices,
addNotices,
delNotices,
getManTeamList,
getLoginUser,
getPageNotices,
addNotices,
delNotices,
} from "../../api";
export default {
data() {
return {
teams: [],
userType: "",
pageInfos: [],
pageIndex: 1,
pageSize: 10,
pageTotal: 0,
totalInfo: 0,
loading: true,
showAddFlag: false,
qryForm: {
token: this.$store.state.token,
teamName: "",
title: "",
},
noticesForm: {
id: "",
title: "",
detail: "",
teamId: null,
},
};
//
data() {
return {
//
teams: [],
//
userType: "",
//
pageInfos: [],
//
pageIndex: 1,
//
pageSize: 10,
//
pageTotal: 0,
//
totalInfo: 0,
//
loading: true,
//
showAddFlag: false,
//
qryForm: {
token: this.$store.state.token,
teamName: "",
title: "",
},
//
noticesForm: {
id: "",
title: "",
detail: "",
teamId: null,
},
};
},
//
methods: {
//
getPageInfo(pageIndex, pageSize) {
getPageNotices(pageIndex, pageSize, this.qryForm.token).then(
(resp) => {
//
this.pageInfos = resp.data.data;
//
this.pageIndex = resp.data.pageIndex;
//
this.pageSize = resp.data.pageSize;
//
this.pageTotal = resp.data.pageTotal;
//
this.totalInfo = resp.data.count;
//
this.loading = false;
}
);
},
methods: {
getPageInfo(pageIndex, pageSize) {
getPageNotices(pageIndex, pageSize, this.qryForm.token).then(
(resp) => {
this.pageInfos = resp.data.data;
this.pageIndex = resp.data.pageIndex;
this.pageSize = resp.data.pageSize;
this.pageTotal = resp.data.pageTotal;
this.totalInfo = resp.data.count;
this.loading = false;
}
);
},
getPageLikeInfo() {
getPageNotices(
1,
this.pageSize,
this.qryForm.token,
this.qryForm.title,
this.qryForm.teamName
).then((resp) => {
this.pageInfos = resp.data.data;
this.pageIndex = resp.data.pageIndex;
this.pageSize = resp.data.pageSize;
this.totalInfo = resp.data.count;
this.pageTotal = resp.data.pageTotal;
this.loading = false;
});
},
handleSizeChange(pageSize) {
this.getPageInfo(
this.pageIndex,
pageSize,
this.qryForm.token,
this.qryForm.title,
this.qryForm.teamName
);
},
handleCurrentChange(pageIndex) {
this.getPageInfo(
pageIndex,
this.pageSize,
this.qryForm.token,
this.qryForm.title,
this.qryForm.teamName
);
},
initForm() {
this.noticesForm = {
id: "",
title: "",
detail: "",
teamId: null,
};
},
showAddWin() {
this.initForm();
this.showAddFlag = true;
},
addInfo() {
addNotices(this.noticesForm).then((resp) => {
this.$message({
message: resp.msg,
type: "success",
});
this.getPageInfo(1, this.pageSize, this.qryForm.token);
this.showAddFlag = false;
});
},
delInfo(id) {
this.$confirm("即将删除相关信息, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
delNotices(id).then((resp) => {
this.$message({
message: resp.msg,
type: "success",
});
this.getPageInfo(1, this.pageSize);
});
});
},
//
getPageLikeInfo() {
getPageNotices(
1,
this.pageSize,
this.qryForm.token,
this.qryForm.title,
this.qryForm.teamName
).then((resp) => {
//
this.pageInfos = resp.data.data;
//
this.pageIndex = resp.data.pageIndex;
//
this.pageSize = resp.data.pageSize;
//
this.totalInfo = resp.data.count;
//
this.pageTotal = resp.data.pageTotal;
//
this.loading = false;
});
},
//
handleSizeChange(pageSize) {
this.getPageInfo(
this.pageIndex,
pageSize,
this.qryForm.token,
this.qryForm.title,
this.qryForm.teamName
);
},
//
handleCurrentChange(pageIndex) {
this.getPageInfo(
pageIndex,
this.pageSize,
this.qryForm.token,
this.qryForm.title,
this.qryForm.teamName
);
},
mounted() {
//
initForm() {
this.noticesForm = {
id: "",
title: "",
detail: "",
teamId: null,
};
},
//
showAddWin() {
this.initForm();
this.showAddFlag = true;
},
//
addInfo() {
addNotices(this.noticesForm).then((resp) => {
this.$message({
message: resp.msg,
type: "success",
});
this.getPageInfo(1, this.pageSize, this.qryForm.token);
getLoginUser(this.$store.state.token).then((resp) => {
this.userType = resp.data.type;
this.showAddFlag = false;
});
},
//
delInfo(id) {
this.$confirm("即将删除相关信息, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
delNotices(id).then((resp) => {
this.$message({
message: resp.msg,
type: "success",
});
getManTeamList(resp.data.id).then((resp) => {
this.teams = resp.data;
});
this.getPageInfo(1, this.pageSize);
});
});
},
},
//
mounted() {
//
this.getPageInfo(1, this.pageSize, this.qryForm.token);
//
getLoginUser(this.$store.state.token).then((resp) => {
//
this.userType = resp.data.type;
//
getManTeamList(resp.data.id).then((resp) => {
this.teams = resp.data;
});
});
},
};
</script>

@ -1,375 +1,461 @@
<template>
<div class="fater-body-show">
<el-card shadow="never">
<div
class="el-card-header"
slot="header"
style="font-size: 26px"
<!-- 整个页面的最外层容器设置类名用于样式控制 -->
<div class="fater-body-show">
<!-- 使用Element UI的el-card组件设置阴影效果为"never"即无阴影 -->
<el-card shadow="never">
<!-- el-card组件的头部内容设置样式和显示文本包含一个图标及"信息查询"文字通过slot="header"指定为头部插槽内容 -->
<div
class="el-card-header"
slot="header"
style="font-size: 26px"
>
<i class="iconfont icon-r-find" style="font-size: 26px"></i>
信息查询
</div>
<!-- el-card组件的主体内容部分放置查询表单 -->
<div>
<!-- 使用Element UI的el-form组件设置为行内表单形式并绑定名为"qryForm"的模型数据 -->
<el-form :inline="true" :model="qryForm">
<!-- el-form-item作为表单每一项的容器这里是输入团队名称的输入框项 -->
<el-form-item>
<!-- 使用Element UI的el-input组件双向绑定"qryForm"模型中的"teamName"字段用于输入团队名称设置占位提示文字及关闭自动完成功能 -->
<el-input
v-model="qryForm.teamName"
placeholder="输入团队名称…"
autocomplete="off"
></el-input>
</el-form-item>
<!-- 另一个el-form-item是输入成员姓名的输入框项双向绑定"qryForm"模型中的"userName"字段 -->
<el-form-item>
<el-input
v-model="qryForm.userName"
placeholder="输入成员姓名…"
autocomplete="off"
></el-input>
</el-form-item>
<!-- el-form-item中放置一个按钮点击按钮触发"getPageLikeInfo"方法按钮样式设置了字体大小按钮文本为"搜索" -->
<el-form-item>
<el-button
type="primary"
style="font-size: 18px"
@click="getPageLikeInfo()"
>
<i class="iconfont icon-r-find" style="font-size: 26px"></i>
信息查询
</div>
<div>
<el-form :inline="true" :model="qryForm">
<el-form-item>
<el-input
v-model="qryForm.teamName"
placeholder="输入团队名称…"
autocomplete="off"
></el-input>
</el-form-item>
<el-form-item>
<el-input
v-model="qryForm.userName"
placeholder="输入成员姓名…"
autocomplete="off"
></el-input>
</el-form-item>
<el-form-item>
<el-button
type="primary"
style="font-size: 18px"
@click="getPageLikeInfo()"
>
搜索</el-button
>
</el-form-item>
</el-form>
</div>
</el-card>
搜索</el-button
>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card shadow="never">
<div v-if="userType == 1" slot="header">
<el-button
type="primary"
style="font-size: 18px"
@click="showAddWin()"
>
新增</el-button
>
</div>
<div>
<el-table
v-loading="loading"
element-loading-text="拼命加载中"
element-loading-spinner="el-icon-loading"
element-loading-background="rgba(124, 124, 124, 0.8)"
:data="pageInfos"
border
>
<el-table-column
align="center"
type="index"
></el-table-column>
<el-table-column
align="center"
prop="teamName"
label="社团名称"
></el-table-column>
<el-table-column
align="center"
prop="userName"
label="成员姓名"
></el-table-column>
<el-table-column
align="center"
prop="userGender"
label="成员性别"
></el-table-column>
<el-table-column
align="center"
prop="userPhone"
label="成员电话"
></el-table-column>
<el-table-column
align="center"
prop="createTime"
label="缴费时间"
></el-table-column>
<el-table-column
align="center"
prop="total"
label="缴纳费用(元)"
></el-table-column
>>
</el-table>
<el-pagination
v-if="pageTotal >= 0"
style="margin-top: 15px"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="pageIndex"
:page-sizes="[5, 10, 20, 50]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="totalInfo"
>
</el-pagination>
</div>
</el-card>
<!-- 另一个el-card组件同样无阴影效果 -->
<el-card shadow="never">
<!-- 根据"userType"的值决定是否显示此div内容可能用于根据用户类型展示不同的头部操作按钮 -->
<div v-if="userType == 1" slot="header">
<!-- 一个主要按钮点击触发"showAddWin"方法样式设置了字体大小按钮文本为"新增" -->
<el-button
type="primary"
style="font-size: 18px"
@click="showAddWin()"
>
新增</el-button
>
</div>
<!-- el-card的主体内容部分放置了表格和分页组件 -->
<div>
<!-- 使用Element UI的el-table组件展示数据通过"v-loading"指令控制加载状态设置加载时的文本图标及背景样式等绑定名为"pageInfos"的数据作为表格数据源设置边框 -->
<el-table
v-loading="loading"
element-loading-text="拼命加载中"
element-loading-spinner="el-icon-loading"
element-loading-background="rgba(124, 124, 124, 0.8)"
:data="pageInfos"
border
>
<!-- el-table-column定义表格的列此列用于显示序号文本居中对齐 -->
<el-table-column
align="center"
type="index"
></el-table-column>
<!-- 定义一列绑定"teamName"属性作为数据来源列标题为"社团名称"文本居中对齐 -->
<el-table-column
align="center"
prop="teamName"
label="社团名称"
></el-table-column>
<!-- 定义展示"成员姓名"信息的列绑定"userName"属性 -->
<el-table-column
align="center"
prop="userName"
label="成员姓名"
></el-table-column>
<!-- 定义展示"成员性别"信息的列绑定"userGender"属性 -->
<el-table-column
align="center"
prop="userGender"
label="成员性别"
></el-table-column>
<!-- 定义展示"成员电话"信息的列绑定"userPhone"属性 -->
<el-table-column
align="center"
prop="userPhone"
label="成员电话"
></el-table-column>
<!-- 定义展示"缴费时间"信息的列绑定"createTime"属性 -->
<el-table-column
align="center"
prop="createTime"
label="缴费时间"
></el-table-column>
<!-- 定义展示"缴纳费用(元)"信息的列绑定"total"属性 -->
<el-table-column
align="center"
prop="total"
label="缴纳费用(元)"
></el-table-column>
</el-table>
<!-- 使用Element UI的el-pagination组件实现分页功能根据条件判断是否显示绑定页面大小改变当前页改变等事件处理方法设置当前页可选页面大小数组默认页面大小及布局等属性 -->
<el-pagination
v-if="pageTotal >= 0"
style="margin-top: 15px"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="pageIndex"
:page-sizes="[5, 10, 20, 50]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="totalInfo"
>
</el-pagination>
</div>
</el-card>
<el-dialog title="添加信息" width="600px" :visible.sync="showAddFlag">
<el-form label-width="90px" :model="payLogsForm">
<el-form-item label="缴纳费用(元)">
<el-input
v-model="payLogsForm.total"
onkeyup="value=value.replace(/[^\d.]/g,'')"
placeholder="请输入缴纳费用…"
autocomplete="off"
></el-input>
</el-form-item>
<el-form-item label="收费社团">
<el-select
style="width: 100%"
v-model="payLogsForm.teamId"
placeholder="请输入收费社团…"
>
<el-option
v-for="(item, index) in teams"
:key="index"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="缴费用户">
<el-input
v-model="payLogsForm.userId"
placeholder="请输入缴费用户ID…"
autocomplete="off"
></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="showAddFlag = false" style="font-size: 18px"
>
</el-button
>
<el-button
type="primary"
@click="addInfo()"
style="font-size: 18px"
>
</el-button
>
</div>
</el-dialog>
<!-- 使用Element UI的el-dialog组件创建一个对话框用于添加信息设置标题宽度及双向绑定显示隐藏状态 -->
<el-dialog title="添加信息" width="600px" :visible.sync="showAddFlag">
<!-- 在对话框内放置一个el-form表单设置标签宽度并绑定名为"payLogsForm"的模型数据 -->
<el-form label-width="90px" :model="payLogsForm">
<!-- 表单中的一项用于输入缴纳费用双向绑定"payLogsForm"模型中的"total"字段通过onkeyup属性设置输入时的校验只允许输入数字和小数点 -->
<el-form-item label="缴纳费用(元)">
<el-input
v-model="payLogsForm.total"
onkeyup="value=value.replace(/[^\d.]/g,'')"
placeholder="请输入缴纳费用…"
autocomplete="off"
></el-input>
</el-form-item>
<!-- 表单项用于选择收费社团使用el-select下拉选择框组件设置宽度并双向绑定"teamId"字段下拉选项通过循环生成 -->
<el-form-item label="收费社团">
<el-select
style="width: 100%"
v-model="payLogsForm.teamId"
placeholder="请输入收费社团…"
>
<el-option
v-for="(item, index) in teams"
:key="index"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<!-- 表单项用于输入缴费用户ID双向绑定"payLogsForm"模型中的"userId"字段 -->
<el-form-item label="缴费用户">
<el-input
v-model="payLogsForm.userId"
placeholder="请输入缴费用户ID…"
autocomplete="off"
></el-input>
</el-form-item>
</el-form>
<!-- 对话框的底部按钮区域放置取消和确定两个按钮分别绑定关闭对话框和提交添加信息的方法设置字体大小 -->
<div slot="footer" class="dialog-footer">
<el-button @click="showAddFlag = false" style="font-size: 18px"
>
</el-button
>
<el-button
type="primary"
@click="addInfo()"
style="font-size: 18px"
>
</el-button
>
</div>
</el-dialog>
<el-dialog title="修改信息" width="600px" :visible.sync="showUpdFlag">
<el-form label-width="90px" :model="payLogsForm">
<el-form-item label="缴纳费用">
<el-input
v-model="payLogsForm.total"
type="number"
onkeyup="value=value.replace(/[^\d.]/g,'')"
placeholder="请输入缴纳费用…"
autocomplete="off"
></el-input>
</el-form-item>
<el-form-item label="收费社团">
<el-select
style="width: 100%"
v-model="payLogsForm.teamId"
placeholder="请输入收费社团…"
>
<el-option
v-for="(item, index) in teams"
:key="index"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="缴费用户">
<el-input
v-model="payLogsForm.userId"
placeholder="请输入缴费用户ID…"
autocomplete="off"
></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="showUpdFlag = false" style="font-size: 18px"
>
</el-button
>
<el-button
type="primary"
@click="updInfo()"
style="font-size: 18px"
>
</el-button
>
</div>
</el-dialog>
</div>
<!-- 使用Element UI的el-dialog组件创建另一个对话框用于修改信息设置标题宽度及双向绑定显示隐藏状态 -->
<el-dialog title="修改信息" width="600px" :visible.sync="showUpdFlag">
<!-- 在对话框内放置el-form表单设置标签宽度并绑定名为"payLogsForm"的模型数据 -->
<el-form label-width="90px" :model="payLogsForm">
<!-- 表单中的一项用于输入缴纳费用双向绑定"payLogsForm"模型中的"total"字段设置类型为"number"并通过onkeyup属性设置输入时的校验只允许输入数字和小数点后面添加"元"字作为提示 -->
<el-form-item label="缴纳费用">
<el-input
v-model="payLogsForm.total"
type="number"
onkeyup="value=value.replace(/[^\d.]/g,'')"
placeholder="请输入缴纳费用…"
autocomplete="off"
></el-input>
</el-form-item>
<!-- 表单项用于选择收费社团使用el-select下拉选择框组件设置宽度并双向绑定"teamId"字段下拉选项通过循环生成 -->
<el-form-item label="收费社团">
<el-select
style="width: 100%"
v-model="payLogsForm.teamId"
placeholder="请输入收费社团…"
>
<el-option
v-for="(item, index) in teams"
:key="index"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<!-- 表单项用于输入缴费用户ID双向绑定"payLogsForm"模型中的"userId"字段 -->
<el-form-item label="缴费用户">
<el-input
v-model="payLogsForm.userId"
placeholder="请输入缴费用户ID…"
autocomplete="off"
></el-input>
</el-form-item>
</el-form>
<!-- 对话框的底部按钮区域放置取消和确定两个按钮分别绑定关闭对话框和提交修改信息的方法设置字体大小 -->
<div slot="footer" class="dialog-footer">
<el-button @click="showUpdFlag = false" style="font-size: 18px"
>
</el-button
>
<el-button
type="primary"
@click="updInfo()"
style="font-size: 18px"
>
</el-button
>
</div>
</el-dialog>
</div>
</template>
<style>
</style>
<script>
// "../../api"API
import {
getAllTeamList,
getManTeamList,
getLoginUser,
getPagePayLogs,
addPayLogs,
updPayLogs,
delPayLogs,
getAllTeamList,
getManTeamList,
getLoginUser,
getPagePayLogs,
addPayLogs,
updPayLogs,
delPayLogs,
} from "../../api";
export default {
data() {
return {
teams: [],
userType: "",
pageInfos: [],
pageIndex: 1,
pageSize: 10,
pageTotal: 0,
totalInfo: 0,
loading: true,
showAddFlag: false,
showUpdFlag: false,
qryForm: {
token: this.$store.state.token,
teamName: "",
userName: "",
},
payLogsForm: {
id: "",
total: "",
teamId: "",
userId: "",
},
};
},
methods: {
getPageInfo(pageIndex, pageSize) {
getPagePayLogs(pageIndex, pageSize, this.qryForm.token).then(
(resp) => {
this.pageInfos = resp.data.data;
this.pageIndex = resp.data.pageIndex;
this.pageSize = resp.data.pageSize;
this.pageTotal = resp.data.pageTotal;
this.totalInfo = resp.data.count;
data() {
return {
//
teams: [],
//
userType: "",
//
pageInfos: [],
// 1
pageIndex: 1,
// 1010
pageSize: 10,
// 0
pageTotal: 0,
// 0
totalInfo: 0,
// truefalsetrue
loading: true,
// Vue":visible.sync"truefalsefalse
showAddFlag: false,
// "showAddFlag"false
showUpdFlag: false,
// tokenVuexstore
qryForm: {
token: this.$store.state.token,
teamName: "",
userName: "",
},
// IDIDID
payLogsForm: {
id: "",
total: "",
teamId: "",
userId: "",
},
};
},
methods: {
//
// pageIndexpageSize
// getPagePayLogsAPIthenloadingfalse
getPageInfo(pageIndex, pageSize) {
getPagePayLogs(pageIndex, pageSize, this.qryForm.token).then(
(resp) => {
// pageInfos
this.pageInfos = resp.data.data;
//
this.pageIndex = resp.data.pageIndex;
//
this.pageSize = resp.data.pageSize;
//
this.pageTotal = resp.data.pageTotal;
//
this.totalInfo = resp.data.count;
this.loading = false;
}
);
},
getPageLikeInfo() {
getPagePayLogs(
1,
this.pageSize,
this.qryForm.token,
this.qryForm.teamName,
this.qryForm.userName
).then((resp) => {
this.pageInfos = resp.data.data;
this.pageIndex = resp.data.pageIndex;
this.pageSize = resp.data.pageSize;
this.totalInfo = resp.data.count;
this.pageTotal = resp.data.pageTotal;
this.loading = false;
});
},
handleSizeChange(pageSize) {
this.getPageInfo(
this.pageIndex,
pageSize,
this.qryForm.token,
this.qryForm.teamName,
this.qryForm.userName
);
},
handleCurrentChange(pageIndex) {
this.getPageInfo(
pageIndex,
this.pageSize,
this.qryForm.token,
this.qryForm.teamName,
this.qryForm.userName
);
},
initForm() {
this.payLogsForm = {
id: "",
total: "",
teamId: "",
userId: "",
};
},
showAddWin() {
this.initForm();
this.showAddFlag = true;
},
showUpdWin(row) {
this.payLogsForm = row;
this.showUpdFlag = true;
},
addInfo() {
addPayLogs(this.payLogsForm).then((resp) => {
this.$message({
message: resp.msg,
type: "success",
});
this.loading = false;
}
);
},
//
// getPagePayLogs1
// false
getPageLikeInfo() {
getPagePayLogs(
1,
this.pageSize,
this.qryForm.token,
this.qryForm.teamName,
this.qryForm.userName
).then((resp) => {
this.pageInfos = resp.data.data;
this.pageIndex = resp.data.pageIndex;
this.pageSize = resp.data.pageSize;
this.totalInfo = resp.data.count;
this.pageTotal = resp.data.pageTotal;
this.loading = false;
});
},
//
//
// getPageInfo
handleSizeChange(pageSize) {
this.getPageInfo(
this.pageIndex,
pageSize,
this.qryForm.token,
this.qryForm.teamName,
this.qryForm.userName
);
},
//
//
// getPageInfo
handleCurrentChange(pageIndex) {
this.getPageInfo(
pageIndex,
this.pageSize,
this.qryForm.token,
this.qryForm.teamName,
this.qryForm.userName
);
},
// "payLogsForm"
// payLogsForm
initForm() {
this.payLogsForm = {
id: "",
total: "",
teamId: "",
userId: "",
};
},
//
// initFormshowAddFlagtrueVue使
showAddWin() {
this.initForm();
this.showAddFlag = true;
},
//
// rowpayLogsForm便showUpdFlagtrue使
showUpdWin(row) {
this.payLogsForm = row;
this.showUpdFlag = true;
},
//
// addPayLogspayLogsFormthen
// 1. 使this.$messageresp.msg"success"
// 2. getPageInfo使
// 3. showAddFlagfalse
addInfo() {
addPayLogs(this.payLogsForm).then((resp) => {
this.$message({
message: resp.msg,
type: "success",
});
this.getPageInfo(1, this.pageSize, this.qryForm.token);
this.getPageInfo(1, this.pageSize, this.qryForm.token);
this.showAddFlag = false;
});
},
updInfo() {
updPayLogs(this.payLogsForm).then((resp) => {
this.$message({
message: resp.msg,
type: "success",
});
this.showAddFlag = false;
});
},
//
// updPayLogspayLogsForm
// 1. 使this.$message"success"
// 2. getPageInfo使
// 3. showUpdFlagfalse
updInfo() {
updPayLogs(this.payLogsForm).then((resp) => {
this.$message({
message: resp.msg,
type: "success",
});
this.getPageInfo(1, this.pageSize, this.qryForm.token);
this.getPageInfo(1, this.pageSize, this.qryForm.token);
this.showUpdFlag = false;
});
},
delInfo(id) {
this.$confirm("即将删除相关信息, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
delPayLogs(id).then((resp) => {
this.$message({
message: resp.msg,
type: "success",
});
this.showUpdFlag = false;
});
},
//
// 使this.$confirm"warning"
// thendelPayLogsID
// 1. 使this.$message"success"
// 2. getPageInfo
delInfo(id) {
this.$confirm("即将删除相关信息, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
delPayLogs(id).then((resp) => {
this.$message({
message: resp.msg,
type: "success",
});
this.getPageInfo(1, this.pageSize);
});
});
},
this.getPageInfo(1, this.pageSize);
});
});
},
mounted() {
this.getPageInfo(1, this.pageSize, this.qryForm.token);
},
// mountedDOM
//
// 1. getPageInfotoken
// 2. getLoginUsertokenthen
// - userType
// - 1getManTeamListIDteams1getAllTeamListteamsteams
mounted() {
this.getPageInfo(1, this.pageSize, this.qryForm.token);
getLoginUser(this.$store.state.token).then((resp) => {
this.userType = resp.data.type;
getLoginUser(this.$store.state.token).then((resp) => {
this.userType = resp.data.type;
if (resp.data.type == 1) {
getManTeamList(resp.data.id).then((resp) => {
this.teams = resp.data;
});
} else {
getAllTeamList().then((resp) => {
this.teams = resp.data;
});
}
if (resp.data.type == 1) {
getManTeamList(resp.data.id).then((resp) => {
this.teams = resp.data;
});
},
} else {
getAllTeamList().then((resp) => {
this.teams = resp.data;
});
}
});
},
};
</script>
Loading…
Cancel
Save