当前位置: 首页 > news >正文

flash做ppt的模板下载网站网站制作长春

flash做ppt的模板下载网站,网站制作长春,友情链接买卖平台,青岛网站制作设计Vue3java开发系统组队功能 需求分析 创建用户可以创建一个队伍#xff08;一个房间队长#xff09;#xff0c;设置队伍人数#xff0c;队伍名称#xff08;标题#xff09;#xff0c;描述#xff0c;超时时间。搜索加入#xff0c;用户可以加入未满的队伍#xf…Vue3java开发系统组队功能 需求分析 创建用户可以创建一个队伍一个房间队长设置队伍人数队伍名称标题描述超时时间。搜索加入用户可以加入未满的队伍其他人未满未过期是否需要队长同意分享队伍邀请人员显示队伍人数聊天修改队伍信息退出解散 系统接口设计 判断请求参数是否为空是否登录未登录直接跳转到登录不允许创建校验信息 队伍人数大于1小于20队伍名称20队伍人数412是否公开int不穿默认位0公开如果是加密状态一定3要有密码且密码32超时时间当前时间校验用户最多创建5个队伍 插入队伍信息到队伍表插入用户 队伍关系到关系表 实现 1. 库表设计10min 数据库表设计,队伍表队伍用户表-- 队伍表 create table team (id bigint auto_increment comment idprimary key,name varchar(256) not null comment 队伍名称,description varchar(1024) null comment 描述,maxNum int default 1 not null comment 最大人数,expireTime datetime null comment 过期时间,userId bigint comment 用户id,status int default 0 not null comment 0 - 公开1 - 私有2 - 加密,password varchar(512) null comment 密码,createTime datetime default CURRENT_TIMESTAMP null comment 创建时间,updateTime datetime default CURRENT_TIMESTAMP null on update CURRENT_TIMESTAMP,isDelete tinyint default 0 not null comment 是否删除 )comment 队伍;-- 用户队伍关系表 create table user_team (id bigint auto_increment comment idprimary key,userId bigint comment 用户id,teamId bigint comment 队伍id,joinTime datetime null comment 加入时间,createTime datetime default CURRENT_TIMESTAMP null comment 创建时间,updateTime datetime default CURRENT_TIMESTAMP null on update CURRENT_TIMESTAMP,isDelete tinyint default 0 not null comment 是否删除 )comment 用户队伍关系;2. 增删改查代码实现10min 使用mybatisX-generation插件自动生成实体类服务层持久层代码队伍基本增删改查代码编写/*** 队伍接口*/ RestController RequestMapping(/team) CrossOrigin(origins {http://localhost:5173}, allowCredentials true) Slf4j //lombok的注解可以在类中使用log打日志 public class TeamController {Resourceprivate UserService userService;Resourceprivate TeamService teamService;/*** 增加队伍* param team* return*/PostMapping(/add)public BaseResponseLong addTeam(RequestBody Team team){//接收前端传来队伍的信息if(team null){throw new BusinessException(ErrorCode.PARAMS_ERROR);}boolean save teamService.save(team);//teamService继承自Iservices的接口,底层实现了serviceImpl//需要返回新生成数据的id,使用mybatis的组件回写if(!save){throw new BusinessException(ErrorCode.SYSTEM_ERROR,插入失败);}return ResultUtils.success(team.getId());}/*** 删除队伍** param id* return*/PostMapping(/delete)public BaseResponseBoolean deleteTeam(RequestBody long id){//接收前端传来队伍的信息if(id 0){throw new BusinessException(ErrorCode.PARAMS_ERROR);}boolean result teamService.removeById(id);//teamService继承自Iservices的接口,底层实现了serviceImpl//需要返回新生成数据的id,使用mybatis的组件回写if(!result){throw new BusinessException(ErrorCode.SYSTEM_ERROR,删除失败);}return ResultUtils.success(true);}/*** 改动队伍** param team* return*/PostMapping(/delete)public BaseResponseBoolean updateTeam(RequestBody Team team){//接收前端传来队伍的信息if(team null){throw new BusinessException(ErrorCode.PARAMS_ERROR);}boolean result teamService.updateById(team);//teamService继承自Iservices的接口,底层实现了serviceImpl//需要返回新生成数据的id,使用mybatis的组件回写if(!result){throw new BusinessException(ErrorCode.SYSTEM_ERROR,更新失败);}return ResultUtils.success(true);}/*** 查询队伍** param id* return*/GetMapping(/delete)public BaseResponseTeam getTeamById(RequestBody long id){//接收前端传来队伍id的信息if(id 0){throw new BusinessException(ErrorCode.PARAMS_ERROR);}Team team teamService.getById(id);//teamService继承自Iservices的接口,底层实现了serviceImpl//需要返回新生成数据的id,使用mybatis的组件回写if(team null){throw new BusinessException(ErrorCode.NULL_ERROR,数据为空);}return ResultUtils.success(team);} } 查询队伍列表功能实现 新建TeamQuery业务请求参数封装类作为作为参数 原因 1. 请求参数和实体类不一样 2. 有些参数用不到 3. 多个实体类映射到同一个字段 4. 有些字段要隐藏不返回到前端代码实现/*** 队伍查询封装类*/ EqualsAndHashCode(callSuper true) Data public class TeamQuery extends PageRequest {/*** id*/TableId(type IdType.AUTO)private Long id;/*** 队伍名称*/private String name;/*** 描述*/private String description;/*** 最大人数*/private Integer maxNum;/*** 用户id*/private Long userId;/*** 0 - 公开1 - 私有2 - 加密*/private Integer status; }实现查询队伍列表/*** 查询组队列表* param teamQuery* return*/ GetMapping(/list) //新建teamQuery业务请求参数封装类作为原因1.请求参数和实体类不一样2.有些参数用不到3.有些字段要隐藏不返回到前端 public BaseResponseListTeam listTeams(TeamQuery teamQuery){if (teamQuery null){throw new BusinessException(ErrorCode.PARAMS_ERROR);}Team team new Team();BeanUtils.copyProperties(team,teamQuery);QueryWrapperTeam queryWrapper new QueryWrapper();ListTeam teamList teamService.list(queryWrapper);return ResultUtils.success(teamList); }分页查询队伍列表功能实现 新建请求分页类/*** 分页请求类** author Erha*/ Data public class PageRequest implements Serializable {//使对象序列化保持唯一private static final long serialVersionUID -9075033996918167511L;/*** 页面大小*/protected int pageSize;/*** 当前第几页*/protected int pageNum; }分页查询队伍实现代码/*** 分页查询组队列表* param teamQuery* return*/ GetMapping(/list/page) public BaseResponsePageTeam listTeamsByPage(TeamQuery teamQuery){if(teamQuery null){throw new BusinessException(ErrorCode.PARAMS_ERROR);}Team team new Team();BeanUtils.copyProperties(team, teamQuery);//把哪个对象的字段复制到另外一个中PageTeam page new Page(teamQuery.getPageNum(), teamQuery.getPageSize());QueryWrapperTeam queryWrapper new QueryWrapper(team);PageTeam Resultpage teamService.page(page, queryWrapper);return ResultUtils.success(Resultpage);}使用Swaggerknif4j文档接口 3. 业务逻辑30min 创建队伍业务逻辑实现/** * author serendipity * description 针对表【team(队伍)】的数据库操作Service实现 * createDate 2023-11-28 19:33:44 */ Service public class TeamServiceImpl extends ServiceImplTeamMapper, Teamimplements TeamService {Resourceprivate UserTeamService userTeamService;OverrideTransactional(rollbackFor Exception.class)public long addTeam(Team team, User loginUser) {//1.请求参数是否为空if (team null) {throw new BusinessException(ErrorCode.PARAMS_ERROR);}//2.是否登录未登录不允许创建if (loginUser null) {throw new BusinessException(ErrorCode.NO_AUTH);}final long userId loginUser.getId();//3.检验信息//(1).队伍人数1且20int maxNum Optional.ofNullable(team.getMaxNum()).orElse(0);//如果为空直接赋值为0if (maxNum 1 || maxNum 20) {throw new BusinessException(ErrorCode.PARAMS_ERROR, 队伍人数不满足要求);}//(2).队伍标题 20String name team.getName();if (StringUtils.isBlank(name) || name.length() 20) {throw new BusinessException(ErrorCode.PARAMS_ERROR, 队伍标题不满足要求);}// (3) 描述 512String description team.getDescription();if (StringUtils.isNotBlank(description) description.length() 512) {throw new BusinessException(ErrorCode.PARAMS_ERROR, 队伍描述过长);}//(4)status 是否公开不传默认为0int status Optional.ofNullable(team.getStatus()).orElse(0);TeamStatusEnum statusEnum TeamStatusEnum.getEnumByValue(status);if (statusEnum null) {throw new BusinessException(ErrorCode.PARAMS_ERROR, 队伍状态不满足要求);}//(5)如果status是加密状态一定要密码 且密码32String password team.getPassword();if (TeamStatusEnum.SECRET.equals(statusEnum)) {if (StringUtils.isBlank(password) || password.length() 32) {throw new BusinessException(ErrorCode.PARAMS_ERROR, 密码设置不正确);}}//(6)超出时间 当前时间Date expireTime team.getExpireTime();if (new Date().after(expireTime)) {throw new BusinessException(ErrorCode.PARAMS_ERROR, 超出时间 当前时间);}//(7)校验用户最多创建5个队伍//todo 有bug。可能同时创建100个队伍QueryWrapperTeam queryWrapper new QueryWrapper();queryWrapper.eq(userId, userId);long hasTeamNum this.count(queryWrapper);if (hasTeamNum 5) {throw new BusinessException(ErrorCode.PARAMS_ERROR, 用户最多创建5个队伍);}//4.插入队伍消息到队伍表team.setId(null);team.setUserId(userId);boolean result this.save(team);Long teamId team.getId();if (!result || teamId null) {throw new BusinessException(ErrorCode.PARAMS_ERROR, 创建队伍失败);}//5. 插入用户 队伍关系 到关系表UserTeam userTeam new UserTeam();userTeam.setUserId(userId);userTeam.setTeamId(teamId);userTeam.setJoinTime(new Date());result userTeamService.save(userTeam);if (!result) {throw new BusinessException(ErrorCode.PARAMS_ERROR, 创建队伍失败);}return teamId;} }
http://wiki.neutronadmin.com/news/259023/

相关文章:

  • 新开传奇网站发布网中变抓取wordpress站点用户
  • 装潢设计图片大全网站整体优化
  • 天津网站设计公司江苏建设工程
  • 酒泉建设局网站买一个app需要多少钱
  • 电子商务网站系统的开发设计微信小商店开通
  • wordpress 网站同步网站建设的结构
  • 网站维护的页面宁波网络营销推广制作
  • 莒县城阳网站建设网站备案检验单
  • 新手建什么网站赚钱汕头建站免费模板
  • 网站如何做360优化彭山网站建设
  • 温州专业微网站制作多少钱网页设计策划
  • 怎么做网站的教程网站后期维护费用多少
  • 建设一个58一样的网站多少钱微信网站建设模板
  • 网站建设经营服务合同范本小说网站建设源码
  • 朔州企业网站建设建设网站的HTML代码
  • 啊里云服务器怎么做网站就业创业网站建设
  • 网站用asp还是php可以自己制作图片的软件
  • 上海市城乡住房建设厅网站高端的网站开发公司
  • 网站静态99国精产品灬源码的优势
  • 烫画图案设计网站苏州网站建设 公司
  • 上弘科技网站建设时尚字体设计网站
  • 什么网站推广比较好最新推广注册app拿佣金
  • 企业网站建设程序价格低廉换个说法
  • 网站建设文化报价网站主题风格
  • 上海最专业的网站建设公司做网站域名重要吗
  • 域名解析手机网站建设鼠标垫东莞网站建设
  • 网站建设实训报告册建材网站开发
  • 句容网站建设开发网站建设详细过程
  • 大理做网站哪家好网站投入费用
  • 网站模板手机目前最火的互联网项目