Compare commits

..

No commits in common. 'develop_idea' and 'master' have entirely different histories.

@ -7,14 +7,12 @@
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="AssociationManagerApi" />
<module name="AssociationManagerApi - idea" />
</profile>
</annotationProcessing>
</component>
<component name="JavacSettings">
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
<module name="AssociationManagerApi" options="-parameters" />
<module name="AssociationManagerApi - idea" options="-parameters" />
</option>
</component>
</project>

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">//
<set>
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
</set>
</option>
</component>
</project>

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../../.." vcs="Git" />
</component>
</project>

@ -1,18 +1,26 @@
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;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.rabbiter.association.entity.Users;
//等导入实体类和工具类。
import com.rabbiter.association.handle.CacheHandle;
import com.rabbiter.association.utils.IDUtils;
import com.rabbiter.association.msg.R;
@ -21,33 +29,32 @@ import com.rabbiter.association.msg.PageData;
import com.rabbiter.association.entity.Activities;
import com.rabbiter.association.service.ActivitiesService;
/**
*
*
*/
@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的路径。
@ResponseBody
public R getInfo(String id) {
@ -57,12 +64,12 @@ public class ActivitiesController extends BaseController {
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("登录信息不存在,请重新登录");
@ -87,8 +94,8 @@ public class ActivitiesController extends BaseController {
return R.successData(page);
}
}
@PostMapping("/add")
//根据用户类型user.getType()不同分别调用activitiesService.getPageAll普通情况或activitiesService.getPageByUserId特定用户类型来进行分页查询活动信息最后返回包含分页数据的成功响应。
@PostMapping("/add")//处理/add路径的POST请求。
@ResponseBody
public R addInfo(Activities activities) {
@ -100,8 +107,8 @@ public class ActivitiesController extends BaseController {
return R.success();
}
@PostMapping("/upd")
//为传入的Activities对象设置id通过IDUtils.makeIDByCurrent()然后使用activitiesService.add(activities)添加活动信息,最后返回成功响应。
@PostMapping("/upd")//处理/upd路径的POST请求。
@ResponseBody
public R updInfo(Activities activities) {
@ -111,8 +118,8 @@ public class ActivitiesController extends BaseController {
return R.success();
}
@PostMapping("/del")
//通过activitiesService.update(activities)修改活动信息,然后返回成功响应。
@PostMapping("/del")//处理/del路径的POST请求。
@ResponseBody
public R delInfo(String id) {
@ -124,4 +131,5 @@ public class ActivitiesController extends BaseController {
return R.success();
}
}
}
//先通过activitiesService.getOne(id)获取要删除的活动对象,然后使用`activitiesService.delete

@ -1,163 +1,133 @@
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,189 +1,138 @@
package com.rabbiter.association.controller;
import com.rabbiter.association.service.PayLogsService;
// 导入缴费记录服务类
import com.rabbiter.association.service.UsersService;
// 导入用户服务类
import org.slf4j.Logger;
// 导入日志记录接口
import org.slf4j.LoggerFactory;
// 导入日志记录工厂类
import org.springframework.beans.factory.annotation.Autowired;
// 导入自动注入注解
import org.springframework.stereotype.Controller;
// 导入控制器注解
import org.springframework.util.ObjectUtils;
// 导入对象工具类
import org.springframework.web.bind.annotation.GetMapping;
// 导入 GET 请求映射注解
import org.springframework.web.bind.annotation.PostMapping;
// 导入 POST 请求映射注解
import org.springframework.web.bind.annotation.RequestMapping;
// 导入请求映射注解
import org.springframework.web.bind.annotation.ResponseBody;
// 导入响应体注解
import com.rabbiter.association.entity.Users;
// 导入用户实体类
import com.rabbiter.association.handle.CacheHandle;
// 导入缓存处理类
import com.rabbiter.association.utils.DateUtils;
// 导入日期工具类
import com.rabbiter.association.utils.IDUtils;
// 导入 ID 生成工具类
import com.rabbiter.association.msg.R;
// 导入响应消息类
import com.rabbiter.association.msg.PageData;
// 导入分页数据类
import com.rabbiter.association.entity.PayLogs;
// 导入缴费记录实体类
/**
*
*
*
*/
@Controller // 声明该类为控制器
@RequestMapping("/payLogs") // 定义请求路径前缀为 /payLogs
@Controller
@RequestMapping("/payLogs")
public class PayLogsController extends BaseController {
// 定义 PayLogsController 类,继承自 BaseController
protected static final Logger Log = LoggerFactory.getLogger(PayLogsController.class);
// 创建日志记录器
@Autowired // 自动注入 CacheHandle 实例
@Autowired
private CacheHandle cacheHandle;
@Autowired // 自动注入 UsersService 实例
@Autowired
private UsersService usersService;
@Autowired // 自动注入 PayLogsService 实例
@Autowired
private PayLogsService payLogsService;
@RequestMapping("") // 处理根路径请求
@RequestMapping("")
public String index() {
// 定义 index 方法
return "pages/PayLogs";
// 返回视图名称,渲染缴费记录页面
}
@GetMapping("/info") // 处理 GET 请求,路径为 /info
@ResponseBody // 返回 JSON 格式的响应
@GetMapping("/info")
@ResponseBody
public R getInfo(String id) {
// 定义获取缴费记录信息的方法,接收 ID 参数
Log.info("查找指定缴费记录ID{}", id);
// 记录查找缴费记录的日志
PayLogs payLogs = payLogsService.getOne(id);
// 根据 ID 获取缴费记录
return R.successData(payLogs);
// 返回成功响应,包含缴费记录数据
}
@GetMapping("/page") // 处理 GET 请求,路径为 /page
@ResponseBody // 返回 JSON 格式的响应
@GetMapping("/page")
@ResponseBody
public R getPageInfos(Long pageIndex, Long pageSize,
// 定义获取分页信息的方法,接收页码和每页大小
String token, String teamName, String userName) {
Users user = usersService.getOne(cacheHandle.getUserInfoCache(token));
// 从缓存中获取用户信息
if(ObjectUtils.isEmpty(user)) {
// 检查用户是否存在
return R.error("登录信息不存在,请重新登录");
// 返回错误响应
}
if (user.getType() == 0) {
// 如果用户类型为 0普通用户
Log.info("分页查看全部缴费记录,当前页码:{}"
+ "每页数据量:{}, 模糊查询,团队名称:{},用户姓名:{}", pageIndex,
pageSize, teamName, userName); // 记录日志
pageSize, teamName, userName);
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); // 记录日志
pageSize, teamName, userName);
PageData page = payLogsService.getManPageInfo(pageIndex, pageSize, user.getId(), teamName, userName); // 获取团队管理员的分页数据
PageData page = payLogsService.getManPageInfo(pageIndex, pageSize, user.getId(), teamName, userName);
return R.successData(page);
// 返回成功响应,包含分页数据
} else { // 其他用户类型
} else {
Log.info("分页用户相关缴费记录,当前页码:{}"
+ "每页数据量:{}, 模糊查询,团队名称:{},用户姓名:{}", pageIndex,
pageSize, teamName, userName); // 记录日志
pageSize, teamName, userName);
PageData page = payLogsService.getPageInfo(pageIndex, pageSize, user.getId(), teamName, null);
// 获取用户相关的分页数据
return R.successData(page); // 返回成功响应,包含分页数据
return R.successData(page);
}
}
@PostMapping("/add") // 处理 POST 请求,路径为 /add
@ResponseBody // 返回 JSON 格式的响应
public R addInfo(PayLogs payLogs) {
// 定义添加缴费记录的方法,接收 PayLogs 对象
@PostMapping("/add")
@ResponseBody
public R addInfo( PayLogs payLogs) {
payLogs.setId(IDUtils.makeIDByCurrent());
// 生成并设置缴费记录 ID
payLogs.setCreateTime(DateUtils.getNowDate());
// 设置当前时间为创建时间
Log.info("添加缴费记录,传入参数:{}", payLogs);
// 记录添加缴费记录的日志
payLogsService.add(payLogs);
// 调用服务层方法添加缴费记录
return R.success();
// 返回成功响应
}
@PostMapping("/upd") // 处理 POST 请求,路径为 /upd
@ResponseBody // 返回 JSON 格式的响应
@PostMapping("/upd")
@ResponseBody
public R updInfo(PayLogs payLogs) {
// 定义更新缴费记录的方法,接收 PayLogs 对象
Log.info("修改缴费记录,传入参数:{}", payLogs);
// 记录修改缴费记录的日志
payLogsService.update(payLogs);
// 调用服务层方法更新缴费记录
return R.success();
// 返回成功响应
}
@PostMapping("/del") // 处理 POST 请求,路径为 /del
@ResponseBody // 返回 JSON 格式的响应
@PostMapping("/del")
@ResponseBody
public R delInfo(String id) {
// 定义删除缴费记录的方法,接收 ID 参数
Log.info("删除缴费记录, ID:{}", id);
// 记录删除缴费记录的日志
PayLogs payLogs = payLogsService.getOne(id);
// 根据 ID 获取缴费记录
payLogsService.delete(payLogs);
// 调用服务层方法删除缴费记录
return R.success();
// 返回成功响应
}
}

@ -1,12 +1,9 @@
// 定义包名和导入所需的类
package com.rabbiter.association.controller;
// 导入日志记录类
import com.rabbiter.association.service.TeamTypesService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
// 导入Spring框架的注解用于依赖注入和定义控制器
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
@ -14,139 +11,110 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
// 导入工具类用于日期和ID生成
import com.rabbiter.association.utils.DateUtils;
import com.rabbiter.association.utils.IDUtils;
// 导入自定义的消息响应类和分页数据类
import com.rabbiter.association.msg.R;
import com.rabbiter.association.msg.PageData;
// 导入实体类,代表社团类型
import com.rabbiter.association.entity.TeamTypes;
// 导入Java的集合类用于存储社团类型的列表
import java.util.List;
/**
*
*
*/
// 使用@Controller注解定义这是一个Spring MVC控制器
@Controller
// 使用@RequestMapping注解定义类级别的请求映射路径
@RequestMapping("/teamTypes")
public class TeamTypesController extends BaseController {
// 使用LoggerFactory生成一个日志记录器用于记录日志信息
protected static final Logger Log = LoggerFactory.getLogger(TeamTypesController.class);
// 使用@Autowired注解自动注入TeamTypesService服务
@Autowired
private TeamTypesService teamTypesService;
// 定义一个处理GET请求的方法返回社团类型的首页视图
@RequestMapping("")
public String index() {
return "pages/TeamTypes";
}
// 定义一个处理GET请求的方法返回所有社团类型的信息
@GetMapping("/all")
@ResponseBody
public R getAll(){
// 记录查看全部社团类型信息的日志
Log.info("查看全部的社团类型信息");
// 调用服务层方法获取所有社团类型信息
List<TeamTypes> list = teamTypesService.getAll();
// 返回成功响应,包含社团类型列表
return R.successData(list);
}
// 定义一个处理GET请求的方法根据ID返回指定社团类型的信息
@GetMapping("/info")
@ResponseBody
public R getInfo(String id) {
// 记录查找指定社团类型的日志
Log.info("查找指定社团类型ID{}", id);
// 调用服务层方法根据ID获取社团类型信息
TeamTypes teamTypes = teamTypesService.getOne(id);
// 返回成功响应,包含指定社团类型信息
return R.successData(teamTypes);
}
// 定义一个处理GET请求的方法返回社团类型的分页信息
@GetMapping("/page")
@ResponseBody
public R getPageInfos(Long pageIndex, Long pageSize,
TeamTypes teamTypes) {
// 记录分页查找社团类型的日志
Log.info("分页查找社团类型,当前页码:{}"
+ "每页数据量:{}, 模糊查询,附加参数:{}", pageIndex,
pageSize, teamTypes);
// 调用服务层方法获取社团类型的分页信息
PageData page = teamTypesService.getPageInfo(pageIndex, pageSize, teamTypes);
// 返回成功响应,包含分页信息
return R.successData(page);
}
// 定义一个处理POST请求的方法添加新的社团类型信息
@PostMapping("/add")
@ResponseBody
public R addInfo(TeamTypes teamTypes) {
// 为新社团类型生成ID和创建时间
teamTypes.setId(IDUtils.makeIDByCurrent());
teamTypes.setCreateTime(DateUtils.getNowDate());
// 记录添加社团类型的日志
Log.info("添加社团类型,传入参数:{}", teamTypes);
// 调用服务层方法添加社团类型
teamTypesService.add(teamTypes);
// 返回成功响应
return R.success();
}
// 定义一个处理POST请求的方法更新指定的社团类型信息
@PostMapping("/upd")
@ResponseBody
public R updInfo(TeamTypes teamTypes) {
// 记录修改社团类型的日志
Log.info("修改社团类型,传入参数:{}", teamTypes);
// 调用服务层方法更新社团类型
teamTypesService.update(teamTypes);
// 返回成功响应
return R.success();
}
// 定义一个处理POST请求的方法删除指定的社团类型信息
@PostMapping("/del")
@ResponseBody
public R delInfo(String id) {
// 检查是否可以删除社团类型
if(teamTypesService.isRemove(id)){
// 记录删除社团类型的日志
Log.info("删除社团类型, ID:{}", id);
// 根据ID获取社团类型信息
TeamTypes teamTypes = teamTypesService.getOne(id);
// 调用服务层方法删除社团类型
teamTypesService.delete(teamTypes);
// 返回成功响应
return R.success();
}else{
// 如果存在关联社团,返回警告响应
return R.warn("存在关联社团,无法移除");
}
}

@ -1,215 +1,153 @@
package com.rabbiter.association.controller;
// 定义包名,表示该类属于 com.rabbiter.association.controller 包
import com.rabbiter.association.service.TeamsService;
// 导入社团服务类
import com.rabbiter.association.service.UsersService;
// 导入用户服务类
import org.slf4j.Logger;
// 导入日志记录接口
import org.slf4j.LoggerFactory;
// 导入日志记录工厂类
import org.springframework.beans.factory.annotation.Autowired;
// 导入自动注入注解
import org.springframework.stereotype.Controller;
// 导入控制器注解
import org.springframework.util.ObjectUtils;
// 导入对象工具类
import org.springframework.web.bind.annotation.GetMapping;
// 导入 GET 请求映射注解
import org.springframework.web.bind.annotation.PostMapping;
// 导入 POST 请求映射注解
import org.springframework.web.bind.annotation.RequestMapping;
// 导入请求映射注解
import org.springframework.web.bind.annotation.ResponseBody;
// 导入响应体注解
import com.rabbiter.association.entity.Users;
// 导入用户实体类
import com.rabbiter.association.handle.CacheHandle;
// 导入缓存处理类
import com.rabbiter.association.utils.DateUtils;
// 导入日期工具类
import com.rabbiter.association.utils.IDUtils;
// 导入 ID 生成工具类
import com.rabbiter.association.msg.R;
// 导入响应消息类
import com.rabbiter.association.msg.PageData;
// 导入分页数据类
import com.rabbiter.association.entity.Teams;
// 导入社团实体类
import java.util.List;
// 导入 List 接口
/**
*
*
*
*/
@Controller // 声明该类为控制器
@RequestMapping("/teams") // 定义请求路径前缀为 /teams
@Controller
@RequestMapping("/teams")
public class TeamsController extends BaseController {
// 定义 TeamsController 类,继承自 BaseController
protected static final Logger Log = LoggerFactory.getLogger(TeamsController.class);
// 创建日志记录器
@Autowired // 自动注入 CacheHandle 实例
@Autowired
private CacheHandle cacheHandle;
@Autowired // 自动注入 UsersService 实例
@Autowired
private UsersService usersService;
@Autowired // 自动注入 TeamsService 实例
@Autowired
private TeamsService teamsService;
@RequestMapping("") // 处理根路径请求
@RequestMapping("")
public String index() {
// 定义 index 方法
return "pages/Teams";
// 返回视图名称,渲染社团页面
}
@GetMapping("/info") // 处理 GET 请求,路径为 /info
@ResponseBody // 返回 JSON 格式的响应
@GetMapping("/info")
@ResponseBody
public R getInfo(String id) {
// 定义获取社团信息的方法,接收 ID 参数
Log.info("查找指定社团信息ID{}", id);
// 记录查找社团信息的日志
Teams teams = teamsService.getOne(id);
// 根据 ID 获取社团信息
return R.successData(teams);
// 返回成功响应,包含社团信息
}
@GetMapping("/all") // 处理 GET 请求,路径为 /all
@ResponseBody // 返回 JSON 格式的响应
public R getAll() {
// 定义获取所有社团信息的方法
@GetMapping("/all")
@ResponseBody
public R getAll(){
Log.info("获取全部的社团");
// 记录获取所有社团的日志
List<Teams> list = teamsService.getAll();
// 获取所有社团信息
return R.successData(list);
// 返回成功响应,包含社团列表
}
@GetMapping("/man") // 处理 GET 请求,路径为 /man
@ResponseBody // 返回 JSON 格式的响应
public R getListByManId(String manId) {
// 定义根据管理员 ID 获取社团列表的方法
@GetMapping("/man")
@ResponseBody
public R getListByManId(String manId){
Log.info("获取指定社团管理员相关的社团列表");
// 记录获取社团管理员相关社团的日志
List<Teams> list = teamsService.getListByManId(manId);
// 根据管理员 ID 获取社团列表
return R.successData(list);
// 返回成功响应,包含社团列表
}
@GetMapping("/page") // 处理 GET 请求,路径为 /page
@ResponseBody // 返回 JSON 格式的响应
public R getPageInfos(Long pageIndex, Long pageSize, // 定义获取分页信息的方法,接收页码和每页大小
String token, Teams teams) { // 还接收 token 和 Teams 对象
@GetMapping("/page")
@ResponseBody
public R getPageInfos(Long pageIndex, Long pageSize,
String token, Teams teams) {
Users user = usersService.getOne(cacheHandle.getUserInfoCache(token));
// 从缓存中获取用户信息
if(ObjectUtils.isEmpty(user)) {
// 检查用户是否存在
return R.error("登录信息不存在,请重新登录");
// 返回错误响应
}
if(user.getType() == 1) {
// 如果用户类型为 1社团管理员
if(user.getType() == 1){
teams.setManager(user.getId());
// 设置社团的管理员 ID
}
Log.info("分页查找社团信息,当前页码:{}"
+ "每页数据量:{}, 模糊查询,附加参数:{}", pageIndex,
pageSize, teams);
// 记录分页查找社团信息的日志
PageData page = teamsService.getPageInfo(pageIndex, pageSize, teams); // 获取分页数据
PageData page = teamsService.getPageInfo(pageIndex, pageSize, teams);
return R.successData(page);
// 返回成功响应,包含分页数据
}
@PostMapping("/add") // 处理 POST 请求,路径为 /add
@ResponseBody // 返回 JSON 格式的响应
@PostMapping("/add")
@ResponseBody
public R addInfo(Teams teams) {
// 定义添加社团信息的方法,接收 Teams 对象
teams.setId(IDUtils.makeIDByCurrent());
// 生成并设置社团 ID
teams.setCreateTime(DateUtils.getNowDate("yyyy-MM-dd"));
// 设置当前日期为创建时间
Log.info("添加社团信息,传入参数:{}", teams);
// 记录添加社团信息的日志
int count = teamsService.addTeams(teams);
// 调用服务层方法添加社团信息
if(count == 0) {
// 检查添加结果
return R.error("社团团长ID无效");
// 返回错误响应
}
return R.success();
// 返回成功响应
}
@PostMapping("/upd") // 处理 POST 请求,路径为 /upd
@ResponseBody // 返回 JSON 格式的响应
@PostMapping("/upd")
@ResponseBody
public R updInfo(Teams teams) {
// 定义更新社团信息的方法,接收 Teams 对象
Log.info("修改社团信息,传入参数:{}", teams);
// 记录修改社团信息的日志
int count = teamsService.updateTeams(teams);
// 调用服务层方法更新社团信息
if(count == 0) {
// 检查更新结果
return R.error("社团团长ID无效");
// 返回错误响应
}
return R.success();
// 返回成功响应
}
@PostMapping("/del") // 处理 POST 请求,路径为 /del
@ResponseBody // 返回 JSON 格式的响应
@PostMapping("/del")
@ResponseBody
public R delInfo(String id) {
// 定义删除社团信息的方法,接收 ID 参数
Log.info("删除社团信息, ID:{}", id);
// 记录删除社团信息的日志
Teams teams = teamsService.getOne(id);
// 根据 ID 获取社团信息
teamsService.delete(teams);
// 调用服务层方法删除社团信息
return R.success();
// 返回成功响应
}
}

@ -1,12 +1,9 @@
// 定义包名,指定控制器所在的包
package com.rabbiter.association.controller;
// 导入日志记录工具类,用于记录日志信息
import com.rabbiter.association.service.UsersService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
// 导入Spring框架的注解用于依赖注入和定义控制器
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
@ -14,127 +11,103 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
// 导入工具类用于日期和ID生成
import com.rabbiter.association.utils.DateUtils;
import com.rabbiter.association.utils.IDUtils;
// 导入自定义的消息响应类和分页数据类
import com.rabbiter.association.msg.R;
import com.rabbiter.association.msg.PageData;
// 导入实体类,代表系统用户
import com.rabbiter.association.entity.Users;
/**
*
*
*/
// 使用@Controller注解定义这是一个Spring MVC控制器
@Controller
// 使用@RequestMapping注解定义类级别的请求映射路径
@RequestMapping("/users")
public class UsersController extends BaseController {
// 使用LoggerFactory生成一个日志记录器用于记录日志信息
protected static final Logger Log = LoggerFactory.getLogger(UsersController.class);
// 使用@Autowired注解自动注入UsersService服务
@Autowired
private UsersService usersService;
// 定义一个处理GET请求的方法返回系统用户的首页视图
@RequestMapping("")
public String index() {
return "pages/Users";
}
// 定义一个处理GET请求的方法根据ID返回指定系统用户的信息
@GetMapping("/info")
@ResponseBody
public R getInfo(String id) {
// 记录查找指定系统用户的日志
Log.info("查找指定系统用户ID{}", id);
// 调用服务层方法根据ID获取系统用户信息
Users users = usersService.getOne(id);
// 返回成功响应,包含指定系统用户信息
return R.successData(users);
}
// 定义一个处理GET请求的方法返回系统用户的分页信息
@GetMapping("/page")
@ResponseBody
public R getPageInfos(Long pageIndex, Long pageSize, Users users) {
// 记录分页查找系统用户的日志
public R getPageInfos(Long pageIndex, Long pageSize,
Users users) {
Log.info("分页查找系统用户,当前页码:{}"
+ "每页数据量:{}, 模糊查询,附加参数:{}", pageIndex,
pageSize, users);
// 调用服务层方法获取系统用户的分页信息
PageData page = usersService.getPageInfo(pageIndex, pageSize, users);
// 返回成功响应,包含分页信息
return R.successData(page);
}
// 定义一个处理POST请求的方法添加新的系统用户信息
@PostMapping("/add")
@ResponseBody
public R addInfo(Users users) {
// 检查用户名是否已存在
if(usersService.getUserByUserName(users.getUserName()) == null){
// 为新系统用户生成ID和创建时间
users.setId(IDUtils.makeIDByCurrent());
users.setCreateTime(DateUtils.getNowDate());
// 记录添加系统用户的日志
Log.info("添加系统用户,传入参数:{}", users);
// 调用服务层方法添加系统用户
usersService.add(users);
// 返回成功响应
return R.success();
}else{
// 如果用户名已存在,返回警告响应
return R.warn("用户账号已存在,请重新输入");
}
}
// 定义一个处理POST请求的方法更新指定的系统用户信息
@PostMapping("/upd")
@ResponseBody
public R updInfo(Users users) {
// 记录修改系统用户的日志
Log.info("修改系统用户,传入参数:{}", users);
// 调用服务层方法更新系统用户
usersService.update(users);
// 返回成功响应
return R.success();
}
// 定义一个处理POST请求的方法删除指定的系统用户信息
@PostMapping("/del")
@ResponseBody
public R delInfo(String id) {
// 检查是否可以删除系统用户
if(usersService.isRemove(id)){
// 记录删除系统用户的日志
Log.info("删除系统用户, ID:{}", id);
// 根据ID获取系统用户信息
Users users = usersService.getOne(id);
// 调用服务层方法删除系统用户
usersService.delete(users);
// 返回成功响应
return R.success();
}else{
// 如果用户存在关联社团,返回警告响应
return R.warn("用户存在关联社团,无法移除");
}
}

@ -1,19 +1,17 @@
package com.rabbiter.association.dao;
// 引入Spring框架的Repository注解标识这是一个数据访问对象DAO
import org.springframework.stereotype.Repository;
// 引入MyBatis Plus的BaseMapper接口提供基础的CRUD操作
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
// 引入活动日志实体类
import com.rabbiter.association.entity.ActiveLogs;
/**
* 访
* MyBatis PlusBaseMapperCRUD
*
*
*/
// 使用@Repository注解标识该接口为Spring的一个Repository并给其指定一个唯一的bean名称
@Repository("activeLogsDao")
public interface ActiveLogsDao extends BaseMapper<ActiveLogs> {
// 该接口继承BaseMapper后已经包含了基本的CRUD操作无需额外定义方法
// 可以根据需要添加自定义的数据库操作方法
}
}

@ -1,125 +1,76 @@
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,53 +1,45 @@
package com.rabbiter.association.dao;
// 引入MyBatis Plus的分页插件
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
// 引入MyBatis的注解用于动态SQL
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
// 引入Spring的注解标识这是一个Repository
import org.springframework.stereotype.Repository;
// 引入MyBatis Plus的基础Mapper接口
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
// 引入应用日志实体类
import com.rabbiter.association.entity.ApplyLogs;
// 引入Java的Map接口用于存储键值对
import java.util.Map;
/**
* 访
* MyBatis PlusBaseMapperCRUD
*
*
*/
@Repository("applyLogsDao") // Spring容器中的唯一标识
@Repository("applyLogsDao")
public interface ApplyLogsDao extends BaseMapper<ApplyLogs> {
/**
*
* 使MyBatisSQL
*
* @param page
* @param userId ID
* @param teamName
* @param userName
* @return Map
*
* @param page
* @param userId ID
* @param teamName
* @param userName
* @return
*/
@Select("<script>" +
"SELECT " +
"al.id, al.status, al.create_time as createTime, al.team_id as teamId, al.user_id as userId, " +
"t.name as teamName, u.name as userName, u.gender as userGender, u.age as userAge, u.phone as userPhone " +
"FROM apply_logs al " +
"JOIN teams t ON al.team_id = t.id " +
"JOIN users u ON al.user_id = u.id " +
"al.id, al.status, al.create_time createTime, al.team_id teamId, al.user_id userId, " +
"t.name teamName, u.name userName, u.gender userGender, u.age userAge, u.phone userPhone " +
"FROM apply_logs al, teams t, users u " +
"<where> " +
"<if test='teamName != null and teamName.trim() != \"\" '>" +
"al.user_id = u.id AND al.team_id = t.id " +
"<if test='teamName != null and teamName.trim() != &quot;&quot; '>" +
"AND t.name LIKE CONCAT('%', #{teamName}, '%') " +
"</if>" +
"<if test='userName != null and userName.trim() != \"\" '>" +
"<if test='userName != null and userName.trim() != &quot;&quot; '>" +
"AND u.name LIKE CONCAT('%', #{userName}, '%') " +
"</if>" +
"<if test='userId != null and userId.trim() != \"\" '>" +
"<if test='userId != null and userId.trim() != &quot;&quot; '>" +
"AND al.user_id = #{userId} " +
"</if>" +
"</where>" +
@ -59,37 +51,34 @@ public interface ApplyLogsDao extends BaseMapper<ApplyLogs> {
@Param("userName") String userName);
/**
*
* qryPageInfoID
*
* @param page
* @param userId ID
* @param teamName
* @param userName
* @return Map
*
* @param page
* @param userId ID
* @param teamName
* @param userName
* @return
*/
@Select("<script>" +
"SELECT " +
"al.id, al.status, al.create_time as createTime, al.team_id as teamId, al.user_id as userId, " +
"t.name as teamName, u.name as userName, u.gender as userGender, u.age as userAge, u.phone as userPhone " +
"FROM apply_logs al " +
"JOIN teams t ON al.team_id = t.id " +
"JOIN users u ON al.user_id = u.id " +
"al.id, al.status, al.create_time createTime, al.team_id teamId, al.user_id userId, " +
"t.name teamName, u.name userName, u.gender userGender, u.age userAge, u.phone userPhone " +
"FROM apply_logs al, teams t, users u " +
"<where> " +
"<if test='teamName != null and teamName.trim() != \"\" '>" +
"al.user_id = u.id AND al.team_id = t.id " +
"<if test='teamName != null and teamName.trim() != &quot;&quot; '>" +
"AND t.name LIKE CONCAT('%', #{teamName}, '%') " +
"</if>" +
"<if test='userName != null and userName.trim() != \"\" '>" +
"<if test='userName != null and userName.trim() != &quot;&quot; '>" +
"AND u.name LIKE CONCAT('%', #{userName}, '%') " +
"</if>" +
"<if test='userId != null and userId.trim() != \"\" '>" +
"AND (al.user_id = #{userId} OR t.manager = #{userId}) " +
"<if test='userId != null and userId.trim() != &quot;&quot; '>" +
"AND (al.user_id = #{userId} OR t.manager = #{userId}) " +
"</if>" +
"</where>" +
"ORDER BY al.create_time DESC " +
"</script>")
public Page<Map<String, Object>> qryManPageInfo(Page<Map<String, Object>> page,
@Param("userId") String userId,
@Param("teamName") String teamName,
@Param("userName") String userName);
@Param("userId") String userId,
@Param("teamName") String teamName,
@Param("userName") String userName);
}

@ -1,23 +1,15 @@
package com.rabbiter.association.dao;
// 定义包名,表示该接口属于 com.rabbiter.association.dao 包
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
// 导入 MyBatis-Plus 的分页类
import org.apache.ibatis.annotations.Param;
// 导入 MyBatis 的参数注解
import org.apache.ibatis.annotations.Select;
// 导入 MyBatis 的选择注解
import org.springframework.stereotype.Repository;
// 导入 Spring 的仓库注解
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
// 导入 MyBatis-Plus 的基础映射器接口
import com.rabbiter.association.entity.Members;
// 导入成员实体类
import java.util.Map;
// 导入 Map 接口
/**
*
@ -49,12 +41,9 @@ public interface MembersDao extends BaseMapper<Members> {
"</where>" +
"ORDER BY m.create_time DESC" +
"</script>")
// 选择成员的 ID、创建时间、社团 ID 和用户 ID
// 选择社团名称、总人数、用户姓名、性别、年龄和电话
// 连接条件,确保成员的用户 ID 和社团 ID 匹配
public Page<Map<String, Object>> qryPageAll(Page<Map<String, Object>> page,
@Param("teamName") String teamName,
@Param("userName") String userName);
@Param("teamName") String teamName,
@Param("userName") String userName);
/**
* ID
@ -80,14 +69,8 @@ public interface MembersDao extends BaseMapper<Members> {
"</where>" +
"ORDER BY m.create_time DESC" +
"</script>")
// 选择成员的 ID、创建时间、社团 ID 和用户 ID
// 选择社团名称、总人数、用户姓名、性别、年龄和电话
// 连接条件,确保成员的用户 ID 和社团 ID 匹配
public Page<Map<String, Object>> qryPageByManId(Page<Map<String, Object>> page,
@Param("manId") String manId,
// 接收管理员 ID 参数
@Param("teamName") String teamName,
// 接收社团名称参数
@Param("userName") String userName);
// 接收用户姓名参数
}

@ -1,180 +1,115 @@
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,126 +1,76 @@
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接口用于处理键值对形式的数据可能在查询结果以键值对形式返回时使用
// 数据层处理接口
// 缴费记录
import java.util.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,21 +1,17 @@
package com.rabbiter.association.dao;
// 定义包名,表示该接口属于 com.rabbiter.association.dao 包
import org.springframework.stereotype.Repository;
// 导入 Spring 的仓库注解
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
// 导入 MyBatis-Plus 的基础映射器接口
import com.rabbiter.association.entity.Teams;
// 导入社团实体类
/**
*
*
*
*/
@Repository("teamsDao") // 声明该接口为 Spring 的仓库组件,并指定 bean 名称为 teamsDao
@Repository("teamsDao")
public interface TeamsDao extends BaseMapper<Teams> {
// 定义 TeamsDao 接口,继承自 BaseMapper提供基本的 CRUD 操作
// 该接口不需要额外的方法BaseMapper 已经提供了基本的 CRUD 操作
}

@ -1,119 +1,97 @@
package com.rabbiter.association.entity;
// 导入MyBatis Plus注解用于映射表和字段
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
// 导入Java.io.Serializable接口用于序列化
import java.io.Serializable;
/**
*
* 使MyBatis Plus
*
*
*/
@TableName(value = "active_logs") // 指定实体类映射的数据库表名
@TableName(value = "active_logs")
public class ActiveLogs implements Serializable {
private static final long serialVersionUID = 1L; // 用于序列化机制的版本控制
private static final long serialVersionUID = 1L;
/**
*
* ID
*/
@TableId(value = "id") // 指定实体类属性映射的表字段
@TableId(value = "id")
private String id;
/**
* create_time
/**
*
*/
@TableField(value = "create_time") // 指定实体类属性映射的表字段
@TableField(value = "create_time")
private String createTime;
/**
* active_id
/**
*
*/
@TableField(value = "active_id") // 指定实体类属性映射的表字段
@TableField(value = "active_id")
private String activeId;
/**
* user_id
/**
*
*/
@TableField(value = "user_id") // 指定实体类属性映射的表字段
@TableField(value = "user_id")
private String userId;
/**
*
* @return ID
*/
public String getId() {
public String getId(){
return id;
}
/**
*
* @param id ID
*/
public void setId(String id) {
public void setId(String id){
this.id = id;
}
/**
*
* @return
*/
public String getCreateTime() {
public String getCreateTime(){
return createTime;
}
/**
*
* @param createTime
*/
public void setCreateTime(String createTime) {
public void setCreateTime(String createTime){
this.createTime = createTime;
}
/**
*
* @return ID
*/
public String getActiveId() {
public String getActiveId(){
return activeId;
}
/**
*
* @param activeId ID
*/
public void setActiveId(String activeId) {
public void setActiveId(String activeId){
this.activeId = activeId;
}
/**
*
* @return ID
*/
public String getUserId() {
public String getUserId(){
return userId;
}
/**
*
* @param userId ID
*/
public void setUserId(String userId) {
public void setUserId(String userId){
this.userId = userId;
}
/**
* 便
* @return
*/
@Override
public String toString() {
return "ActiveLogs [id=" + id
return "ActiveLogs [id=" + id
+ ", createTime=" + createTime
+ ", activeId=" + activeId
+ ", userId=" + userId
+ "]";
}
}

@ -1,183 +1,161 @@
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接口用于标记这个类可以被序列化方便在网络传输或存储
//数据实体类
// 活动信息
import java.io.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;
}
// 定义一个名为setId的方法接受一个String类型的参数id
// 该方法用于设置id属性的值
public void setId(String id) {
public void setId(String id){
this.id = id;
}
// 定义一个名为getName的方法返回类型为String
// 该方法用于获取name属性的值
public String getName() {
public String getName(){
return name;
}
// 定义一个名为setName的方法接受一个String类型的参数name
// 该方法用于设置name属性的值
public void setName(String name) {
public void setName(String name){
this.name = name;
}
// 定义一个名为getComm的方法返回类型为String
// 该方法用于获取comm属性的值
public String getComm() {
public String getComm(){
return comm;
}
// 定义一个名为setComm的方法接受一个String类型的参数comm
// 该方法用于设置comm属性的值
public void setComm(String comm) {
public void setComm(String comm){
this.comm = comm;
}
// 定义一个名为getDetail的方法返回类型为String
// 该方法用于获取detail属性的值
public String getDetail() {
public String getDetail(){
return detail;
}
// 定义一个名为setDetail的方法接受一个String类型的参数detail
// 该方法用于设置detail属性的值
public void setDetail(String detail) {
public void setDetail(String detail){
this.detail = detail;
}
// 定义一个名为getAsk的方法返回类型为String
// 该方法用于获取ask属性的值
public String getAsk() {
public String getAsk(){
return ask;
}
// 定义一个名为setAsk的方法接受一个String类型的参数ask
// 该方法用于设置ask属性的值
public void setAsk(String ask) {
public void setAsk(String ask){
this.ask = ask;
}
// 定义一个名为getTotal的方法返回类型为Integer
// 该方法用于获取total属性的值
public Integer getTotal() {
public Integer getTotal(){
return total;
}
// 定义一个名为setTotal的方法接受一个Integer类型的参数total
// 该方法用于设置total属性的值
public void setTotal(Integer total) {
public void setTotal(Integer total){
this.total = total;
}
// 定义一个名为getActiveTime的方法返回类型为String
// 该方法用于获取activeTime属性的值
public String getActiveTime() {
public String getActiveTime(){
return activeTime;
}
// 定义一个名为setActiveTime的方法接受一个String类型的参数activeTime
// 该方法用于设置activeTime属性的值
public void setActiveTime(String activeTime) {
public void setActiveTime(String activeTime){
this.activeTime = activeTime;
}
// 定义一个名为getTeamId的方法返回类型为String
// 该方法用于获取teamId属性的值
public String getTeamId() {
public String getTeamId(){
return teamId;
}
// 定义一个名为setTeamId的方法接受一个String类型的参数teamId
// 该方法用于设置teamId属性的值
public void setTeamId(String 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
@ -187,4 +165,5 @@ public class Activities implements Serializable {
+ ", teamId=" + teamId
+ "]";
}
}

@ -1,146 +1,115 @@
package com.rabbiter.association.entity;
// 导入MyBatis Plus注解用于映射数据库表和字段
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
// 导入Serializable接口用于确保对象可以被序列化
import java.io.Serializable;
/**
*
* MyBatis Plus
*
*
*/
@TableName(value = "apply_logs") // 指定实体类映射的数据库表名
@TableName(value = "apply_logs")
public class ApplyLogs implements Serializable {
private static final long serialVersionUID = 1L; // 用于序列化的版本UID
private static final long serialVersionUID = 1L;
/**
*
* ID
*/
@TableId(value = "id") // 指定实体类属性映射的表字段
@TableId(value = "id")
private String id;
/**
* status
* 0-1-2-
/**
*
*/
@TableField(value = "status")
private Integer status;
/**
* create_time
*
/**
*
*/
@TableField(value = "create_time")
private String createTime;
/**
* IDteam_id
*
/**
*
*/
@TableField(value = "team_id")
private String teamId;
/**
* IDuser_id
*
/**
*
*/
@TableField(value = "user_id")
private String userId;
/**
*
* @return ID
*/
public String getId() {
public String getId(){
return id;
}
/**
*
* @param id ID
*/
public void setId(String id) {
public void setId(String id){
this.id = id;
}
/**
*
* @return
*/
public Integer getStatus() {
public Integer getStatus(){
return status;
}
/**
*
* @param status
*/
public void setStatus(Integer status) {
public void setStatus(Integer status){
this.status = status;
}
/**
*
* @return
*/
public String getCreateTime() {
public String getCreateTime(){
return createTime;
}
/**
*
* @param createTime
*/
public void setCreateTime(String createTime) {
public void setCreateTime(String createTime){
this.createTime = createTime;
}
/**
* ID
* @return ID
*/
public String getTeamId() {
public String getTeamId(){
return teamId;
}
/**
* ID
* @param teamId ID
*/
public void setTeamId(String teamId) {
public void setTeamId(String teamId){
this.teamId = teamId;
}
/**
* ID
* @return ID
*/
public String getUserId() {
public String getUserId(){
return userId;
}
/**
* ID
* @param userId ID
*/
public void setUserId(String userId) {
public void setUserId(String userId){
this.userId = userId;
}
/**
* 便
* @return
*/
@Override
public String toString() {
return "ApplyLogs [id=" + id
return "ApplyLogs [id=" + id
+ ", status=" + status
+ ", createTime=" + createTime
+ ", teamId=" + teamId
+ ", userId=" + userId
+ "]";
}
}

@ -1,111 +1,97 @@
package com.rabbiter.association.entity;
// 定义包名,表示该类属于 com.rabbiter.association.entity 包
import com.baomidou.mybatisplus.annotation.TableField;
// 导入 MyBatis-Plus 的表字段注解
import com.baomidou.mybatisplus.annotation.TableId;
// 导入 MyBatis-Plus 的表主键注解
import com.baomidou.mybatisplus.annotation.TableName;
// 导入 MyBatis-Plus 的表名注解
import java.io.Serializable;
// 导入可序列化接口
/**
*
*
*
*/
@TableName(value = "members") // 指定该类对应的数据库表名为 members
@TableName(value = "members")
public class Members implements Serializable {
// 定义 Members 类,实现 Serializable 接口以支持序列化
private static final long serialVersionUID = 1L;
// 定义序列化版本号
/**
* ID
*/
@TableId(value = "id") // 指定该字段为表的主键,映射到数据库中的 id 字段
@TableId(value = "id")
private String id;
// 定义成员的 ID
/**
/**
*
*/
@TableField(value = "create_time") // 指定该字段映射到数据库中的 create_time 字段
@TableField(value = "create_time")
private String createTime;
// 定义成员的入团时间
/**
/**
*
*/
@TableField(value = "team_id") // 指定该字段映射到数据库中的 team_id 字段
@TableField(value = "team_id")
private String teamId;
// 定义成员所属社团的 ID
/**
/**
*
*/
@TableField(value = "user_id") // 指定该字段映射到数据库中的 user_id 字段
@TableField(value = "user_id")
private String userId;
// 定义申请加入社团的用户 ID
// 获取成员 ID
public String getId() {
public String getId(){
return id;
// 返回成员 ID
}
// 设置成员 ID
public void setId(String id) {
public void setId(String id){
this.id = id;
// 设置成员 ID
}
// 获取入团时间
public String getCreateTime() {
public String getCreateTime(){
return createTime;
// 返回入团时间
}
// 设置入团时间
public void setCreateTime(String createTime) {
public void setCreateTime(String createTime){
this.createTime = createTime;
// 设置入团时间
}
// 获取社团 ID
public String getTeamId() {
public String getTeamId(){
return teamId;
// 返回社团 ID
}
// 设置社团 ID
public void setTeamId(String teamId) {
public void setTeamId(String teamId){
this.teamId = teamId;
// 设置社团 ID
}
// 获取用户 ID
public String getUserId() {
public String getUserId(){
return userId;
// 返回用户 ID
}
// 设置用户 ID
public void setUserId(String userId) {
public void setUserId(String userId){
this.userId = userId;
// 设置用户 ID
}
// 重写 toString 方法,返回成员信息的字符串表示
@Override
public String toString() {
return "Members [id=" + id
return "Members [id=" + id
+ ", createTime=" + createTime
+ ", teamId=" + teamId
+ ", userId=" + userId
+ "]";
// 返回包含成员 ID、入团时间、社团 ID 和用户 ID 的字符串
}
}

@ -1,122 +1,106 @@
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接口用于标记这个类可以被序列化方便在网络传输或存储
import java.io.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;
}
// 定义一个名为setId的方法接受一个String类型的参数id
// 该方法用于设置id属性的值
public void setId(String 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;
}
// 定义一个名为getDetail的方法返回类型为String
// 该方法用于获取detail属性的值
public String getDetail() {
public String getDetail(){
return detail;
}
// 定义一个名为setDetail的方法接受一个String类型的参数detail
// 该方法用于设置detail属性的值
public void setDetail(String 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;
}
// 定义一个名为getTeamId的方法返回类型为String
// 该方法用于获取teamId属性的值
public String getTeamId() {
public String getTeamId(){
return teamId;
}
// 定义一个名为setTeamId的方法接受一个String类型的参数teamId
// 该方法用于设置teamId属性的值
public void setTeamId(String teamId) {
public void setTeamId(String teamId){
this.teamId = teamId;
}
// 重写toString方法用于返回对象的字符串表示形式
// 在这个方法中,按照特定的格式将对象的各个属性组合成一个字符串
@Override
public String toString() {

@ -1,123 +1,106 @@
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接口用于标记这个类可以被序列化方便在网络传输或存储
import java.io.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;
// 定义一个名为getId的方法返回类型为String
// 该方法用于获取id属性的值
public String getId() {
public String getId(){
return id;
}
// 定义一个名为setId的方法接受一个String类型的参数id
// 该方法用于设置id属性的值
public void setId(String 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;
}
// 定义一个名为getTotal的方法返回类型为Integer
// 该方法用于获取total属性的值
public Integer getTotal() {
public Double getTotal(){
return total;
}
// 定义一个名为setTotal的方法接受一个Integer类型的参数total
// 该方法用于设置total属性的值
public void setTotal(Integer total) {
public void setTotal(Double total){
this.total = total;
}
// 定义一个名为getTeamId的方法返回类型为String
// 该方法用于获取teamId属性的值
public String getTeamId() {
public String getTeamId(){
return teamId;
}
// 定义一个名为setTeamId的方法接受一个String类型的参数teamId
// 该方法用于设置teamId属性的值
public void setTeamId(String 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,87 +1,79 @@
// 定义包名,指定实体类所在的包
package com.rabbiter.association.entity;
// 导入MyBatis Plus框架的注解用于配置表和字段的映射
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
// 导入Java的序列化接口用于定义可序列化的类
import java.io.Serializable;
/**
*
*
*/
// 使用@TableName注解指定该实体类对应的数据库表名
@TableName(value = "team_types")
// 定义实体类TeamTypes并实现Serializable接口使其可序列化
public class TeamTypes implements Serializable {
// 定义serialVersionUID用于序列化版本控制
private static final long serialVersionUID = 1L;
/**
* ID
*/
// 使用@TableId注解指定该字段为表的主键
@TableId(value = "id")
// 定义id属性用于存储记录的ID
private String id;
/**
/**
*
*/
// 使用@TableField注解指定该字段对应的数据库表字段名
@TableField(value = "name")
// 定义name属性用于存储社团类型的名称
private String name;
/**
/**
*
*/
// 使用@TableField注解指定该字段对应的数据库表字段名
@TableField(value = "create_time")
// 定义createTime属性用于存储记录的创建时间
private String createTime;
// 定义getId方法用于获取id属性的值
public String getId(){
return id;
}
// 定义setId方法用于设置id属性的值
public void setId(String id){
this.id = id;
}
// 定义getName方法用于获取name属性的值
public String getName(){
return name;
}
// 定义setName方法用于设置name属性的值
public void setName(String name){
this.name = name;
}
// 定义getCreateTime方法用于获取createTime属性的值
public String getCreateTime(){
return createTime;
}
// 定义setCreateTime方法用于设置createTime属性的值
public void setCreateTime(String createTime){
this.createTime = createTime;
}
// 重写toString方法用于返回实体类的字符串表示形式
@Override
public String toString() {
// 返回包含id、name和createTime属性值的字符串
return "TeamTypes [id=" + id
return "TeamTypes [id=" + id
+ ", name=" + name
+ ", createTime=" + createTime
+ "]";
}
}

@ -1,152 +1,133 @@
package com.rabbiter.association.entity;
// 定义包名,表示该类属于 com.rabbiter.association.entity 包
import com.baomidou.mybatisplus.annotation.TableField;
// 导入 MyBatis-Plus 的表字段注解
import com.baomidou.mybatisplus.annotation.TableId;
// 导入 MyBatis-Plus 的表主键注解
import com.baomidou.mybatisplus.annotation.TableName;
// 导入 MyBatis-Plus 的表名注解
import java.io.Serializable;
// 导入可序列化接口
/**
*
*
*
*/
@TableName(value = "teams") // 指定该类对应的数据库表名为 teams
@TableName(value = "teams")
public class Teams implements Serializable {
// 定义 Teams 类,实现 Serializable 接口以支持序列化
private static final long serialVersionUID = 1L;
// 定义序列化版本号
/**
* ID
*/
@TableId(value = "id")
// 指定该字段为表的主键,映射到数据库中的 id 字段
private String id;
// 定义社团的 ID
/**
/**
*
*/
@TableField(value = "name") // 指定该字段映射到数据库中的 name 字段
@TableField(value = "name")
private String name;
// 定义社团的名称
/**
/**
*
*/
@TableField(value = "create_time") // 指定该字段映射到数据库中的 create_time 字段
@TableField(value = "create_time")
private String createTime;
// 定义社团的建立时间
/**
/**
*
*/
@TableField(value = "total") // 指定该字段映射到数据库中的 total 字段
@TableField(value = "total")
private Integer total;
// 定义社团的总人数
/**
/**
*
*/
@TableField(value = "manager") // 指定该字段映射到数据库中的 manager 字段
@TableField(value = "manager")
private String manager;
// 定义社团的团长 ID
/**
/**
*
*/
@TableField(value = "type_id") // 指定该字段映射到数据库中的 type_id 字段
@TableField(value = "type_id")
private String typeId;
// 定义社团的类型 ID
// 获取社团 ID
public String getId() {
public String getId(){
return id;
// 返回社团 ID
}
// 设置社团 ID
public void setId(String id) {
public void setId(String id){
this.id = id;
// 设置社团 ID
}
// 获取社团名称
public String getName() {
public String getName(){
return name;
// 返回社团名称
}
// 设置社团名称
public void setName(String name) {
public void setName(String name){
this.name = name;
// 设置社团名称
}
// 获取建立时间
public String getCreateTime() {
public String getCreateTime(){
return createTime;
// 返回建立时间
}
// 设置建立时间
public void setCreateTime(String createTime) {
public void setCreateTime(String createTime){
this.createTime = createTime;
// 设置建立时间
}
// 获取社团人数
public Integer getTotal() {
public Integer getTotal(){
return total;
// 返回社团人数
}
// 设置社团人数
public void setTotal(Integer total) {
public void setTotal(Integer total){
this.total = total;
// 设置社团人数
}
// 获取社团团长
public String getManager() {
public String getManager(){
return manager;
// 返回社团团长 ID
}
// 设置社团团长
public void setManager(String manager) {
public void setManager(String manager){
this.manager = manager;
// 设置社团团长 ID
}
// 获取社团类型 ID
public String getTypeId() {
public String getTypeId(){
return typeId;
// 返回社团类型 ID
}
// 设置社团类型 ID
public void setTypeId(String typeId) {
public void setTypeId(String typeId){
this.typeId = typeId;
// 设置社团类型 ID
}
// 重写 toString 方法,返回社团信息的字符串表示
@Override
public String toString() {
return "Teams [id=" + id
return "Teams [id=" + id
+ ", name=" + name
+ ", createTime=" + createTime
+ ", total=" + total
+ ", manager=" + manager
+ ", typeId=" + typeId
+ "]";
// 返回包含社团 ID、名称、建立时间、人数、团长和类型 ID 的字符串
}
}

@ -1,230 +1,213 @@
// 定义包名,指定实体类所在的包
package com.rabbiter.association.entity;
// 导入MyBatis Plus框架的注解用于配置表和字段的映射
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
// 导入Java的序列化接口用于定义可序列化的类
import java.io.Serializable;
/**
*
*
*/
// 使用@TableName注解指定该实体类对应的数据库表名
@TableName(value = "users")
// 定义实体类Users并实现Serializable接口使其可序列化
public class Users implements Serializable {
// 定义serialVersionUID用于序列化版本控制
private static final long serialVersionUID = 1L;
/**
* ID
*/
// 使用@TableId注解指定该字段为表的主键
@TableId(value = "id")
// 定义id属性用于存储记录的ID
private String id;
/**
/**
*
*/
// 使用@TableField注解指定该字段对应的数据库表字段名
@TableField(value = "user_name")
// 定义userName属性用于存储用户的账号
private String userName;
/**
/**
*
*/
// 使用@TableField注解指定该字段对应的数据库表字段名
@TableField(value = "pass_word")
// 定义passWord属性用于存储用户的密码
private String passWord;
/**
/**
*
*/
// 使用@TableField注解指定该字段对应的数据库表字段名
@TableField(value = "name")
// 定义name属性用于存储用户的姓名
private String name;
/**
/**
*
*/
// 使用@TableField注解指定该字段对应的数据库表字段名
@TableField(value = "gender")
// 定义gender属性用于存储用户的性别
private String gender;
/**
/**
*
*/
// 使用@TableField注解指定该字段对应的数据库表字段名
@TableField(value = "age")
// 定义age属性用于存储用户的年龄
private Integer age;
/**
/**
*
*/
// 使用@TableField注解指定该字段对应的数据库表字段名
@TableField(value = "phone")
// 定义phone属性用于存储用户的联系电话
private String phone;
/**
/**
*
*/
// 使用@TableField注解指定该字段对应的数据库表字段名
@TableField(value = "address")
// 定义address属性用于存储用户的联系地址
private String address;
/**
/**
*
*/
// 使用@TableField注解指定该字段对应的数据库表字段名
@TableField(value = "status")
// 定义status属性用于存储用户的信息状态
private Integer status;
/**
/**
*
*/
// 使用@TableField注解指定该字段对应的数据库表字段名
@TableField(value = "create_time")
// 定义createTime属性用于存储记录的创建时间
private String createTime;
/**
/**
*
*/
// 使用@TableField注解指定该字段对应的数据库表字段名
@TableField(value = "type")
// 定义type属性用于存储用户的身份
private Integer type;
// 定义getId方法用于获取id属性的值
public String getId(){
return id;
}
// 定义setId方法用于设置id属性的值
public void setId(String id){
this.id = id;
}
// 定义getUserName方法用于获取userName属性的值
public String getUserName(){
return userName;
}
// 定义setUserName方法用于设置userName属性的值
public void setUserName(String userName){
this.userName = userName;
}
// 定义getPassWord方法用于获取passWord属性的值
public String getPassWord(){
return passWord;
}
// 定义setPassWord方法用于设置passWord属性的值
public void setPassWord(String passWord){
this.passWord = passWord;
}
// 定义getName方法用于获取name属性的值
public String getName(){
return name;
}
// 定义setName方法用于设置name属性的值
public void setName(String name){
this.name = name;
}
// 定义getGender方法用于获取gender属性的值
public String getGender(){
return gender;
}
// 定义setGender方法用于设置gender属性的值
public void setGender(String gender){
this.gender = gender;
}
// 定义getAge方法用于获取age属性的值
public Integer getAge(){
return age;
}
// 定义setAge方法用于设置age属性的值
public void setAge(Integer age){
this.age = age;
}
// 定义getPhone方法用于获取phone属性的值
public String getPhone(){
return phone;
}
// 定义setPhone方法用于设置phone属性的值
public void setPhone(String phone){
this.phone = phone;
}
// 定义getAddress方法用于获取address属性的值
public String getAddress(){
return address;
}
// 定义setAddress方法用于设置address属性的值
public void setAddress(String address){
this.address = address;
}
// 定义getStatus方法用于获取status属性的值
public Integer getStatus(){
return status;
}
// 定义setStatus方法用于设置status属性的值
public void setStatus(Integer status){
this.status = status;
}
// 定义getCreateTime方法用于获取createTime属性的值
public String getCreateTime(){
return createTime;
}
// 定义setCreateTime方法用于设置createTime属性的值
public void setCreateTime(String createTime){
this.createTime = createTime;
}
// 定义getType方法用于获取type属性的值
public Integer getType(){
return type;
}
// 定义setType方法用于设置type属性的值
public void setType(Integer type){
this.type = type;
}
// 重写toString方法用于返回实体类的字符串表示形式
@Override
public String toString() {
// 返回包含所有属性值的字符串
return "Users [id=" + id
return "Users [id=" + id
+ ", userName=" + userName
+ ", passWord=" + passWord
+ ", name=" + name
@ -237,4 +220,5 @@ public class Users implements Serializable {
+ ", type=" + type
+ "]";
}
}

@ -6,63 +6,61 @@ import org.springframework.cache.CacheManager;
import org.springframework.stereotype.Component;
/**
*
* <p>Spring@Component@Autowired使CacheManager</p>
*
*/
@Component("cacheHandle")
public class CacheHandle {
@Autowired
private CacheManager cacheManager; // 自动注入CacheManager用于操作缓存
private CacheManager cacheManager;
private final String USER_KEY = "users"; // 缓存名称为"users"
private final String USER_KEY = "users";
/**
*
* <p>CacheManager"users"</p>
*
* @return Cachenull
*
* @return
*/
public Cache getUserCache() {
public Cache getUserCache(){
Cache cache = cacheManager.getCache(USER_KEY);
return cache;
return cache;
}
/**
*
* <p>keytoken</p>
*
* @param key token
* @param val
*
* @param key token
* @param val
*/
public void addUserCache(String key, Object val) {
Cache cache = getUserCache(); // 获取用户缓存对象
cache.put(key, val); // 将用户信息存储到缓存
Cache cache = getUserCache();
cache.put(key, val);
}
/**
*
* <p>keytoken</p>
*
* @param key token
*
* @param key token
*/
public void removeUserCache(String key) {
Cache cache = getUserCache(); // 获取用户缓存对象
cache.evict(key); // 从缓存中移除指定key的用户信息
public void removeUserCache(String key){
Cache cache = getUserCache();
cache.evict(key);
}
/**
*
* <p>keytoken</p>
*
* @param key token
* @return null
*
* @param key token
* @return
*/
public String getUserInfoCache(String key) {
Cache cache = getUserCache(); // 获取用户缓存对象
public String getUserInfoCache(String key){
Cache cache = getUserCache();
String userId = cache.get(key, String.class);
return cache.get(key, String.class); // 从缓存中获取指定key的用户信息
return userId;
}
}
}

@ -6,49 +6,31 @@ import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
/**
*
* <p>使@ControllerAdvice</p>
*/
@ControllerAdvice
public class GlobalExceptionHandler {
/**
*
* <p>使@ExceptionHandlerException</p>
* <p>@ResponseBody</p>
*
* @param e
* @return HTTPResponseEntity
*/
@ExceptionHandler(value = Exception.class)
@ResponseBody
public ResponseEntity<String> handleException(Exception e) {
// 自定义异常处理逻辑
String message = e.getMessage(); // 获取异常消息
String message = e.getMessage();
if (message.contains("(using password: YES)")) {
// 处理包含特定文本的异常消息,避免敏感信息泄露
if (!message.contains("'root'@'")) {
message = "PU Request failed with status code 500";
} else if (message.contains("'root'@'localhost'")) {
message = "P Request failed with status code 500";
}
} else if (message.contains("Table") && message.contains("doesn't exist")) {
// 处理数据库表不存在的异常
} else if(message.contains("Table") && message.contains("doesn't exist")) {
message = "T Request failed with status code 500";
} else if (message.contains("Unknown database")) {
// 处理未知数据库的异常
message = "U Request failed with status code 500";
} else if (message.contains("edis")) {
// 处理Redis相关的异常
message = "R Request failed with status code 500";
} else if (message.contains("Failed to obtain JDBC Connection")) {
// 处理JDBC连接失败的异常
message = "C Request failed with status code 500";
} else if (message.contains("SQLSyntaxErrorException")) {
// 处理SQL语法错误的异常
message = "S Request failed with status code 500";
}
return new ResponseEntity<>(message, HttpStatus.INTERNAL_SERVER_ERROR); // 返回500错误和自定义消息
return new ResponseEntity<>(message, HttpStatus.INTERNAL_SERVER_ERROR);
}
}
}

@ -4,166 +4,88 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
*
* <p>
*
* </p>
*/
public class PageData {
/**
*
*/
// 当前页码
private Long pageIndex;
/**
*
*/
// 每页数据量
private Long pageSize;
/**
*
*
*/
// 查询的总页数
private Long pageTotal;
/**
*
*/
// 符合条件的总记录数
private Long count;
/**
*
*
*/
// 分页查询包含的结果集
private List<Map<String, Object>> data = new ArrayList<Map<String, Object>>();
/**
*
*
* @return
*/
public Long getPageIndex() {
return pageIndex;
}
/**
*
*
* @param pageIndex
*/
public void setPageIndex(Long pageIndex) {
this.pageIndex = pageIndex;
}
/**
*
*
* @return
*/
public Long getPageSize() {
return pageSize;
}
/**
*
*
* @param pageSize
*/
public void setPageSize(Long pageSize) {
this.pageSize = pageSize;
}
/**
*
*
* @return
*/
public Long getPageTotal() {
return pageTotal;
}
/**
*
*
* @param pageTotal
*/
public void setPageTotal(Long pageTotal) {
this.pageTotal = pageTotal;
}
/**
*
*
* @return
*/
public Long getCount() {
return count;
}
/**
*
*
* @param count
*/
public void setCount(long count) {
this.count = count;
}
/**
*
*
* @return
*/
public List<Map<String, Object>> getData() {
return data;
}
/**
*
*
* @param data
*/
public void setData(List<Map<String, Object>> data) {
this.data = data != null && !data.isEmpty() ? data : this.data;
this.data = data;
}
/**
*
*/
public PageData() {
super();
}
/**
*
*
* @param pageIndex
* @param pageSize
* @param count
* @param data
*/
public PageData(Long pageIndex, Long pageSize, Long count, List<Map<String, Object>> data) {
this.pageIndex = pageIndex;
this.pageSize = pageSize;
this.count = count;
this.data = (data != null && !data.isEmpty()) ? data : this.data;
if (count > 0) {
this.pageTotal = (count % pageSize) == 0 ? (count / pageSize) : (count / pageSize + 1);
} else {
this.data = (data != null && data.size() > 0) ? data : this.data;
if(count > 0){
this.pageTotal = (count % pageSize) == 0 ? (count / pageSize) : (count / pageSize + 1);
}else {
this.pageTotal = 0L;
}
}
/**
*
*
* @return
*/
@Override
public String toString() {
return "PageData [pageIndex=" + pageIndex + ", pageSize=" + pageSize + ", pageTotal=" + pageTotal + ", count=" + count + ", data=" + data + "]";
return "Page [pageIndex=" + pageIndex + ", pageSize=" + pageSize + ", pageTotal=" + pageTotal + ", count="
+ count + ", data=" + data + "]";
}
}
}

@ -3,52 +3,34 @@ package com.rabbiter.association.msg;
import java.util.HashMap;
/**
*
* <p>
* HashMap
* </p>
*
*/
public class R extends HashMap<String, Object> {
/**
*
*/
/** 处理成功,响应码 */
public static final Integer SUCCESS_CODE = 0;
/**
*
*/
/** 处理成功,默认响应消息 */
public static final String SUCCESS_MSG = "处理成功";
/**
*
*/
/** 操作预警,响应码 */
public static final Integer WARN_CODE = 1;
/**
*
*/
/** 操作预警,默认响应消息 */
public static final String WARN_MSG = "操作错误";
/**
*
*/
/** 操作异常,响应码 */
public static final Integer ERROR_CODE = 2;
/**
*
*/
/** 操作异常,默认响应消息 */
public static final String ERROR_MSG = "系统异常";
/**
*
* <p>
*
* </p>
*
* @return
*
* @return
*/
public static R success() {
public static R success(){
R r = new R();
r.put("code", SUCCESS_CODE);
r.put("msg", SUCCESS_MSG);
@ -56,16 +38,13 @@ public class R extends HashMap<String, Object> {
}
/**
*
* <p>
*
* </p>
*
* @param msg
* @param data
* @return
*
* @param msg
* @param data
* @return
*/
public static R success(String msg, Object data) {
public static R success(String msg, Object data){
R r = new R();
r.put("code", SUCCESS_CODE);
r.put("msg", msg);
@ -74,15 +53,12 @@ public class R extends HashMap<String, Object> {
}
/**
*
* <p>
*
* </p>
*
* @param msg
* @return
*
* @param msg
* @return
*/
public static R successMsg(String msg) {
public static R successMsg(String msg){
R r = new R();
r.put("code", SUCCESS_CODE);
r.put("msg", msg);
@ -90,15 +66,12 @@ public class R extends HashMap<String, Object> {
}
/**
*
* <p>
*
* </p>
*
* @param data
* @return
*
* @param data
* @return
*/
public static R successData(Object data) {
public static R successData(Object data){
R r = new R();
r.put("code", SUCCESS_CODE);
r.put("msg", SUCCESS_MSG);
@ -107,14 +80,11 @@ public class R extends HashMap<String, Object> {
}
/**
*
* <p>
*
* </p>
*
* @return
*
* @return
*/
public static R warn() {
public static R warn(){
R r = new R();
r.put("code", WARN_CODE);
r.put("msg", WARN_MSG);
@ -122,49 +92,43 @@ public class R extends HashMap<String, Object> {
}
/**
*
* <p>
*
* </p>
*
* @param msg
* @return
*
* @param msg
* @return
*/
public static R warn(String msg) {
public static R warn(String msg){
R r = new R();
r.put("code", WARN_CODE);
r.put("msg", msg);
return r;
}
/**
*
* <p>
*
* </p>
*
* @return
*
* @return
*/
public static R error() {
public static R error(){
R r = new R();
r.put("code", ERROR_CODE);
r.put("msg", ERROR_MSG);
return r;
}
/**
*
* <p>
*
* </p>
*
* @param msg
* @return
*
* @param msg
* @return
*/
public static R error(String msg) {
public static R error(String msg){
R r = new R();
r.put("code", ERROR_CODE);
r.put("msg", msg);
return r;
}
}
}

@ -1,31 +1,29 @@
package com.rabbiter.association.service;
import com.rabbiter.association.entity.ActiveLogs;
import java.util.List;
import java.util.Map;
/**
*
* <p>BaseServiceActiveLogs</p>
*
*
*/
public interface ActiveLogsService extends BaseService<ActiveLogs, String> {
/**
*
* <p></p>
*
* @param activeId ID
* @param userId ID
* @return truefalse
*
* @param activeId ID
* @param userId ID
* @return
*/
public Boolean isActive(String activeId, String userId);
/**
* ID
* <p>ID</p>
*
* ID
* @param activeId ID
* @return MapMap
* @return
*/
public List<Map<String, Object>> getListByActiveId(String activeId);
}

@ -1,129 +0,0 @@
package com.rabbiter.association.service;
// 导入MyBatis Plus的QueryWrapper用于构建查询条件
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
// 导入服务接口
// 导入Spring的注解用于声明服务和自动注入
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
// 导入Spring的注解用于声明事务
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
// 导入DAO接口
import com.rabbiter.association.dao.ActivitiesDao;
import com.rabbiter.association.dao.UsersDao;
import com.rabbiter.association.dao.ActiveLogsDao;
// 导入实体类
import com.rabbiter.association.entity.Activities;
import com.rabbiter.association.entity.Users;
import com.rabbiter.association.entity.ActiveLogs;
// 导入Java的集合类
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* ActiveLogsService
*/
@Service("activeLogsService") // 声明该类为activeLogsService的实现
public class ActiveLogsServiceImpl implements ActiveLogsService {
// 自动注入UsersDao
@Autowired
private UsersDao usersDao;
// 自动注入ActiveLogsDao
@Autowired
private ActiveLogsDao activeLogsDao;
// 自动注入ActivitiesDao
@Autowired
private ActivitiesDao activitiesDao;
/**
*
*
*/
@Override
@Transactional // 声明事务,确保操作的原子性
public void add(ActiveLogs activeLogs) {
Activities activitie = activitiesDao.selectById(activeLogs.getActiveId()); // 根据活动ID查询活动
activitie.setTotal(activitie.getTotal() + 1); // 增加活动报名人数
activitiesDao.updateById(activitie); // 更新活动信息
activeLogsDao.insert(activeLogs); // 插入报名记录
}
/**
*
*/
@Override
@Transactional // 声明事务
public void update(ActiveLogs activeLogs) {
activeLogsDao.updateById(activeLogs); // 更新报名记录
}
/**
*
*/
@Override
@Transactional // 声明事务
public void delete(ActiveLogs activeLogs) {
activeLogsDao.deleteById(activeLogs); // 根据ID删除报名记录
}
/**
*
* truefalse
*/
@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS) // 声明只读事务
public Boolean isActive(String activeId, String userId){
QueryWrapper<ActiveLogs> qw = new QueryWrapper<>(); // 创建查询条件构造器
qw.eq("active_id", activeId).eq("user_id", userId); // 添加查询条件
return activeLogsDao.selectCount(qw) <= 0; // 查询符合条件的记录数如果为0则未报名
}
/**
* ID
*/
@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS) // 声明只读事务
public ActiveLogs getOne(String id) {
return activeLogsDao.selectById(id); // 根据ID查询报名记录
}
/**
* ID
* Map
*/
@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS) // 声明只读事务
public List<Map<String, Object>> getListByActiveId(String activeId){
List<Map<String, Object>> resl = new ArrayList<>(); // 存储结果的列表
QueryWrapper<ActiveLogs> qw = new QueryWrapper<>(); // 创建查询条件构造器
qw.eq("active_id", activeId).orderByDesc("create_time"); // 添加查询条件并排序
List<ActiveLogs> activeLogs = activeLogsDao.selectList(qw); // 查询报名记录列表
for (ActiveLogs activeLog : activeLogs) {
Map<String, Object> temp = new HashMap<>(); // 存储单个报名记录的详细信息
temp.put("id", activeLog.getId());
temp.put("createTime", activeLog.getCreateTime());
temp.put("activeId", activeLog.getActiveId());
Users user = usersDao.selectById(activeLog.getUserId()); // 根据用户ID查询用户信息
temp.put("userId", activeLog.getUserId());
temp.put("userName", user.getName());
temp.put("userGender", user.getGender());
temp.put("userPhone", user.getPhone());
resl.add(temp); // 将单个报名记录的详细信息添加到结果列表
}
return resl; // 返回结果列表
}
}

@ -1,35 +1,34 @@
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类
// 业务层处理
// 活动信息
import 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,47 +1,42 @@
package com.rabbiter.association.service;
import com.rabbiter.association.msg.PageData;
import com.rabbiter.association.entity.ApplyLogs;
/**
*
* <p>BaseServiceApplyLogs</p>
*
*
*/
public interface ApplyLogsService extends BaseService<ApplyLogs, String> {
/**
*
* <p>IDID</p>
*
*
* @param userId ID
* @param teamId ID
* @return truefalse
* @return
*/
public Boolean isApply(String userId, String teamId);
/**
*
* <p>使</p>
*
*
* @param pageIndex
* @param pageSize
* @param userId
* @param teamName
* @param userName
* @return PageData
* @return
*/
public PageData getManPageInfo(Long pageIndex, Long pageSize, String userId, String teamName, String userName);
/**
*
* <p></p>
*
*
* @param pageIndex
* @param pageSize
* @param userId
* @param teamName
* @param userName
* @return PageData
* @return
*/
public PageData getPageInfo(Long pageIndex, Long pageSize, String userId, String teamName, String userName);
}

@ -1,48 +1,41 @@
package com.rabbiter.association.service;
// 定义包名,表示该接口属于 com.rabbiter.association.service 包
import com.rabbiter.association.msg.PageData;
// 导入分页数据类
import com.rabbiter.association.entity.Members;
// 导入成员实体类
/**
*
*
*
*/
public interface MembersService extends BaseService<Members, String> {
// 定义 MembersService 接口,继承自 BaseService提供成员信息的业务处理
/**
*
* @param userId ID
* @param teamId ID
* @return
* @return
*/
public Boolean isManager(String teamId, String userId);
// 定义方法,检查指定用户是否是指定团队的管理员
/**
*
*
* @param pageIndex
* @param pageSize
* @param teamName
* @param userName
* @return
*/
* @return
*/
public PageData getPageAll(Long pageIndex, Long pageSize, String teamName, String userName);
// 定义方法,分页查询所有成员信息
/**
*
*
* @param pageIndex
* @param pageSize
* @param manId ID
* @param teamName
* @param userName
* @return
* @return
*/
public PageData getPageByManId(Long pageIndex, Long pageSize, String manId, String teamName, String userName);
// 定义方法,分页查询指定管理员管理的成员信息
}

@ -1,56 +1,55 @@
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;
import com.rabbiter.association.entity.Notices;
// 业务层处理
// 通知记录
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,35 +1,34 @@
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类
// 业务层处理
// 缴费记录
import 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,50 +1,40 @@
package com.rabbiter.association.service;
// 定义包名,表示该接口属于 com.rabbiter.association.service 包
import com.rabbiter.association.msg.PageData;
// 导入分页数据类
import com.rabbiter.association.entity.Teams;
// 导入社团实体类
import java.util.List;
// 导入 List 接口
/**
*
*
*
*/
public interface TeamsService extends BaseService<Teams, String> {
// 定义 TeamsService 接口,继承自 BaseService提供社团信息的业务处理
/**
*
* @return
* @return
*/
public List<Teams> getAll();
// 定义方法,获取所有社团信息
/**
*
* @param manId
* @return
* @return
*/
public List<Teams> getListByManId(String manId);
// 定义方法,获取指定管理员管理的社团列表
/**
*
*
* @param pageIndex
* @param pageSize
* @param teams
* @return
*/
* @return
*/
public PageData getPageInfo(Long pageIndex, Long pageSize, Teams teams);
// 定义方法,分页查询社团信息,支持模糊查询条件
Integer addTeams(Teams teams);
// 定义方法,添加社团信息,返回操作结果
Integer updateTeams(Teams teams);
// 定义方法,更新社团信息,返回操作结果
}

@ -1,129 +1,107 @@
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);
}
// 转化分页查询的结果
//定义一个名为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,144 +1,121 @@
package com.rabbiter.association.service.impl;
// 导入MyBatis Plus的QueryWrapper用于构建查询条件
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
// 导入MyBatis Plus的分页插件
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
// 导入服务接口
// 导入Spring的注解用于声明服务和自动注入
import com.rabbiter.association.service.ApplyLogsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
// 导入Spring的注解用于声明事务
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
// 导入DAO接口
import com.rabbiter.association.dao.MembersDao;
import com.rabbiter.association.dao.TeamsDao;
import com.rabbiter.association.dao.ApplyLogsDao;
// 导入实体类
import com.rabbiter.association.entity.Members;
import com.rabbiter.association.entity.Teams;
import com.rabbiter.association.entity.ApplyLogs;
// 导入自定义的分页数据类
import com.rabbiter.association.msg.PageData;
// 导入工具类
import com.rabbiter.association.entity.ApplyLogs;
import com.rabbiter.association.dao.ApplyLogsDao;
import com.rabbiter.association.utils.DateUtils;
import com.rabbiter.association.utils.IDUtils;
import java.util.Map;
/**
* ApplyLogsService
*/
@Service("applyLogsService") // 声明该类为applyLogsService的实现
@Service("applyLogsService")
public class ApplyLogsServiceImpl implements ApplyLogsService {
// 自动注入MembersDao
@Autowired
private MembersDao membersDao;
// 自动注入ApplyLogsDao
@Autowired
private ApplyLogsDao applyLogsDao;
// 自动注入TeamsDao
@Autowired
private TeamsDao teamsDao;
/**
*
*/
@Override
@Transactional // 声明事务,确保操作的原子性
@Transactional
public void add(ApplyLogs applyLogs) {
applyLogsDao.insert(applyLogs); // 插入申请记录
applyLogsDao.insert(applyLogs);
}
/**
*
*
*/
@Override
@Transactional // 声明事务
@Transactional
public void update(ApplyLogs applyLogs) {
if(applyLogs.getStatus() != null && applyLogs.getStatus() == 1){ // 如果申请通过
Members member = new Members(); // 创建成员记录
member.setId(IDUtils.makeIDByCurrent()); // 生成成员ID
member.setCreateTime(DateUtils.getNowDate()); // 设置创建时间
member.setUserId(applyLogs.getUserId()); // 设置用户ID
member.setTeamId(applyLogs.getTeamId()); // 设置团队ID
membersDao.insert(member); // 插入成员记录
Teams teams = teamsDao.selectById(applyLogs.getTeamId()); // 根据ID查询团队
teams.setTotal(teams.getTotal() + 1); // 增加团队人数
teamsDao.updateById(teams); // 更新团队信息
if(applyLogs.getStatus() != null && applyLogs.getStatus() == 1){
Members member = new Members();
member.setId(IDUtils.makeIDByCurrent());
member.setCreateTime(DateUtils.getNowDate());
member.setUserId(applyLogs.getUserId());
member.setTeamId(applyLogs.getTeamId());
membersDao.insert(member);
Teams teams = teamsDao.selectById(applyLogs.getTeamId());
teams.setTotal(teams.getTotal() + 1);
teamsDao.updateById(teams);
}
applyLogsDao.updateById(applyLogs); // 更新申请记录
applyLogsDao.updateById(applyLogs);
}
/**
*
*/
@Override
@Transactional // 声明事务
@Transactional
public void delete(ApplyLogs applyLogs) {
applyLogsDao.deleteById(applyLogs); // 根据ID删除申请记录
applyLogsDao.deleteById(applyLogs);
}
/**
*
* truefalse
*/
@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS) // 声明只读事务
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
public Boolean isApply(String userId, String teamId){
QueryWrapper<ApplyLogs> qw = new QueryWrapper<>(); // 创建查询条件构造器
qw.eq("user_id", userId).eq("team_id", teamId).eq("status", 0); // 添加查询条件
return applyLogsDao.selectCount(qw) <= 0; // 查询符合条件的记录数如果为0则未申请
QueryWrapper<ApplyLogs> qw = new QueryWrapper<ApplyLogs>();
qw.eq("user_id", userId);
qw.eq("team_id", teamId);
qw.eq("status", 0);
return applyLogsDao.selectCount(qw) <= 0;
}
/**
* ID
*/
@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS) // 声明只读事务
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
public ApplyLogs getOne(String id) {
return applyLogsDao.selectById(id); // 根据ID查询申请记录
ApplyLogs applyLogs = applyLogsDao.selectById(id);
return applyLogs;
}
/**
*
*/
@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS) // 声明只读事务
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
public PageData getManPageInfo(Long pageIndex, Long pageSize, String userId, String teamName, String userName) {
Page<Map<String, Object>> page = applyLogsDao.qryManPageInfo(new Page<>(pageIndex, pageSize), userId, teamName, userName); // 分页查询
return parsePage(page); // 转换分页结果
Page<Map<String, Object>> page =
applyLogsDao.qryManPageInfo(new Page<Map<String, Object>>(pageIndex, pageSize), userId, teamName, userName);
return parsePage(page);
}
/**
*
*/
@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS) // 声明只读事务
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
public PageData getPageInfo(Long pageIndex, Long pageSize, String userId, String teamName, String userName) {
Page<Map<String, Object>> page = applyLogsDao.qryPageInfo(new Page<>(pageIndex, pageSize), userId, teamName, userName); // 分页查询
return parsePage(page); // 转换分页结果
Page<Map<String, Object>> page =
applyLogsDao.qryPageInfo(new Page<Map<String, Object>>(pageIndex, pageSize), userId, teamName, userName);
return parsePage(page);
}
/**
* MyBatis PlusPageData
*
*/
public PageData parsePage(Page<Map<String, Object>> p) {
PageData pageData = new PageData(p.getCurrent(), p.getSize(), p.getTotal(), p.getRecords()); // 创建PageData对象
return pageData; // 返回转换后的分页数据
PageData pageData = new PageData(p.getCurrent(), p.getSize(), p.getTotal(), p.getRecords());
return pageData;
}
}

@ -1,79 +1,57 @@
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
// 自动注入NoticesDao实例用于数据库操作相关的通知功能
private NoticesDao noticesDao;
private NoticesDao noticesDao;
@Autowired
// 自动注入TeamsDao实例用于与团队相关的数据库操作
private TeamsDao teamsDao;
@Autowired
private TeamsDao teamsDao;
@Override
@Transactional
// 定义一个事务,保证这个方法在一个事务环境中执行
public void add(Notices notices) {
// 调用noticesDao的insert方法将通知插入数据库
noticesDao.insert(notices);
public void add(Notices notices) {
noticesDao.insert(notices);
}
@Override
@Transactional
//定义一个事务,保证这个方法在一个事务环境中执行
public void update(Notices notices) {
// 调用noticesDao的updateById方法根据通知的id更新通知
public void update(Notices notices) {
noticesDao.updateById(notices);
}
@Override
@Transactional
// 定义一个事务,保证这个方法在一个事务环境中执行
public void delete(Notices notices) {
// 调用noticesDao的deleteById方法根据通知的id删除通知
public void delete(Notices notices) {
noticesDao.deleteById(notices);
}
@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
// 定义一个事务设置为只读且传播行为为SUPPORTS用于查询单个通知
public Notices getOne(String id) {
// 调用noticesDao的selectById方法根据id查询通知
Notices notices = noticesDao.selectById(id);
@ -82,9 +60,7 @@ public class NoticesServiceImpl implements NoticesService {
@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
// 定义一个事务设置为只读且传播行为为SUPPORTS用于查询系统通知
public List<NoticesgetSysNotices() {
// 调用noticesDao的qrySysNotices方法查询系统通知列表
public List<Notices> getSysNotices(){
List<Notices> list = noticesDao.qrySysNotices();
@ -93,9 +69,8 @@ public class NoticesServiceImpl implements NoticesService {
@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
// 定义一个事务设置为只读且传播行为为SUPPORTS用于查询指定人员的通知
public List<NoticesgetManNotices(String manId) {
// 调用noticesDao的qryManNotices方法查询指定人员id的通知列表
public List<Notices> getManNotices(String manId){
List<Notices> list = noticesDao.qryManNotices(manId);
return list;
@ -103,9 +78,8 @@ public class NoticesServiceImpl implements NoticesService {
@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
// 定义一个事务设置为只读且传播行为为SUPPORTS用于查询指定成员的通知
public List<NoticesgetMemNotices(String memId) {
// 调用noticesDao的qryMemNotices方法查询指定成员id的通知列表
public List<Notices> getMemNotices(String memId){
List<Notices> list = noticesDao.qryMemNotices(memId);
return list;
@ -113,9 +87,8 @@ public class NoticesServiceImpl implements NoticesService {
@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
// 定义一个事务设置为只读且传播行为为SUPPORTS用于分页查询所有通知
public PageData getPageAll(Long pageIndex, Long pageSize, String title, String teamName) {
// 调用noticesDao的qryPageAll方法进行分页查询传入页码、每页大小、标题和团队名称
public PageData getPageAll(Long pageIndex, Long pageSize, String title, String teamName){
Page<Map<String, Object>> page =
noticesDao.qryPageAll(new Page<Map<String, Object>>(pageIndex, pageSize), title, teamName);
@ -124,68 +97,55 @@ public class NoticesServiceImpl implements NoticesService {
@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
// 定义一个事务设置为只读且传播行为为SUPPORTS用于根据用户id分页查询通知
public PageData getPageById(Long pageIndex, Long pageSize, String userId, String title, String teamName) {
// 调用noticesDao的qryPageById方法进行分页查询传入页码、每页大小、用户id、标题和团队名称
public PageData getPageById(Long pageIndex, Long pageSize, String userId, String title, String teamName){
Page<Map<String, Object>> page =
noticesDao.qryPageById(new Page<Map<String, Object>>(pageIndex, pageSize), userId, title, teamName);
return parsePage(page);
}
// 查询列表结果转换
// @param notices
// @return
/**
*
* @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,107 +1,88 @@
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,127 +1,102 @@
// 定义包名,指定服务实现类所在的包
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;
// 导入服务接口
import com.rabbiter.association.service.TeamTypesService;
// 导入Spring的注解用于定义服务和自动注入
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
// 导入Spring事务注解
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
// 导入数据访问对象DAO
import com.rabbiter.association.dao.TeamsDao;
import com.rabbiter.association.entity.Teams;
import com.rabbiter.association.msg.PageData;
import com.rabbiter.association.entity.TeamTypes;
import com.rabbiter.association.dao.TeamTypesDao;
// 导入工具类
import com.rabbiter.association.utils.StringUtils;
// 导入Java的集合类
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
// 使用@Service注解定义这是一个Spring管理的服务
@Service("teamTypesService")
public class TeamTypesServiceImpl implements TeamTypesService {
// 使用@Qualifier和@Autowired注解自动注入TeamTypesDao
@Autowired
private TeamTypesDao teamTypesDao;
// 使用@Autowired注解自动注入TeamsDao
@Autowired
private TeamsDao teamsDao;
// 事务管理,添加社团类型信息
@Override
@Transactional
public void add(TeamTypes teamTypes) {
// 调用DAO层方法插入社团类型信息
teamTypesDao.insert(teamTypes);
}
// 事务管理,更新社团类型信息
@Override
@Transactional
public void update(TeamTypes teamTypes) {
// 调用DAO层方法更新社团类型信息
teamTypesDao.updateById(teamTypes);
}
// 事务管理,删除社团类型信息
@Override
@Transactional
public void delete(TeamTypes teamTypes) {
// 调用DAO层方法根据ID删除社团类型信息
teamTypesDao.deleteById(teamTypes);
}
// 事务管理,检查是否可以删除社团类型
@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
public Boolean isRemove(String typeId){
// 创建查询条件构造器
QueryWrapper<Teams> qw = new QueryWrapper<>();
// 条件类型ID等于传入的typeId
QueryWrapper<Teams> qw = new QueryWrapper<Teams>();
qw.eq("type_id", typeId);
// 调用DAO层方法查询关联的社团数量
return teamsDao.selectCount(qw) <= 0;
}
// 事务管理根据ID获取社团类型信息
@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
public TeamTypes getOne(String id) {
// 创建查询条件构造器,并按创建时间降序排列
QueryWrapper<TeamTypes> qw = new QueryWrapper<>();
QueryWrapper<TeamTypes> qw = new QueryWrapper<TeamTypes>();
qw.orderByDesc("create_time");
// 调用DAO层方法根据ID查询社团类型信息
TeamTypes teamTypes = teamTypesDao.selectById(id);
return teamTypes;
}
// 事务管理,获取所有社团类型信息
@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
public List<TeamTypes> getAll() {
// 调用DAO层方法查询所有社团类型信息
List<TeamTypes> list = teamTypesDao.selectList(null);
return list;
}
// 事务管理,分页查询社团类型信息
@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
public PageData getPageInfo(Long pageIndex, Long pageSize, TeamTypes teamTypes) {
// 创建查询条件构造器
QueryWrapper<TeamTypes> qw = new QueryWrapper<>();
// 如果社团类型名称不为空,则添加模糊查询条件
QueryWrapper<TeamTypes> qw = new QueryWrapper<TeamTypes>();
if (StringUtils.isNotNullOrEmpty(teamTypes.getName())) {
qw.like("name", teamTypes.getName());
}
// 按创建时间降序排列
qw.orderByDesc("create_time");
// 调用DAO层方法进行分页查询
Page<TeamTypes> page =
teamTypesDao.selectPage(new Page<>(pageIndex, pageSize), qw);
teamTypesDao.selectPage(new Page<TeamTypes>(pageIndex, pageSize), qw);
// 转换分页查询结果
return parsePage(page);
}
@ -129,21 +104,18 @@ public class TeamTypesServiceImpl implements TeamTypesService {
*
*/
public PageData parsePage(Page<TeamTypes> p) {
// 创建结果列表
List<Map<String, Object>> resl = new ArrayList<>();
// 遍历分页查询结果
List<Map<String, Object>> resl = new ArrayList<Map<String, Object>>();
for (TeamTypes teamTypes : p.getRecords()) {
// 创建临时Map存储单个社团类型的信息
Map<String, Object> temp = new HashMap<>();
Map<String, Object> temp = new HashMap<String, Object>();
temp.put("id", teamTypes.getId());
temp.put("name", teamTypes.getName());
temp.put("createTime", teamTypes.getCreateTime());
// 将临时Map添加到结果列表
resl.add(temp);
}
// 创建PageData对象封装分页信息和结果列表
PageData pageData = new PageData(p.getCurrent(), p.getSize(), p.getTotal(), resl);
return pageData;

@ -1,139 +1,114 @@
// 定义包名,指定服务实现类所在的包
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;
// 导入服务接口
import com.rabbiter.association.service.UsersService;
// 导入Spring的注解用于定义服务和自动注入
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
// 导入Spring事务注解
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
// 导入数据访问对象DAO
import com.rabbiter.association.dao.MembersDao;
import com.rabbiter.association.entity.Members;
import com.rabbiter.association.msg.PageData;
import com.rabbiter.association.entity.Users;
import com.rabbiter.association.dao.UsersDao;
// 导入工具类
import com.rabbiter.association.utils.StringUtils;
// 导入Java的集合类
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
// 使用@Service注解定义这是一个Spring管理的服务
@Service("usersService")
public class UsersServiceImpl implements UsersService {
// 使用@Autowired注解自动注入MembersDao
@Autowired
private MembersDao membersDao;
// 使用@Autowired注解自动注入UsersDao
@Autowired
private UsersDao usersDao;
// 事务管理,添加系统用户信息
@Override
@Transactional
public void add(Users users) {
// 调用DAO层方法插入系统用户信息
usersDao.insert(users);
}
// 事务管理,更新系统用户信息
@Override
@Transactional
public void update(Users users) {
// 调用DAO层方法更新系统用户信息
usersDao.updateById(users);
}
// 事务管理,删除系统用户信息
@Override
@Transactional
public void delete(Users users) {
// 调用DAO层方法根据ID删除系统用户信息
usersDao.deleteById(users);
}
// 事务管理,检查是否可以删除系统用户
@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
public Boolean isRemove(String userId){
// 创建查询条件构造器
QueryWrapper<Members> qw = new QueryWrapper<>();
// 条件用户ID等于传入的userId
QueryWrapper<Members> qw = new QueryWrapper<Members>();
qw.eq("user_id", userId);
// 调用DAO层方法查询关联的成员数量
Integer total = membersDao.selectCount(qw);
// 返回是否可以删除(没有关联的成员时可以删除)
return total <= 0;
}
// 事务管理根据ID获取系统用户信息
@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
public Users getOne(String id) {
// 调用DAO层方法根据ID查询系统用户信息
Users users = usersDao.selectById(id);
return users;
}
// 事务管理,根据用户名获取系统用户信息
@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
public Users getUserByUserName(String userName) {
// 创建查询条件构造器
QueryWrapper<Users> qw = new QueryWrapper<>();
// 条件用户名等于传入的userName
QueryWrapper<Users> qw = new QueryWrapper<Users>();
qw.eq("user_name", userName);
// 调用DAO层方法查询系统用户信息
Users user = usersDao.selectOne(qw);
return user;
}
// 事务管理,分页查询系统用户信息
@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
public PageData getPageInfo(Long pageIndex, Long pageSize, Users users) {
// 创建查询条件构造器
QueryWrapper<Users> qw = new QueryWrapper<>();
// 如果用户名不为空,则添加模糊查询条件
QueryWrapper<Users> qw = new QueryWrapper<Users>();
if (StringUtils.isNotNullOrEmpty(users.getUserName())) {
qw.like("user_name", users.getUserName());
}
// 如果姓名不为空,则添加模糊查询条件
if (StringUtils.isNotNullOrEmpty(users.getName())) {
qw.like("name", users.getName());
}
// 如果电话不为空,则添加模糊查询条件
if (StringUtils.isNotNullOrEmpty(users.getPhone())) {
qw.like("phone", users.getPhone());
}
// 按创建时间降序排列
qw.orderByDesc("create_time");
// 调用DAO层方法进行分页查询
Page<Users> page =
usersDao.selectPage(new Page<>(pageIndex, pageSize), qw);
usersDao.selectPage(new Page<Users>(pageIndex, pageSize), qw);
// 转换分页查询结果
return parsePage(page);
}
@ -141,13 +116,12 @@ public class UsersServiceImpl implements UsersService {
*
*/
public PageData parsePage(Page<Users> p) {
// 创建结果列表
List<Map<String, Object>> resl = new ArrayList<>();
// 遍历分页查询结果
List<Map<String, Object>> resl = new ArrayList<Map<String, Object>>();
for (Users users : p.getRecords()) {
// 创建临时Map存储单个系统用户的信息
Map<String, Object> temp = new HashMap<>();
Map<String, Object> temp = new HashMap<String, Object>();
temp.put("id", users.getId());
temp.put("userName", users.getUserName());
temp.put("passWord", users.getPassWord());
@ -159,11 +133,9 @@ public class UsersServiceImpl implements UsersService {
temp.put("status", users.getStatus());
temp.put("createTime", users.getCreateTime());
temp.put("type", users.getType());
// 将临时Map添加到结果列表
resl.add(temp);
}
// 创建PageData对象封装分页信息和结果列表
PageData pageData = new PageData(p.getCurrent(), p.getSize(), p.getTotal(), resl);
return pageData;

@ -1,5 +1,4 @@
package com.rabbiter.association.utils;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.pool.ExceptionSorter;
import org.mybatis.spring.annotation.MapperScan;
@ -11,95 +10,58 @@ import java.sql.SQLException;
import java.util.Properties;
/**
* Druid
* 使 Spring @Configuration Bean
* 使 @Bean Spring Bean
*/
* Description
* Author: rabbiter
* Date: 2020/2/26 23:39
**/
@Configuration
public class DataSourceConfiguration {
/**
* application.properties application.yml
*/
@Value("${spring.datasource.driver-class-name}")
private String jdbcDriver;
/**
* URL
*/
@Value("${spring.datasource.url}")
private String jdbcUrl;
/**
*
*/
@Value("${spring.datasource.username}")
private String jdbcUsername;
/**
*
*/
@Value("${spring.datasource.password}")
private String jdbcPassword;
/**
* Druid Bean
* 使 @Bean DruidDataSource Bean
*
* @return DruidDataSource
* @throws Exception
*/
@Bean(name = "dataSource")
@Bean(name="dataSource")
public DruidDataSource createDataSource() throws Exception {
DruidDataSource dataSource = new DruidDataSource();
dataSource.setDriverClassName(jdbcDriver); // 设置数据库驱动类名
dataSource.setUrl(jdbcUrl); // 设置数据库连接 URL
dataSource.setUsername(jdbcUsername); // 设置数据库用户名
dataSource.setPassword(jdbcPassword); // 设置数据库密码
dataSource.setDriverClassName(jdbcDriver);
dataSource.setUrl(jdbcUrl);
dataSource.setUsername(jdbcUsername);
dataSource.setPassword(jdbcPassword);
// 关闭连接后不自动提交事务
// 关闭连接后不自动commit
dataSource.setDefaultAutoCommit(false);
// 设置在获取连接失败后是否中断
// 设置连接异常处理
dataSource.setBreakAfterAcquireFailure(true);
// 将 SQLException 抛出,不进行包装
// 将SQLException抛出重要配置
dataSource.setFailFast(true);
dataSource.setConnectionErrorRetryAttempts(0); // 设置连接失败重试次数
// 置自定义的异常处理器
dataSource.setConnectionErrorRetryAttempts(0);
// 置自定义的异常处理器
dataSource.setExceptionSorter(new CustomExceptionSorter());
// 注释掉的代码用于关闭 Druid 内置的慢 SQL 统计和监控
// dataSource.setFilters("stat");
// 关闭Druid连接池内部的异常处理
// dataSource.setFilters("stat");
return dataSource;
}
/**
* SQLException
*/
class CustomExceptionSorter implements ExceptionSorter {
}
/**
* SQLException
* SQLException
*
* @param e SQLException
* @return true SQLException
*/
@Override
public boolean isExceptionFatal(SQLException e) {
e.printStackTrace(); // 打印异常堆栈信息
return true;
}
class CustomExceptionSorter implements ExceptionSorter {
@Override
public boolean isExceptionFatal(SQLException e) {
// 将所有异常视为致命异常,即抛出到上层
// 打印异常堆栈信息
e.printStackTrace();
return true;
}
/**
* Properties
* CustomExceptionSorter
*
* @param properties Properties
*/
@Override
public void configFromProperties(Properties properties) {
// 可以留空,因为 CustomExceptionSorter 没有需要配置的属性
}
@Override
public void configFromProperties(Properties properties) {
// 配置信息可以为空
}
}
}

@ -4,99 +4,97 @@ import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
*
*/
public class DateUtils {
/**
* -- ::
* yyyy-MM-dd HH:mm:ss
*/
public static final String DATETIME_DEFAULT_FORMAT = "yyyy-MM-dd HH:mm:ss";
/**
* ::
* HH:mm:ss
*/
public static final String TIME_DEFAULT_FORMAT = "HH:mm:ss";
/**
* --
* yyyy-MM-dd
*/
public static final String YYYY_MM_DD = "yyyy-MM-dd";
/**
* -- :
* yyyy-MM-dd HH:mm
*/
public static final String YYYY_MM_DD_HH_MM = "yyyy-MM-dd HH:mm";
/**
* SimpleDateFormat
*
* @param format
* @return SimpleDateFormat
*
* @param format
* @return
*/
public static SimpleDateFormat getDateFormat(String format) {
public static SimpleDateFormat getDateFormat(String format){
return new SimpleDateFormat(format);
}
/**
* Date
*
* @param date
* @param format
* @return
*
* @param date
* @param format
* @return
*/
public static String formatDateTime(Date date, String format) {
public static String formatDateTime(Date date, String format ){
return getDateFormat(format).format(date);
}
/**
* Date
*
* @param date
* @param format
* @return Date
* @throws ParseException ParseException
*
* @param date
* @param format
* @return
* @throws ParseException
*/
public static Date parseDate(String date, String format) throws ParseException {
return getDateFormat(format).parse(date);
}
/**
*
*
* @return
*
* @return
*/
public static long getCurrent() {
return System.currentTimeMillis();
}
/**
*
*
* @param format
* @return
* ()
* @param format
* @return
*/
public static String getNowDate(String format) {
public static String getNowDate(String format){
return formatDateTime(new Date(), format);
}
/**
*
* -- ::
*
* @return
* ()
* yyyy-MM-dd HH:mm:ss
* @return
*/
public static String getNowDate() {
public static String getNowDate(){
return formatDateTime(new Date(), DATETIME_DEFAULT_FORMAT);
}
/**
* ::
*
* @return ::
*
* HH:mm:ss
* @return
*/
public static String getNowTime() {
public static String getNowTime(){
return formatDateTime(new Date(), TIME_DEFAULT_FORMAT);
}
}

@ -3,37 +3,29 @@ package com.rabbiter.association.utils;
import java.util.UUID;
/**
* IDID
* ID
*/
public class IDUtils {
/**
* 使UUID32ID
* <p>UUIDUniversally Unique Identifier
* UUID32168-4-4-4-12
* ID32</p>
*
* @return 32UUID
* 使 UUID 32ID
* @return
*/
public static String makeIDByUUID() {
// 生成一个随机的UUID
String id = UUID.randomUUID().toString();
// 将UUID中的连字符去掉返回一个没有连字符的32位字符串
id = id.replaceAll("-", "");
String id = UUID.randomUUID().toString().replaceAll("-","");
return id;
}
/**
* 使13ID
* <p>ID
* ID13</p>
*
* @return 13
* 使ID, 13
* @return
*/
public static String makeIDByCurrent() {
// 调用DateUtils工具类的getCurrent()方法获取当前时间的毫秒值
Long mills = DateUtils.getCurrent();
// 将时间戳的Long值转换为String并返回
return mills.toString();
}
}
}

@ -4,94 +4,101 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
*
*
*/
public class StringUtils {
/**
* NULL
* NULL true false
*
/**
* NUll
* true NULL
* false NULL
* @param str
* @return true NULLfalse
* @return
*/
public static Boolean isNull(String str) {
if (str == null) {
public static Boolean isNull(String str){
if(str == null){
return true;
}
return false;
}
/**
* NULL
* NULL true false
*
* NUll
* true NULL
* false NULL
* @param str
* @return true NULLfalse
* @return
*/
public static Boolean isNotNull(String str) {
// 直接利用 isNull 方法的结果取反
public static Boolean isNotNull(String str){
Boolean flag = !isNull(str);
return flag;
}
/**
* NULL
* NULL true false
*
* NULL
* true NULL
* false NULL
* @param str
* @return true NULL false
* @return
*/
public static Boolean isNullOrEmpty(String str) {
// 先检查字符串是否为 NULL如果是则返回 true
if (str == null) {
public static Boolean isNullOrEmpty(String str){
if(str == null){
return true;
}
// 再检查字符串长度是否为 0如果是则返回 true
if (str.length() <= 0) {
if(str.length() <= 0){
return true;
}
return false;
}
/**
* NULL
* NULL true false
*
* @param str
* @return true NULL false
* NULL
* true NULL
* false NULL
* @param str
* @return
*/
public static Boolean isNotNullOrEmpty(String str) {
// 直接利用 isNullOrEmpty 方法的结果取反
public static Boolean isNotNullOrEmpty(String str){
Boolean flag = !isNullOrEmpty(str);
return flag;
}
/**
*
* false true
*
* @param str
* @param flag
* @return true false
*/
public static boolean isExit(String str, String flag) {
// 使用 indexOf 方法检查字符串中是否包含指定的字符或子字符串
if (str.indexOf(flag) > 0) {
return false;
}
return true;
}
*
* @param str
* @param flag
* @return
*/
public static boolean isExit(String str, String flag) {
if(str.indexOf(flag) > 0) {
return false;
}
return true;
}
/**
*
* null 0
*
* @param str
* @return null 0
*/
public static int length(String str) {
// 使用三元运算符简化代码
return str == null ? 0 : str.length();
}
}
*
* null 0
* @param str
* @return
*/
public static int length(String str) {
return str == null ? 0 : str.length();
}
}

@ -1,8 +0,0 @@
# 默认忽略的文件
/shelf/
/workspace.xml
# 基于编辑器的 HTTP 客户端请求
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -1,6 +0,0 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
</profile>
</component>

@ -1,9 +0,0 @@
<component name="libraryTable">
<library name="node_modules">
<CLASSES>
<root url="jar://$PROJECT_DIR$/node_modules.zip!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_23" default="true" project-jdk-name="23" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/AssociationManagerVue.iml" filepath="$PROJECT_DIR$/.idea/AssociationManagerVue.iml" />
</modules>
</component>
</project>

@ -1,25 +1,15 @@
// 导入Vue核心库
import Vue from 'vue'
// 导入Vue Router插件
import VueRouter from 'vue-router'
// 使用Vue.use方法安装Vue Router插件使其成为Vue的插件
Vue.use(VueRouter)
// 创建一个新的VueRouter实例并导出
export default new VueRouter({
// 定义路由配置
routes: [
// 定义一个路由对象
{
// 路由的路径,当访问根目录'/'时匹配此路由
path: '/',
// 给路由命名,方便在代码中引用
name: 'login',
// 指定路由匹配到时加载的组件使用require动态导入login.vue文件并取其default属性
component: require("../views/login.vue").default
}
// 这里可以继续添加更多的路由对象
]
});
});

@ -1,50 +1,37 @@
// 导入Vue核心库
import Vue from 'vue'
// 导入Vuex库
import Vuex from 'vuex'
// 使用Vue.use方法安装Vuex插件使其成为Vue的插件
Vue.use(Vuex)
// 创建一个新的Vuex.Store实例并导出
export default new Vuex.Store({
// 定义state它是Vuex的状态管理对象用于存储应用的状态
state: {
token: null, // 用于存储用户token
menus: null, // 用于存储用户菜单数据
user: null, // 用于存储用户信息
state:{
token: null,
menus: null,
user: null,
},
// 定义getters它是Vuex的计算属性用于对state进行计算处理
getters: {
// 获取token的getter
getToken: state => {
return state.token
},
// 获取menus的getter
getMenus: state => {
return state.menus
},
},
// 定义mutations它是同步函数用于修改state中的状态
mutations: {
// 设置token的mutation
setToken: (state, newToken) => {
setToken: (state, newToken) =>{
state.token = newToken;
},
// 清除token的mutation
clearToken: (state) => {
clearToken: (state) =>{
state.token = null;
},
// 设置menus的mutation
setMenus: (state, menus) => {
setMenus: (state, menus) =>{
state.menus = menus;
},
// 清除menus的mutation
clearMenus: (state) => {
clearMenus: (state) =>{
state.menus = null;
},
}
})
// 导入initialize模块通常用于初始化Vuex状态或者进行一些配置
import '@/utils/initialize'
import '@/utils/initialize'

@ -1,49 +1,43 @@
/*
* @Description: 该文件定义了一个axios实例用于管理HTTP请求
* @Description:
* @Author: Rabbiter
* @Date: 2022-06-11 13:41:22
*/
// 导入axios库用于发起HTTP请求
import axios from 'axios'
// 导入qs库用于处理URL-encoded格式的数据
import qs from 'qs'
// 从element-ui导入Message组件用于显示操作反馈信息
import {
Message
} from 'element-ui'
// 设置axios默认请求头指定发送的数据格式为application/x-www-form-urlencoded
axios.defaults.headers['Content-Type'] = 'application/x-www-form-urlencoded';
// 创建axios的实例用于配置特定的请求设置
const service = axios.create({
// withCredentials: true, // 这行代码被注释掉了,如果需要携带凭证可以取消注释
baseURL: 'http://localhost:9211/association', // 设置请求的基础URL
timeout: 15000 // 设置请求超时时间为15000毫秒15秒
// withCredentials: true,
baseURL: 'http://localhost:9211/association',
timeout: 15000 // 请求超时时间
})
// 添加请求拦截器,用于在请求发送前对请求进行处理
service.interceptors.request.use(config => {
// 如果请求方法是post则将请求数据转换为URL-encoded格式
if(config.method === "post"){
config.data = qs.stringify(config.data, { indices: false });
}
// 返回处理后的config
return config;
}, error => {
// 如果请求拦截器出现错误返回一个rejected的Promise
Promise.reject(error)
})
// 添加响应拦截器,用于在响应返回后对响应进行处理
// respone拦截器
service.interceptors.response.use(
resp => {
// 如果响应数据的code不等于2则直接返回响应数据
if (resp.data.code != 2) {
return resp.data;
} else {
// 如果响应数据的code等于2则显示错误信息并返回一个rejected的Promise
Message({
message: resp.data.msg,
type: 'error',
@ -53,9 +47,7 @@ service.interceptors.response.use(
}
},
error => {
// 打印错误信息
console.log(error);
// 如果错误响应或错误响应数据未定义,则显示错误信息
if (error.response == undefined ||
error.response.data == undefined) {
Message({
@ -65,7 +57,6 @@ service.interceptors.response.use(
duration: 5000,
});
} else {
// 否则显示错误响应数据
Message({
message: error.response.data,
type: 'error',
@ -73,10 +64,8 @@ service.interceptors.response.use(
duration: 5000,
});
}
// 返回一个rejected的Promise
return Promise.reject(error);
}
)
// 导出service实例供其他模块使用
export default service
export default service

@ -1,66 +1,50 @@
<!--
* @Description: 该组件作为应用的主布局包含导航栏菜单栏和主要内容区域
* @Description:
* @Author: Rabbiter
* @Date: 2022-06-11 13:41:22
-->
<template>
<!-- 使用Element UI的容器组件来布局页面 -->
<el-container>
<!-- 引入Nav组件作为导航栏 -->
<Nav></Nav>
<!-- 再次使用el-container来布局菜单栏和主要内容区域 -->
<el-container>
<!-- 引入Menu组件传入菜单数据 -->
<Menu :menuList="this.$store.state.menus.children"></Menu>
<!-- 使用el-main作为主要内容区域 -->
<el-main class="fater-body">
<!-- 条件渲染el-breadcrumb当当前路由不是'/index'时显示面包屑导航 -->
<el-breadcrumb
v-if="this.$router.currentRoute.path != '/index'"
class="fater-body-breadcrumb"
>
<!-- 面包屑导航的第一项始终是系统首页 -->
<el-breadcrumb-item>系统首页</el-breadcrumb-item>
<!-- 面包屑导航的第二项是当前路由的名称 -->
<el-breadcrumb-item>{{ this.$router.currentRoute.name }}</el-breadcrumb-item>
</el-breadcrumb>
<!-- 使用router-view来渲染匹配的路由组件 -->
<router-view></router-view>
</el-main>
<Nav></Nav>
<el-container>
<Menu :menuList="this.$store.state.menus.children"></Menu>
<el-main class="fater-body">
<el-breadcrumb
v-if="this.$router.currentRoute.path != '/index'"
class="fater-body-breadcrumb"
>
<el-breadcrumb-item>系统首页</el-breadcrumb-item>
<el-breadcrumb-item>{{
this.$router.currentRoute.name
}}</el-breadcrumb-item>
</el-breadcrumb>
<router-view></router-view>
</el-main>
</el-container>
</el-container>
</el-container>
</template>
<style>
<!-- 这里可以添加组件的样式 -->
</style>
<script>
// NavMenu
import Nav from "../components/nav.vue";
import Menu from "../components/menu.vue";
// getLoginUser API
import { getLoginUser } from "../api";
export default {
//
data() {
return {};
},
//
methods: {},
//
mounted() {
// getLoginUsertokenVuexuser
getLoginUser(this.$store.state.token).then((resp) => {
this.$store.state.user = resp.data;
});
},
//
components: {
Nav,
Menu,
},
data() {
return {};
},
methods: {},
mounted() {
getLoginUser(this.$store.state.token).then((resp) => {
this.$store.state.user = resp.data;
});
},
components: {
Nav,
Menu,
},
};
</script>

@ -1,77 +1,85 @@
<template>
<div class="login-container"> <!-- 登录容器 -->
<div class="login-body"> <!-- 登录主体 -->
<div class="login-title">社团管理系统</div> <!-- 登录标题 -->
<div class="login-form"> <!-- 登录表单 -->
<el-form :model="loginForm" :rules="rules" ref="loginForm"> <!-- 使用 Element UI 的表单组件 -->
<el-form-item prop="userName"> <!-- 用户名表单项 -->
<div class="login-container">
<div class="login-body">
<div class="login-title">社团管理系统</div>
<div class="login-form">
<el-form :model="loginForm" :rules="rules" ref="loginForm">
<el-form-item prop="userName">
<el-input type="text" v-model="loginForm.userName" suffix-icon="iconfont icon-r-user1"
placeholder="请输入您的账号"></el-input> <!-- -->
placeholder="请输入您的账号"></el-input>
</el-form-item>
<el-form-item prop="passWord"> <!-- 密码表单项 -->
<el-form-item prop="passWord">
<el-input type="password" v-model="loginForm.passWord" suffix-icon="iconfont icon-r-lock"
placeholder="请输入您的密码"></el-input> <!-- -->
placeholder="请输入您的密码">
</el-input>
</el-form-item>
<el-form-item> <!-- 表单项容器 -->
<el-button style="margin-top: 15px; width: 100%; background-color: #6495ed;"
@click="submitForm('loginForm')" type="primary"> <!-- 登录按钮 -->
<el-form-item>
<el-button style="
margin-top: 15px;
width: 100%;
background-color: #6495ed;
" @click="submitForm('loginForm')" type="primary">
<b style="font-size: 22px;"> 用户登录</b></el-button><br />
<el-button style="width: 100%; margin-top: 5px" @click="showAddWin()" :underline="false"
type="info"> <!-- 注册新账号按钮 -->
type="info">
<b style="font-size: 22px;"> 注册新账号</b></el-button>
</el-form-item>
</el-form>
</div>
</div>
<el-dialog title="用户注册" width="700px" :modal="false" :visible.sync="showAddFlag"> <!-- 用户注册对话框 -->
<el-form label-width="90px" :model="usersForm"> <!-- 注册表单 -->
<el-row :gutter="15"> <!-- 行容器 -->
<el-col :span="12"> <!-- 列容器 -->
<el-form-item label="用户账号"> <!-- 用户账号表单项 -->
<el-input v-model="usersForm.userName" placeholder="请输入用户账号…" autocomplete="off"></el-input> <!-- 用户账号输入框 -->
<el-dialog title="用户注册" width="700px" :modal="false" :visible.sync="showAddFlag">
<el-form label-width="90px" :model="usersForm">
<el-row :gutter="15">
<el-col :span="12">
<el-form-item label="用户账号">
<el-input v-model="usersForm.userName" placeholder="请输入用户账号…" autocomplete="off"></el-input>
</el-form-item>
</el-col>
<el-col :span="12"> <!-- 列容器 -->
<el-form-item label="用户密码"> <!-- 用户密码表单项 -->
<el-input v-model="usersForm.passWord" type="password" placeholder="请输入用户密码…" autocomplete="off"></el-input> <!-- 用户密码输入框 -->
<el-col :span="12">
<el-form-item label="用户密码">
<el-input v-model="usersForm.passWord" type="password" placeholder="请输入用户密码…"
autocomplete="off"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="15"> <!-- 行容器 -->
<el-col :span="12"> <!-- 列容器 -->
<el-form-item label="用户姓名"> <!-- 用户姓名表单项 -->
<el-input v-model="usersForm.name" placeholder="请输入用户姓名…" autocomplete="off"></el-input> <!-- 用户姓名输入框 -->
<el-row :gutter="15">
<el-col :span="12">
<el-form-item label="用户姓名">
<el-input v-model="usersForm.name" placeholder="请输入用户姓名…" autocomplete="off"></el-input>
</el-form-item>
</el-col>
<el-col :span="12"> <!-- 列容器 -->
<el-form-item label="用户年龄"> <!-- 用户年龄表单项 -->
<el-input v-model="usersForm.age" placeholder="请输入用户年龄…" autocomplete="off"></el-input> <!-- 用户年龄输入框 -->
<el-col :span="12">
<el-form-item label="用户年龄">
<el-input v-model="usersForm.age" placeholder="请输入用户年龄…" autocomplete="off"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="15"> <!-- 行容器 -->
<el-col :span="12"> <!-- 列容器 -->
<el-form-item label="用户性别"> <!-- 用户性别表单项 -->
<el-radio-group v-model="usersForm.gender"> <!-- -->
<el-radio label="男"></el-radio> <!-- -->
<el-radio label="女"></el-radio> <!-- -->
<el-row :gutter="15">
<el-col :span="12">
<el-form-item label="用户性别">
<el-radio-group v-model="usersForm.gender">
<el-radio label="男"></el-radio>
<el-radio label="女"></el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12"> <!-- 列容器 -->
<el-form-item label="联系电话"> <!-- 联系电话表单项 -->
<el-input v-model="usersForm.phone" placeholder="请输入联系电话…" autocomplete="off"></el-input> <!-- 联系电话输入框 -->
<el-col :span="12">
<el-form-item label="联系电话">
<el-input v-model="usersForm.phone" placeholder="请输入联系电话…" autocomplete="off"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="联系地址"> <!-- 联系地址表单项 -->
<el-input rows="4" type="textarea" v-model="usersForm.address" placeholder="请输入联系地址…" autocomplete="off"></el-input> <!-- 联系地址输入框 -->
<el-form-item label="联系地址">
<el-input rows="4" type="textarea" v-model="usersForm.address" 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 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>
@ -79,57 +87,60 @@
<style>
.login-container {
position: fixed; /* 固定定位 */
left: 0; /* 左边距 */
top: 0; /* 上边距 */
bottom: 0; /* 下边距 */
right: 0; /* 右边距 */
background-image: url("../assets/back.jpg"); /* 背景图片 */
background-repeat: no-repeat; /* 不重复 */
background-size: 100%; /* 背景图片覆盖整个容器 */
position: fixed;
left: 0;
top: 0;
bottom: 0;
right: 0;
background-image: url("../assets/back.jpg");
background-repeat: no-repeat;
background-size: 100%;
/* background-color: #b0c4de; */
/* background-image: url("data:image/svg+xml,%3Csvg width='6' height='6' viewBox='0 0 6 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23ffffff' fill-opacity='0.4' fill-rule='evenodd'%3E%3Cpath d='M5 0h1L0 6V5zM6 5v1H5z'/%3E%3C/g%3E%3C/svg%3E"); */
}
.login-win {
position: absolute; /* 绝对定位 */
top: 50%; /* 垂直居中 */
left: 50%; /* 水平居中 */
transform: translate(-50%, -50%); /* 通过变换实现居中 */
width: 550px; /* 宽度 */
height: 300px; /* 高度 */
padding: 15px; /* 内边距 */
border-radius: 5px; /* 边角圆润 */
background-size: cover; /* 背景覆盖 */
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 550px;
height: 300px;
padding: 15px;
border-radius: 5px;
background-size: cover;
}
.login-body {
padding: 30px 40px; /* 内边距 */
position: absolute; /* 绝对定位 */
top: 50%; /* 垂直居中 */
left: 50%; /* 水平居中 */
transform: translate(-50%, -50%); /* 通过变换实现居中 */
background-color: white; /* 背景颜色 */
border-radius: 20px; /* 边角圆润 */
border: 2px solid #6495ed; /* 边框 */
opacity: 0.9; /* 透明度 */
padding: 30px 40px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: white;
border-radius: 20px;
border: 2px solid #6495ed;
opacity: 0.9;
}
.login-title {
text-align: center; /* 文本居中 */
font-size: 30px; /* 字体大小 */
font-weight: bold; /* 字体加粗 */
color: #6495ed; /* 字体颜色 */
margin-bottom: 35px; /* 下边距 */
text-align: center;
font-size: 30px;
font-weight: bold;
color: #6495ed;
margin-bottom: 35px;
}
</style>
<script>
import initMenu from "../utils/menus.js"; //
import { login, addUsers } from "../api/index.js"; // API
import initMenu from "../utils/menus.js";
import { login, addUsers } from "../api/index.js";
export default {
data() {
return {
showAddFlag: false, //
usersForm: { //
showAddFlag: false,
usersForm: {
id: "",
userName: "",
passWord: "",
@ -138,128 +149,129 @@ export default {
age: "",
phone: "",
address: "",
type: 2, //
status: 1, //
type: 2,
status: 1,
},
loginForm: { //
loginForm: {
userName: "",
passWord: "",
},
rules: { //
rules: {
userName: [
{
required: true, //
message: "用户账号必须输入", //
trigger: "blur", //
required: true,
message: "用户账号必须输入",
trigger: "blur",
},
],
passWord: [
{
required: true, //
message: "用户密码必须输入", //
trigger: "blur", //
required: true,
message: "用户密码必须输入",
trigger: "blur",
},
],
},
};
},
methods: {
showAddWin() { //
this.showAddFlag = true; // true
showAddWin() {
this.showAddFlag = true;
},
submitForm(formName) { //
this.$refs[formName].validate((valid) => { //
if (valid) { //
login(this.loginForm) // API
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
login(this.loginForm)
.then((res) => {
this.$store.commit("setToken", res.data); // token
sessionStorage.setItem("token", res.data); // token sessionStorage
initMenu(this.$router, this.$store); //
this.$router.push("/index"); //
this.$store.commit("setToken", res.data);
sessionStorage.setItem("token", res.data);
initMenu(this.$router, this.$store);
this.$router.push("/index");
})
} else {
return false; //
return false;
}
});
},
addInfo() { //
if (this.usersForm.userName.trim() == '') { //
addInfo() {
if (this.usersForm.userName.trim() == '') {
this.$message({
message: "请填写账号", //
type: "warning", //
message: "请填写账号",
type: "warning",
});
return; //
return;
}
if (this.usersForm.passWord.trim() == '') { //
if (this.usersForm.passWord.trim() == '') {
this.$message({
message: "请填写密码", //
type: "warning", //
message: "请填写密码",
type: "warning",
});
return; //
return;
}
if (this.usersForm.name.trim() == '') { //
if (this.usersForm.name.trim() == '') {
this.$message({
message: "请填写姓名", //
type: "warning", //
message: "请填写姓名",
type: "warning",
});
return; //
return;
}
if (this.usersForm.age.trim() == '') { //
if (this.usersForm.age.trim() == '') {
this.$message({
message: "请填写年龄", //
type: "warning", //
message: "请填写年龄",
type: "warning",
});
return; //
return;
}
if (this.usersForm.gender.trim() == '') { //
if (this.usersForm.gender.trim() == '') {
this.$message({
message: "请选择性别", //
type: "warning", //
message: "请选择性别",
type: "warning",
});
return; //
return;
}
if (this.usersForm.phone.trim() == '') { //
if (this.usersForm.phone.trim() == '') {
this.$message({
message: "请填写手机号码", //
type: "warning", //
message: "请填写手机号码",
type: "warning",
});
return; //
return;
}
if (this.usersForm.address.trim() == '') { //
if (this.usersForm.address.trim() == '') {
this.$message({
message: "请填写地址", //
type: "warning", //
message: "请填写地址",
type: "warning",
});
return; //
return;
}
addUsers(this.usersForm).then((resp) => { // API
if (resp.code == 0) { //
this.$confirm("注册成功, 立即登陆?", "提示", { //
confirmButtonText: "确定", //
cancelButtonText: "取消", //
type: "warning", //
}).then(() => { //
login({ // API
addUsers(this.usersForm).then((resp) => {
if (resp.code == 0) {
this.$confirm("注册成功, 立即登陆?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
login({
userName: this.usersForm.userName,
passWord: this.usersForm.passWord,
}).then((res) => {
this.$store.commit("setToken", res.data); // token
sessionStorage.setItem("token", res.data); // token sessionStorage
initMenu(this.$router, this.$store); //
this.$router.push("/index"); //
this.$store.commit("setToken", res.data);
sessionStorage.setItem("token", res.data);
initMenu(this.$router, this.$store);
this.$router.push("/index");
});
});
} else {
this.$message({ //
message: resp.msg, //
type: "warning", //
this.$message({
message: resp.msg,
type: "warning",
});
}
});
},
},
mounted() { //
mounted() {
}
};
</script>

@ -1,9 +1,6 @@
<template>
<!-- 外层容器 -->
<div class="fater-body-show">
<!-- 卡片组件用于信息查询 -->
<el-card shadow="never">
<!-- 卡片头部 -->
<div
class="el-card-header"
slot="header"
@ -12,7 +9,6 @@
<i class="iconfont icon-r-find" style="font-size: 26px"></i>
信息查询
</div>
<!-- 信息查询表单 -->
<div>
<el-form :inline="true" :model="qryForm">
<el-form-item>
@ -30,7 +26,6 @@
</div>
</el-card>
<!-- 卡片组件用于展示活动报名信息列表 -->
<el-card shadow="never">
<div slot="header">
<el-button
@ -42,7 +37,6 @@
>
</div>
<div>
<!-- 表格组件用于展示活动报名信息 -->
<el-table
v-loading="loading"
element-loading-text="拼命加载中"
@ -70,8 +64,6 @@
prop="userId"
label="报名用户"
></el-table-column>
<!-- 操作列 -->
<el-table-column
align="center"
label="操作处理"
@ -93,8 +85,6 @@
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<el-pagination
v-if="pageTotal != 0"
style="margin-top: 15px"
@ -110,7 +100,6 @@
</div>
</el-card>
<!-- 添加信息对话框 -->
<el-dialog title="添加信息" width="600px" :visible.sync="showAddFlag">
<el-form label-width="90px" :model="activeLogsForm">
<el-form-item label="报名时间">
@ -150,7 +139,6 @@
</div>
</el-dialog>
<!-- 修改信息对话框 -->
<el-dialog title="修改信息" width="600px" :visible.sync="showUpdFlag">
<el-form label-width="90px" :model="activeLogsForm">
<el-form-item label="报名时间">
@ -192,143 +180,131 @@
</div>
</template>
<!-- 样式部分 -->
<style>
</style>
<!-- 脚本部分 -->
<script>
import {
getPageActiveLogs,
addActiveLogs,
updActiveLogs,
delActiveLogs,
getPageActiveLogs,
addActiveLogs,
updActiveLogs,
delActiveLogs,
} from "../../api";
export default {
data() {
return {
pageInfos: [], //
pageIndex: 1, //
pageSize: 10, //
pageTotal: 0, //
totalInfo: 0, //
loading: true, //
showAddFlag: false, //
showUpdFlag: false, //
qryForm: { //
name: "",
},
activeLogsForm: { //
id: "",
createTime: "",
activeId: "",
userId: "",
},
};
},
methods: {
//
getPageInfo(pageIndex, pageSize) {
getPageActiveLogs(pageIndex, pageSize).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() {
getPageActiveLogs(1, this.pageSize, this.qryForm.name).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.name);
},
//
handleCurrentChange(pageIndex) {
this.getPageInfo(pageIndex, this.pageSize, this.qryForm.name);
},
//
initForm() {
this.activeLogsForm = {
id: "",
createTime: "",
activeId: "",
userId: "",
};
},
//
showAddWin() {
this.showAddFlag = true;
data() {
return {
pageInfos: [],
pageIndex: 1,
pageSize: 10,
pageTotal: 0,
totalInfo: 0,
loading: true,
showAddFlag: false,
showUpdFlag: false,
qryForm: {
name: "",
},
activeLogsForm: {
id: "",
createTime: "",
activeId: "",
userId: "",
},
};
},
//
showUpdWin(row) {
this.activeLogsForm = row;
this.showUpdFlag = true;
},
//
addInfo() {
addActiveLogs(this.activeLogsForm).then((resp) => {
this.$message({
message: resp.msg,
type: "success",
});
methods: {
getPageInfo(pageIndex, pageSize) {
getPageActiveLogs(pageIndex, pageSize).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.getPageInfo(1, this.pageSize);
this.loading = false;
});
},
getPageLikeInfo() {
getPageActiveLogs(1, this.pageSize, this.qryForm.name).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.name);
},
handleCurrentChange(pageIndex) {
this.getPageInfo(pageIndex, this.pageSize, this.qryForm.name);
},
initForm() {
this.activeLogsForm = {
id: "",
createTime: "",
activeId: "",
userId: "",
};
},
showAddWin() {
this.showAddFlag = true;
},
showUpdWin(row) {
this.activeLogsForm = row;
this.showUpdFlag = true;
},
addInfo() {
addActiveLogs(this.activeLogsForm).then((resp) => {
this.$message({
message: resp.msg,
type: "success",
});
this.showAddFlag = false;
this.getPageInfo(1, this.pageSize);
this.initForm();
});
},
//
updInfo() {
updActiveLogs(this.activeLogsForm).then((resp) => {
this.$message({
message: resp.msg,
type: "success",
});
this.showAddFlag = false;
this.getPageInfo(1, this.pageSize);
this.initForm();
});
},
updInfo() {
updActiveLogs(this.activeLogsForm).then((resp) => {
this.$message({
message: resp.msg,
type: "success",
});
this.showUpdFlag = false;
this.getPageInfo(1, this.pageSize);
this.initForm();
});
},
//
delInfo(id) {
this.$confirm("即将删除相关信息, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
delActiveLogs(id).then((resp) => {
this.$message({
message: resp.msg,
type: "success",
});
this.showUpdFlag = false;
this.initForm();
});
},
delInfo(id) {
this.$confirm("即将删除相关信息, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
delActiveLogs(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);
},
},
mounted() {
this.getPageInfo(1, this.pageSize);
},
};
</script>

@ -1,231 +1,246 @@
<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.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"
@click="getPageLikeInfo()"
style="font-size: 18px">
搜索
</el-button>
</el-form-item>
</el-form>
</div>
</el-card>
<!-- 卡片组件用于展示社团申请信息列表 -->
<el-card shadow="never">
<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 v-if="userType == 1"
align="center" label="操作处理"
fixed="right" width="240">
<template slot-scope="scope">
<!-- 通过按钮 -->
<el-button v-if="scope.row.status == 0"
type="primary" @click="updInfo(scope.row, 1)">
通过
</el-button>
<!-- 驳回按钮 -->
<el-button v-if="scope.row.status == 0"
type="danger" @click="updInfo(scope.row, 2)">
驳回
</el-button>
<!-- 已通过标签 -->
<el-tag effect="plain" type="success"
v-if="scope.row.status == 1">
已通过
</el-tag>
<!-- 已驳回标签 -->
<el-tag effect="plain" type="danger"
v-if="scope.row.status == 2">
已驳回
</el-tag>
</template>
</el-table-column>
<!-- 申请状态列非管理员视图 -->
<el-table-column v-else align="center" label="申请状态">
<template slot-scope="scope">
<!-- 审核中标签 -->
<el-tag effect="plain" type="warning"
v-if="scope.row.status == 0">
审核中
</el-tag>
<!-- 已通过标签 -->
<el-tag effect="plain" type="success"
v-if="scope.row.status == 1">
已通过
</el-tag>
<!-- 已驳回标签 -->
<el-tag effect="plain" type="danger"
v-if="scope.row.status == 2">
已驳回
</el-tag>
</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>
</div>
<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.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" @click="getPageLikeInfo()" style="font-size: 18px">
搜索</el-button>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card shadow="never">
<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
v-if="userType == 1"
align="center"
label="操作处理"
fixed="right"
width="240"
>
<template slot-scope="scope">
<el-button
v-if="scope.row.status == 0"
type="primary"
@click="updInfo(scope.row, 1)"
>
通过</el-button
>
<el-button
v-if="scope.row.status == 0"
type="danger"
@click="updInfo(scope.row, 2)"
>
驳回</el-button
>
<el-tag
effect="plain"
type="success"
v-if="scope.row.status == 1"
>已通过</el-tag
>
<el-tag
effect="plain"
type="danger"
v-if="scope.row.status == 2"
>已驳回</el-tag
>
</template>
</el-table-column>
<el-table-column v-else align="center" label="申请状态">
<template slot-scope="scope">
<el-tag
effect="plain"
type="warning"
v-if="scope.row.status == 0"
>审核中</el-tag
>
<el-tag
effect="plain"
type="success"
v-if="scope.row.status == 1"
>已通过</el-tag
>
<el-tag
effect="plain"
type="danger"
v-if="scope.row.status == 2"
>已驳回</el-tag
>
</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>
</div>
</template>
<!-- 样式部分 -->
<style>
</style>
<!-- 脚本部分 -->
<script>
import { getLoginUser, getPageApplyLogs, updApplyLogs } from "../../api";
export default {
data() {
return {
userType: "", //
pageInfos: [], //
pageIndex: 1, //
pageSize: 10, //
pageTotal: 0, //
totalInfo: 0, //
loading: true, //
qryForm: { //
token: this.$store.state.token, // token
teamName: "", //
userName: "", //
},
};
},
methods: {
//
getPageInfo(pageIndex, pageSize) {
getPageApplyLogs(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() {
getPageApplyLogs(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;
});
data() {
return {
userType: "",
pageInfos: [],
pageIndex: 1,
pageSize: 10,
pageTotal: 0,
totalInfo: 0,
loading: true,
qryForm: {
token: this.$store.state.token,
teamName: "",
userName: "",
},
};
},
//
handleSizeChange(pageSize) {
this.getPageInfo(this.pageIndex, pageSize, this.qryForm.token, this.qryForm.teamName, this.qryForm.userName);
methods: {
getPageInfo(pageIndex, pageSize) {
getPageApplyLogs(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() {
getPageApplyLogs(
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
);
},
updInfo(data, status) {
data["status"] = status;
updApplyLogs(data).then((resp) => {
this.$message({
message: resp.msg,
type: "success",
});
this.getPageInfo(1, this.pageSize);
this.initForm();
});
},
},
//
handleCurrentChange(pageIndex) {
this.getPageInfo(pageIndex, this.pageSize, this.qryForm.token, this.qryForm.teamName, this.qryForm.userName);
},
//
updInfo(data, status) {
data["status"] = status;
updApplyLogs(data).then((resp) => {
this.$message({
message: resp.msg,
type: "success",
});
this.getPageInfo(1, this.pageSize);
mounted() {
this.getPageInfo(1, this.pageSize, this.qryForm.token);
//
this.initForm();
});
getLoginUser(this.$store.state.token).then((resp) => {
this.userType = resp.data.type;
});
},
},
mounted() {
//
this.getPageInfo(1, this.pageSize, this.qryForm.token);
//
getLoginUser(this.$store.state.token).then((resp) => {
this.userType = resp.data.type;
});
},
};
</script>

@ -1,145 +1,119 @@
<template>
<div class="fater-body-show">
<!-- 主容器包含整个信息查询组件 -->
<el-card shadow="never">
<!-- 使用 Element UI 的卡片组件 -->
<div
class="el-card-header"
<!-- 卡片头部 -->
slot="header"
<!-- 指定插槽为 header -->
style="font-size: 26px"
<!-- 设置字体大小 -->
>
<i class="iconfont icon-r-find" style="font-size: 26px"></i>
<!-- 图标 -->
信息查询 <!-- 卡片标题 -->
信息查询
</div>
<div>
<el-form :inline="true" :model="qryForm">
<!-- 使用 Element UI 的表单组件设置为行内模式 -->
<el-form-item>
<!-- 表单项 -->
<el-input
v-model="qryForm.teamName"
<!-- 双向绑定社团名称 -->
placeholder="输入社团名称…"
<!-- 输入框提示文本 -->
autocomplete="off"
<!-- 关闭自动完成功能 -->
></el-input>
</el-form-item>
<el-form-item> <!-- 表单项 -->
<el-form-item>
<el-input
v-model="qryForm.userName"
<!-- 双向绑定用户姓名 -->
placeholder="输入用户姓名…"
<!-- 输入框提示文本 -->
autocomplete="off"
<!-- 关闭自动完成功能 -->
></el-input>
</el-form-item>
<el-form-item> <!-- 表单项 -->
<el-form-item>
<el-button
type="primary"
<!-- 按钮类型为主要按钮 -->
@click="getPageLikeInfo()"
<!-- 点击按钮时调用 getPageLikeInfo 方法 -->
style="font-size: 18px"
<!-- 设置字体大小 -->
>
搜索 <!-- 按钮文本 -->
</el-button>
搜索</el-button
>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card shadow="never">
<!-- 使用 Element UI 的卡片组件 -->
<div>
<el-table
v-loading="loading"
<!-- 根据 loading 状态显示加载效果 -->
element-loading-text="拼命加载中"
<!-- 加载时的文本 -->
element-loading-spinner="el-icon-loading"
<!-- 加载时的图标 -->
element-loading-background="rgba(124, 124, 124, 0.8)"
<!-- 加载背景颜色 -->
:data="pageInfos" <!-- 表格数据绑定 -->
border <!-- 显示边框 -->
:data="pageInfos"
border
>
<el-table-column
align="center" <!-- 列内容居中对齐 -->
type="index" <!-- 显示索引列 -->
align="center"
type="index"
></el-table-column>
<el-table-column
align="center" <!-- 列内容居中对齐 -->
prop="userId" <!-- 数据字段为 userId -->
label="成员ID" <!-- 列标题 -->
align="center"
prop="userId"
label="成员ID"
></el-table-column>
<el-table-column
align="center" <!-- 列内容居中对齐 -->
prop="userName" <!-- 数据字段为 userName -->
label="成员姓名" <!-- 列标题 -->
align="center"
prop="userName"
label="成员姓名"
></el-table-column>
<el-table-column
align="center" <!-- 列内容居中对齐 -->
align="center"
prop="userGender"
<!-- 数据字段为 userGender -->
label="成员性别" <!-- 列标题 -->
label="成员性别"
></el-table-column>
<el-table-column
align="center" <!-- 列内容居中对齐 -->
prop="userAge" <!-- 数据字段为 userAge -->
label="成员年龄" <!-- 列标题 -->
align="center"
prop="userAge"
label="成员年龄"
></el-table-column>
<el-table-column
align="center" <!-- 列内容居中对齐 -->
prop="userPhone" <!-- 数据字段为 userPhone -->
label="成员电话" <!-- 列标题 -->
align="center"
prop="userPhone"
label="成员电话"
></el-table-column>
<el-table-column
align="center" <!-- 列内容居中对齐 -->
prop="teamName" <!-- 数据字段为 teamName -->
label="社团名称" <!-- 列标题 -->
align="center"
prop="teamName"
label="社团名称"
></el-table-column>
<el-table-column
align="center" <!-- 列内容居中对齐 -->
prop="createTime" <!-- 数据字段为 createTime -->
label="入团时间" <!-- 列标题 -->
align="center"
prop="createTime"
label="入团时间"
></el-table-column>
<el-table-column
align="center" <!-- 列内容居中对齐 -->
label="操作处理" <!-- 列标题 -->
fixed="right" <!-- 固定在右侧 -->
width="140" <!-- 列宽 -->
align="center"
label="操作处理"
fixed="right"
width="140"
>
<template slot-scope="scope"> <!-- 自定义列内容 -->
<template slot-scope="scope">
<el-button
type="danger"
<!-- 按钮类型为危险按钮 -->
style="font-size: 18px"
<!-- 设置字体大小 -->
@click="delInfo(scope.row.id)"
<!-- 点击按钮时调用 delInfo 方法传入当前行的 ID -->
>
删除 <!-- 按钮文本 -->
</el-button>
删除</el-button
>
</template>
</el-table-column>
</el-table>
<el-pagination
v-if="pageTotal >= 0" <!-- pageTotal 大于等于 0 时显示分页 -->
style="margin-top: 15px" <!-- 设置上边距 -->
@size-change="handleSizeChange" <!-- 页大小变化时调用 handleSizeChange 方法 -->
@current-change="handleCurrentChange" <!-- 当前页变化时调用 handleCurrentChange 方法 -->
:current-page="pageIndex" <!-- 当前页码绑定 -->
:page-sizes="[5, 10, 20, 50]" <!-- 可选的每页数据量 -->
:page-size="pageSize" <!-- 每页数据量绑定 -->
layout="total, sizes, prev, pager, next, jumper" <!-- 分页组件布局 -->
:total="totalInfo" <!-- 总数据量绑定 -->
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>
@ -151,123 +125,91 @@
</style>
<script>
import { getPageMembers, delMembers } from "../../api"; // API
import { getPageMembers, delMembers } from "../../api";
export default {
data() {
return {
pageInfos: [],
//
pageIndex: 1,
//
pageSize: 10,
//
pageTotal: 0,
//
totalInfo: 0,
//
loading: true,
//
qryForm: { //
qryForm: {
token: this.$store.state.token,
// Vuex token
teamName: "",
//
userName: "",
//
},
};
},
methods: {
getPageInfo(pageIndex, pageSize) { //
getPageMembers(pageIndex, pageSize, this.qryForm.token).then( // API
getPageInfo(pageIndex, pageSize) {
getPageMembers(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; // false
this.loading = false;
}
);
},
getPageLikeInfo() {
//
getPageMembers(
1, //
1,
this.pageSize,
//
this.qryForm.token,
// 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;
// false
});
},
handleSizeChange(pageSize) { //
handleSizeChange(pageSize) {
this.getPageInfo(
this.pageIndex,
//
pageSize,
//
this.qryForm.token,
// token
this.qryForm.teamName,
//
this.qryForm.userName
//
);
},
handleCurrentChange(pageIndex) { //
handleCurrentChange(pageIndex) {
this.getPageInfo(
pageIndex,
//
this.pageSize,
//
this.qryForm.token,
// token
this.qryForm.teamName,
//
this.qryForm.userName
//
);
},
delInfo(id) { //
this.$confirm("移除成员将移除相关记录,确认继续吗?", "提示", { //
confirmButtonText: "确定", //
cancelButtonText: "取消", //
type: "warning", //
delInfo(id) {
this.$confirm("移除成员将移除相关记录,确认继续吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
delMembers(id).then((resp) => { // API
if (resp.code == 0) { //
this.$message({ //
delMembers(id).then((resp) => {
if (resp.code == 0) {
this.$message({
message: resp.msg,
type: "success",
});
this.getPageInfo(1, this.pageSize, this.qryForm.token); //
} else { //
this.$message({ //
this.getPageInfo(1, this.pageSize, this.qryForm.token);
} else {
this.$message({
message: resp.msg,
type: "warning",
});
@ -276,8 +218,8 @@ export default {
});
},
},
mounted() { //
this.getPageInfo(1, this.pageSize, this.qryForm.token); //
mounted() {
this.getPageInfo(1, this.pageSize, this.qryForm.token);
},
};
</script>

@ -1,386 +1,323 @@
<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"
>
<!-- 表格行模板根据团队 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-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-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>
<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>
</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,
},
};
},
//
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;
}
);
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,
},
};
},
//
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",
});
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.getPageInfo(1, this.pageSize, this.qryForm.token);
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.showAddFlag = false;
});
this.getPageInfo(1, this.pageSize);
});
});
},
},
//
delInfo(id) {
this.$confirm("即将删除相关信息, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
delNotices(id).then((resp) => {
this.$message({
message: resp.msg,
type: "success",
});
mounted() {
this.getPageInfo(1, this.pageSize, this.qryForm.token);
getLoginUser(this.$store.state.token).then((resp) => {
this.userType = resp.data.type;
this.getPageInfo(1, this.pageSize);
getManTeamList(resp.data.id).then((resp) => {
this.teams = resp.data;
});
});
});
},
},
//
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,461 +1,375 @@
<template>
<!-- 整个页面的最外层容器设置类名用于样式控制 -->
<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()"
<div class="fater-body-show">
<el-card shadow="never">
<div
class="el-card-header"
slot="header"
style="font-size: 26px"
>
搜索</el-button
>
</el-form-item>
</el-form>
</div>
</el-card>
<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-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-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>
<!-- 使用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="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="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>
<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>
</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: [],
// 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;
}
);
},
//
// 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;
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: "",
},
};
},
//
// addPayLogspayLogsFormthen
// 1. 使this.$messageresp.msg"success"
// 2. getPageInfo使
// 3. showAddFlagfalse
addInfo() {
addPayLogs(this.payLogsForm).then((resp) => {
this.$message({
message: resp.msg,
type: "success",
});
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;
this.getPageInfo(1, this.pageSize, this.qryForm.token);
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.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.showAddFlag = false;
});
},
updInfo() {
updPayLogs(this.payLogsForm).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.qryForm.token);
this.getPageInfo(1, this.pageSize);
});
});
this.showUpdFlag = false;
});
},
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);
});
});
},
},
},
// mountedDOM
//
// 1. getPageInfotoken
// 2. getLoginUsertokenthen
// - userType
// - 1getManTeamListIDteams1getAllTeamListteamsteams
mounted() {
this.getPageInfo(1, this.pageSize, this.qryForm.token);
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;
if (resp.data.type == 1) {
getManTeamList(resp.data.id).then((resp) => {
this.teams = resp.data;
});
} else {
getAllTeamList().then((resp) => {
this.teams = resp.data;
});
}
});
} else {
getAllTeamList().then((resp) => {
this.teams = resp.data;
});
}
});
},
},
};
</script>

@ -1,350 +1,293 @@
<template>
<!-- 外层容器用于包含整个页面内容 -->
<div class="fater-body-show">
<!-- 使用Element UI的卡片组件用于展示信息查询区域 -->
<el-card shadow="never">
<!-- 卡片头部使用slot插槽自定义内容 -->
<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.name"
placeholder="输入社团类型名称…"
autocomplete="off"
></el-input>
</el-form-item>
<!-- 表单项包含搜索按钮 -->
<el-form-item>
<el-button
type="primary"
@click="getPageLikeInfo()"
style="font-size: 18px"
<div class="fater-body-show">
<el-card shadow="never">
<div
class="el-card-header"
slot="header"
style="font-size: 26px"
>
搜索
</el-button>
</el-form-item>
</el-form>
</div>
</el-card>
<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.name"
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>
<!-- 使用Element UI的卡片组件用于展示用户信息列表区域 -->
<el-card shadow="never">
<!-- 卡片头部包含新增按钮 -->
<div 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="name"
label="类型名称"
></el-table-column>
<el-table-column
align="center"
prop="createTime"
label="创建时间"
></el-table-column>
<!-- 操作处理列使用插槽自定义内容 -->
<el-table-column
align="center"
label="操作处理"
fixed="right"
width="250"
>
<template slot-scope="scope">
<!-- 编辑按钮 -->
<el-button
type="primary"
@click="showUpdWin(scope.row)"
style="font-size: 18px"
>
编辑
</el-button>
<!-- 删除按钮 -->
<el-button
type="danger"
@click="delInfo(scope.row.id)"
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 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="name"
label="类型名称"
></el-table-column>
<el-table-column
align="center"
prop="createTime"
label="创建时间"
></el-table-column>
<el-table-column
align="center"
label="操作处理"
fixed="right"
width="250"
>
<template slot-scope="scope">
<el-button
type="primary"
@click="showUpdWin(scope.row)"
style="font-size: 18px"
>
编辑
</el-button>
<el-button
type="danger"
@click="delInfo(scope.row.id)"
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="teamTypesForm">
<!-- 表单项用于输入类型名称 -->
<el-form-item label="类型名称">
<el-input
v-model="teamTypesForm.name"
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>
<el-dialog title="添加信息" width="600px" :visible.sync="showAddFlag">
<el-form label-width="90px" :model="teamTypesForm">
<el-form-item label="类型名称">
<el-input
v-model="teamTypesForm.name"
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>
<!-- 对话框组件用于修改信息 -->
<el-dialog title="修改信息" width="600px" :visible.sync="showUpdFlag">
<!-- 表单组件用于输入修改信息 -->
<el-form label-width="90px" :model="teamTypesForm">
<!-- 表单项用于输入类型名称 -->
<el-form-item label="类型名称">
<el-input
v-model="teamTypesForm.name"
placeholder="请输入类型名称…"
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>
<el-dialog title="修改信息" width="600px" :visible.sync="showUpdFlag">
<el-form label-width="90px" :model="teamTypesForm">
<el-form-item label="类型名称">
<el-input
v-model="teamTypesForm.name"
placeholder="请输入类型名称…"
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>
<!-- 样式标签用于定义组件的CSS样式 -->
<style>
</style>
<script>
// API
import {
getPageTeamTypes,
addTeamTypes,
updTeamTypes,
delTeamTypes,
getPageTeamTypes,
addTeamTypes,
updTeamTypes,
delTeamTypes,
} from "../../api";
export default {
//
data() {
return {
//
pageInfos: [],
// 1
pageIndex: 1,
// 10
pageSize: 10,
// 0
pageTotal: 0,
// 0
totalInfo: 0,
// true
loading: true,
// false
showAddFlag: false,
// false
showUpdFlag: false,
//
qryForm: {
name: "",
},
//
teamTypesForm: {
id: "",
name: "",
},
};
},
//
methods: {
//
getPageInfo(pageIndex, pageSize) {
getPageTeamTypes(pageIndex, pageSize).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() {
getPageTeamTypes(1, this.pageSize, this.qryForm.name).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.name);
},
//
handleCurrentChange(pageIndex) {
this.getPageInfo(pageIndex, this.pageSize, this.qryForm.name);
},
//
initForm() {
this.teamTypesForm = {
id: "",
name: "",
};
},
//
showAddWin() {
this.showAddFlag = true;
},
//
showUpdWin(row) {
this.teamTypesForm = row;
this.showUpdFlag = true;
export default {
data() {
return {
pageInfos: [],
pageIndex: 1,
pageSize: 10,
pageTotal: 0,
totalInfo: 0,
loading: true,
showAddFlag: false,
showUpdFlag: false,
qryForm: {
name: "",
},
teamTypesForm: {
id: "",
name: "",
},
};
},
//
//
methods: {
// API
addInfo() {
// API
addTeamTypes(this.teamTypesForm).then((resp) => {
//
this.$message({
message: resp.msg,
type: "success",
});
//
this.getPageInfo(1, this.pageSize);
//
this.showAddFlag = false;
//
this.initForm();
});
},
// API
updInfo() {
// API
updTeamTypes(this.teamTypesForm).then((resp) => {
//
this.$message({
message: resp.msg,
type: "success",
});
//
this.getPageInfo(1, this.pageSize);
//
this.showUpdFlag = false;
//
this.initForm();
});
},
// API
delInfo(id) {
//
this.$confirm("即将删除相关信息, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
// API
delTeamTypes(id).then((resp) => {
// 0
if (resp.code == 0) {
this.$message({
message: resp.msg,
type: "success",
});
//
this.getPageInfo(1, this.pageSize);
} else {
// 0
this.$message({
message: resp.msg,
getPageInfo(pageIndex, pageSize) {
getPageTeamTypes(pageIndex, pageSize).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() {
getPageTeamTypes(1, this.pageSize, this.qryForm.name).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.name);
},
handleCurrentChange(pageIndex) {
this.getPageInfo(pageIndex, this.pageSize, this.qryForm.name);
},
initForm() {
this.teamTypesForm = {
id: "",
name: "",
};
},
showAddWin() {
this.showAddFlag = true;
},
showUpdWin(row) {
this.teamTypesForm = row;
this.showUpdFlag = true;
},
addInfo() {
addTeamTypes(this.teamTypesForm).then((resp) => {
this.$message({
message: resp.msg,
type: "success",
});
this.getPageInfo(1, this.pageSize);
this.showAddFlag = false;
this.initForm();
});
},
updInfo() {
updTeamTypes(this.teamTypesForm).then((resp) => {
this.$message({
message: resp.msg,
type: "success",
});
this.getPageInfo(1, this.pageSize);
this.showUpdFlag = false;
this.initForm();
});
},
delInfo(id) {
this.$confirm("即将删除相关信息, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
});
}
});
});
},
}).then(() => {
delTeamTypes(id).then((resp) => {
if (resp.code == 0) {
this.$message({
message: resp.msg,
type: "success",
});
this.getPageInfo(1, this.pageSize);
} else {
this.$message({
message: resp.msg,
type: "warning",
});
}
});
});
},
},
//
mounted() {
//
this.getPageInfo(1, this.pageSize);
this.getPageInfo(1, this.pageSize);
},
},}
};
</script>

@ -1,235 +1,245 @@
<template>
<div class="fater-body-show"> <!-- 主容器 -->
<el-card shadow="never"> <!-- 使用 Element UI 的卡片组件 -->
<div class="fater-body-show">
<el-card shadow="never">
<div
class="el-card-header"
slot="header"
style="font-size: 26px" <!-- 卡片头部样式 -->
style="font-size: 26px"
>
<i class="iconfont icon-r-find" style="font-size: 26px"></i> <!-- 图标 -->
信息查询 <!-- 卡片标题 -->
<i class="iconfont icon-r-find" style="font-size: 26px"></i>
信息查询
</div>
<div>
<el-form :inline="true" :model="qryForm"> <!-- 使用 Element UI 的表单组件设置为行内模式 -->
<el-form-item> <!-- 表单项 -->
<el-form :inline="true" :model="qryForm">
<el-form-item>
<el-input
v-model="qryForm.name" <!-- 双向绑定查询表单的社团名称 -->
placeholder="输入社团名称…" <!-- 输入框提示文本 -->
autocomplete="off" <!-- 关闭自动完成功能 -->
v-model="qryForm.name"
placeholder="输入社团名称…"
autocomplete="off"
></el-input>
</el-form-item>
<el-form-item> <!-- 表单项 -->
<el-form-item>
<el-select
v-model="qryForm.typeId" <!-- 双向绑定查询表单的社团类型 -->
placeholder="请选择社团类型" <!-- 下拉框提示文本 -->
v-model="qryForm.typeId"
placeholder="请选择社团类型"
>
<el-option label="查看全部" value=""></el-option> <!-- -->
<el-option label="查看全部" value=""></el-option>
<el-option
v-for="(item, index) in teamTypes" <!-- 遍历社团类型 -->
:key="index" <!-- 唯一键 -->
:label="item.name" <!-- 显示的标签 -->
:value="item.id" <!-- 选中的值 -->
v-for="(item, index) in teamTypes"
:key="index"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item> <!-- 表单项 -->
<el-form-item>
<el-button
type="primary" <!-- 按钮类型 -->
@click="getPageLikeInfo()" <!-- 点击事件调用查询方法 -->
style="font-size: 18px" <!-- 按钮样式 -->
type="primary"
@click="getPageLikeInfo()"
style="font-size: 18px"
>
搜索</el-button> <!-- -->
搜索</el-button
>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card shadow="never"> <!-- 另一个卡片组件 -->
<div v-if="userType == 0" slot="header"> <!-- -->
<el-card shadow="never">
<div v-if="userType == 0" slot="header">
<el-button
type="primary" <!-- 按钮类型 -->
style="font-size: 18px" <!-- 按钮样式 -->
@click="showAddWin()" <!-- 点击事件显示添加窗口 -->
type="primary"
style="font-size: 18px"
@click="showAddWin()"
>
新增</el-button
>
新增</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 <!-- 表格边框 -->
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" <!-- 索引列 -->
align="center"
type="index"
></el-table-column>
<el-table-column
align="center" <!-- 列内容居中 -->
prop="name" <!-- 数据字段 -->
label="社团名称" <!-- 列标题 -->
align="center"
prop="name"
label="社团名称"
></el-table-column>
<el-table-column
align="center" <!-- 列内容居中 -->
prop="typeName" <!-- 数据字段 -->
label="社团类型" <!-- 列标题 -->
align="center"
prop="typeName"
label="社团类型"
></el-table-column>
<el-table-column
align="center" <!-- 列内容居中 -->
prop="managerName" <!-- 数据字段 -->
label="社团团长" <!-- 列标题 -->
align="center"
prop="managerName"
label="社团团长"
></el-table-column>
<el-table-column
align="center" <!-- 列内容居中 -->
prop="createTime" <!-- 数据字段 -->
label="建立时间" <!-- 列标题 -->
align="center"
prop="createTime"
label="建立时间"
></el-table-column>
<el-table-column
align="center" <!-- 列内容居中 -->
prop="total" <!-- 数据字段 -->
label="社团人数" <!-- 列标题 -->
align="center"
prop="total"
label="社团人数"
></el-table-column>
<el-table-column
v-if="userType == 0" <!-- 根据用户类型显示操作列 -->
align="center" <!-- 列内容居中 -->
width="250" <!-- 列宽 -->
label="操作处理" <!-- 列标题 -->
fixed="right" <!-- 固定在右侧 -->
v-if="userType == 0"
align="center"
width="250"
label="操作处理"
fixed="right"
>
<template slot-scope="scope"> <!-- 自定义列内容 -->
<template slot-scope="scope">
<el-button
type="primary" <!-- 按钮类型 -->
style="font-size: 18px" <!-- 按钮样式 -->
@click="showUpdWin(scope.row)" <!-- 点击事件显示编辑窗口 -->
type="primary"
style="font-size: 18px"
@click="showUpdWin(scope.row)"
>
编辑</el-button> <!-- -->
编辑</el-button
>
<el-button
type="danger" <!-- 按钮类型 -->
style="font-size: 18px" <!-- 按钮样式 -->
@click="delInfo(scope.row.id)" <!-- 点击事件删除信息 -->
type="danger"
style="font-size: 18px"
@click="delInfo(scope.row.id)"
>
删除</el-button> <!-- -->
删除</el-button
>
</template>
</el-table-column>
<el-table-column
v-if="userType == 2" <!-- 根据用户类型显示申请列 -->
align="center" <!-- 列内容居中 -->
label="操作处理" <!-- 列标题 -->
fixed="right" <!-- 固定在右侧 -->
width="140" <!-- 列宽 -->
v-if="userType == 2"
align="center"
label="操作处理"
fixed="right"
width="140"
>
<template slot-scope="scope"> <!-- 自定义列内容 -->
<template slot-scope="scope">
<el-button
type="primary" <!-- 按钮类型 -->
style="font-size: 18px" <!-- 按钮样式 -->
@click="apply(scope.row.id)" <!-- 点击事件申请加入社团 -->
type="primary"
style="font-size: 18px"
@click="apply(scope.row.id)"
>
申请</el-button> <!-- -->
申请</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" <!-- 总条数 -->
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="teamsForm"> <!-- 表单组件 -->
<el-form-item label="社团名称"> <!-- 表单项 -->
<el-dialog title="添加信息" width="600px" :visible.sync="showAddFlag">
<el-form label-width="90px" :model="teamsForm">
<el-form-item label="社团名称">
<el-input
v-model="teamsForm.name" <!-- 双向绑定社团名称 -->
placeholder="请输入社团名称…" <!-- 输入框提示文本 -->
autocomplete="off" <!-- 关闭自动完成功能 -->
v-model="teamsForm.name"
placeholder="请输入社团名称…"
autocomplete="off"
></el-input>
</el-form-item>
<el-form-item label="社团类型"> <!-- 表单项 -->
<el-form-item label="社团类型">
<el-select
style="width: 100%" <!-- 下拉框样式 -->
v-model="teamsForm.typeId" <!-- 双向绑定社团类型 -->
placeholder="请选择社团类型" <!-- 下拉框提示文本 -->
style="width: 100%"
v-model="teamsForm.typeId"
placeholder="请选择社团类型"
>
<el-option
v-for="(item, index) in teamTypes" <!-- 遍历社团类型 -->
:key="index" <!-- 唯一键 -->
:label="item.name" <!-- 显示的标签 -->
:value="item.id" <!-- 选中的值 -->
v-for="(item, index) in teamTypes"
:key="index"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="社团团长ID"> <!-- 表单项 -->
<el-form-item label="社团团长ID">
<el-input
v-model="teamsForm.manager" <!-- 双向绑定社团团长ID -->
placeholder="请输入社团管理员ID…" <!-- 输入框提示文本 -->
autocomplete="off" <!-- 关闭自动完成功能 -->
v-model="teamsForm.manager"
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" <!-- -->
<div slot="footer" class="dialog-footer">
<el-button @click="showAddFlag = false" style="font-size: 18px"
>
</el-button>
</el-button
>
<el-button
type="primary" <!-- 确定按钮类型 -->
@click="addInfo()" <!-- 点击事件添加信息 -->
type="primary"
@click="addInfo()"
style="font-size: 18px"
>
</el-button> <!-- -->
</el-button
>
</div>
</el-dialog>
<el-dialog title="修改信息" width="600px" :visible.sync="showUpdFlag"> <!-- 修改信息对话框 -->
<el-form label-width="90px" :model="teamsForm"> <!-- 表单组件 -->
<el-form-item label="社团名称"> <!-- 表单项 -->
<el-dialog title="修改信息" width="600px" :visible.sync="showUpdFlag">
<el-form label-width="90px" :model="teamsForm">
<el-form-item label="社团名称">
<el-input
v-model="teamsForm.name" <!-- 双向绑定社团名称 -->
placeholder="请输入社团名称…" <!-- 输入框提示文本 -->
autocomplete="off" <!-- 关闭自动完成功能 -->
v-model="teamsForm.name"
placeholder="请输入社团名称…"
autocomplete="off"
></el-input>
</el-form-item>
<el-form-item label="社团类型"> <!-- 表单项 -->
<el-form-item label="社团类型">
<el-select
style="width: 100%" <!-- 下拉框样式 -->
v-model="teamsForm.typeId" <!-- 双向绑定社团类型 -->
placeholder="请选择社团类型" <!-- 下拉框提示文本 -->
style="width: 100%"
v-model="teamsForm.typeId"
placeholder="请选择社团类型"
>
<el-option
v-for="(item, index) in teamTypes" <!-- 遍历社团类型 -->
:key="index" <!-- 唯一键 -->
:label="item.name" <!-- 显示的标签 -->
:value="item.id" <!-- 选中的值 -->
v-for="(item, index) in teamTypes"
:key="index"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="社团团长ID"> <!-- 表单项 -->
<el-form-item label="社团团长ID">
<el-input
v-model="teamsForm.manager" <!-- 双向绑定社团团长ID -->
placeholder="请输入社团管理员ID…" <!-- 输入框提示文本 -->
autocomplete="off" <!-- 关闭自动完成功能 -->
v-model="teamsForm.manager"
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" <!-- -->
<div slot="footer" class="dialog-footer">
<el-button @click="showUpdFlag = false" style="font-size: 18px"
>
</el-button>
</el-button
>
<el-button
type="primary" <!-- 确定按钮类型 -->
@click="updInfo()" <!-- 点击事件更新信息 -->
type="primary"
@click="updInfo()"
style="font-size: 18px"
>
</el-button> <!-- -->
</el-button
>
</div>
</el-dialog>
</div>
@ -240,190 +250,193 @@
<script>
import {
getAllTypes, // API
getPageTeams, // API
getLoginUser, // API
addTeams, // API
updTeams, // API
delTeams, // API
addApplyLogs, // API
} from "../../api"; // API
getAllTypes,
getPageTeams,
getLoginUser,
addTeams,
updTeams,
delTeams,
addApplyLogs,
} from "../../api";
export default {
data() {
return {
teamTypes: [], //
userType: "", //
pageInfos: [], //
pageIndex: 1, //
pageSize: 10, //
pageTotal: 0, //
totalInfo: 0, //
loading: true, //
showAddFlag: false, //
showUpdFlag: false, //
qryForm: { //
name: "", //
typeId: "", // ID
token: this.$store.state.token, // token
teamTypes: [],
userType: "",
pageInfos: [],
pageIndex: 1,
pageSize: 10,
pageTotal: 0,
totalInfo: 0,
loading: true,
showAddFlag: false,
showUpdFlag: false,
qryForm: {
name: "",
typeId: "",
token: this.$store.state.token,
},
teamsForm: { //
id: "", // ID
name: "", //
total: 1, //
manager: "", // ID
typeId: "", // ID
teamsForm: {
id: "",
name: "",
total: 1,
manager: "",
typeId: "",
},
};
},
methods: {
getPageInfo(pageIndex, pageSize) { //
getPageInfo(pageIndex, pageSize) {
getPageTeams(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.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; //
this.loading = false;
}
);
},
getPageLikeInfo() { //
getPageLikeInfo() {
getPageTeams(
1, //
this.pageSize, //
this.qryForm.token, // token
this.qryForm.name, //
this.qryForm.typeId // ID
1,
this.pageSize,
this.qryForm.token,
this.qryForm.name,
this.qryForm.typeId
).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; //
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) { //
handleSizeChange(pageSize) {
this.getPageInfo(
this.pageIndex, //
pageSize, //
this.qryForm.token, // token
this.qryForm.name, //
this.qryForm.typeId // ID
this.pageIndex,
pageSize,
this.qryForm.token,
this.qryForm.name,
this.qryForm.typeId
);
},
handleCurrentChange(pageIndex) { //
handleCurrentChange(pageIndex) {
this.getPageInfo(
pageIndex, //
this.pageSize, //
this.qryForm.token, // token
this.qryForm.name, //
this.qryForm.typeId // ID
pageIndex,
this.pageSize,
this.qryForm.token,
this.qryForm.name,
this.qryForm.typeId
);
},
initForm() { //
initForm() {
this.teamsForm = {
id: "", // ID
name: "", //
total: 1, //
manager: "", // ID
typeId: "", // ID
id: "",
name: "",
total: 1,
manager: "",
typeId: "",
};
},
showAddWin() { //
this.initForm(); //
this.showAddFlag = true; //
showAddWin() {
this.initForm();
this.showAddFlag = true;
},
showUpdWin(row) { //
this.teamsForm = row; //
this.showUpdFlag = true; //
showUpdWin(row) {
this.teamsForm = row;
this.showUpdFlag = true;
},
addInfo() { //
addInfo() {
addTeams(this.teamsForm).then((resp) => {
if (resp.code == 0) { //
if (resp.code == 0) {
this.$message({
message: resp.msg, //
type: "success", //
message: resp.msg,
type: "success",
});
this.getPageInfo(1, this.pageSize, this.qryForm.token); //
this.getPageInfo(1, this.pageSize, this.qryForm.token);
this.showAddFlag = false; //
this.showAddFlag = false;
} else {
this.$message({
message: resp.msg, //
type: "warning", //
message: resp.msg,
type: "warning",
});
}
});
},
updInfo() { //
updInfo() {
updTeams(this.teamsForm).then((resp) => {
this.$message({
message: resp.msg, //
type: "success", //
message: resp.msg,
type: "success",
});
this.getPageInfo(1, this.pageSize, this.qryForm.token); //
this.getPageInfo(1, this.pageSize, this.qryForm.token);
this.showUpdFlag = false; //
this.showUpdFlag = false;
});
},
delInfo(id) { //
this.$confirm("即将删除相关信息, 是否继续?", "提示", { //
confirmButtonText: "确定", //
cancelButtonText: "取消", //
type: "warning", //
delInfo(id) {
this.$confirm("即将删除相关信息, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
delTeams(id).then((resp) => { // API
delTeams(id).then((resp) => {
this.$message({
message: resp.msg, //
type: "success", //
message: resp.msg,
type: "success",
});
this.getPageInfo(1, this.pageSize, this.qryForm.token); //
this.getPageInfo(1, this.pageSize, this.qryForm.token);
});
});
},
apply(id) { //
this.$confirm("确认申请加入社团吗", "提示", { //
confirmButtonText: "确定", //
cancelButtonText: "取消", //
type: "warning", //
apply(id) {
this.$confirm("确认申请加入社团吗", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
addApplyLogs({ //
teamId: id, // ID
status: 0, //
token: this.$store.state.token, // token
addApplyLogs({
teamId: id,
status: 0,
token: this.$store.state.token,
}).then((resp) => {
if (resp.code == 0) { //
if (resp.code == 0) {
this.$message({
message: "申请已提交,请耐心等待", //
type: "success", //
message: "申请已提交,请耐心等待",
type: "success",
});
this.getPageInfo(1, this.pageSize, this.qryForm.token); //
this.getPageInfo(1, this.pageSize, this.qryForm.token);
} else {
this.$message({
message: resp.msg, //
type: "warning", //
message: resp.msg,
type: "warning",
});
}
});
});
},
},
mounted() { //
this.getPageInfo(1, this.pageSize, this.qryForm.token); //
mounted() {
this.getPageInfo(1, this.pageSize, this.qryForm.token);
getAllTypes().then((resp) => { //
this.teamTypes = resp.data; //
getAllTypes().then((resp) => {
this.teamTypes = resp.data;
});
getLoginUser(this.$store.state.token).then((resp) => { //
this.userType = resp.data.type; //
getLoginUser(this.$store.state.token).then((resp) => {
this.userType = resp.data.type;
});
},
};

Loading…
Cancel
Save