package com.controller;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import com.utils.ValidatorUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.annotation.IgnoreAuth;
import com.entity.YonghuEntity;
import com.entity.view.YonghuView;
import com.service.YonghuService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.CommonUtil;
import java.io.IOException;
/**
* 用户
* 后端接口
* @author
* @email
* @date 2023-02-20 10:05:27
*/
@RestController
@RequestMapping("/yonghu")
public class YonghuController {
@Autowired
private YonghuService yonghuService;
@Autowired
private TokenService tokenService;
/**
* 登录
*/
@IgnoreAuth
@RequestMapping(value = "/login")
public R login(String username, String password, String captcha, HttpServletRequest request) {
YonghuEntity u = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("yonghuzhanghao", username));
if(u==null || !u.getMima().equals(password)) {
return R.error("账号或密码不正确");
}
String token = tokenService.generateToken(u.getId(), username,"yonghu", "用户" );
return R.ok().put("token", token);
}
/**
* 注册
*/
@IgnoreAuth
@RequestMapping("/register")
public R register(@RequestBody YonghuEntity yonghu){
//ValidatorUtils.validateEntity(yonghu);
YonghuEntity u = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("yonghuzhanghao", yonghu.getYonghuzhanghao()));
if(u!=null) {
return R.error("注册用户已存在");
}
Long uId = new Date().getTime();
yonghu.setId(uId);
yonghuService.insert(yonghu);
return R.ok();
}
/**
* 退出
*/
@RequestMapping("/logout")
public R logout(HttpServletRequest request) {
request.getSession().invalidate();
return R.ok("退出成功");
}
/**
* 获取用户的session用户信息
*/
@RequestMapping("/session")
public R getCurrUser(HttpServletRequest request){
Long id = (Long)request.getSession().getAttribute("userId");
YonghuEntity u = yonghuService.selectById(id);
return R.ok().put("data", u);
}
/**
* 密码重置
*/
@IgnoreAuth
@RequestMapping(value = "/resetPass")
public R resetPass(String username, HttpServletRequest request){
YonghuEntity u = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("yonghuzhanghao", username));
if(u==null) {
return R.error("账号不存在");
}
u.setMima("123456");
yonghuService.updateById(u);
return R.ok("密码已重置为:123456");
}
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,YonghuEntity yonghu,
HttpServletRequest request){
EntityWrapper<YonghuEntity> ew = new EntityWrapper<YonghuEntity>();
PageUtils page = yonghuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yonghu), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,YonghuEntity yonghu,
HttpServletRequest request){
EntityWrapper<YonghuEntity> ew = new EntityWrapper<YonghuEntity>();
PageUtils page = yonghuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yonghu), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( YonghuEntity yonghu){
EntityWrapper<YonghuEntity> ew = new EntityWrapper<YonghuEntity>();
ew.allEq(MPUtil.allEQMapPre( yonghu, "yonghu"));
return R.ok().put("data", yonghuService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(YonghuEntity yonghu){
EntityWrapper< YonghuEntity> ew = new EntityWrapper< YonghuEntity>();
ew.allEq(MPUtil.allEQMapPre( yonghu, "yonghu"));
YonghuView yonghuView = yonghuService.selectView(ew);
return R.ok("查询用户成功").put("data", yonghuView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
YonghuEntity yonghu = yonghuService.selectById(id);
return R.ok().put("data", yonghu);
}
/**
* 前端详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
YonghuEntity yonghu = yonghuService.selectById(id);
return R.ok().put("data", yonghu);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody YonghuEntity yonghu, HttpServletRequest request){
yonghu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(yonghu);
YonghuEntity u = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("yonghuzhanghao", yonghu.getYonghuzhanghao()));
if(u!=null) {
return R.error("用户已存在");
}
yonghu.setId(new Date().getTime());
yonghuService.insert(yonghu);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody YonghuEntity yonghu, HttpServletRequest request){
yonghu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(yonghu);
YonghuEntity u = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("yonghuzhanghao", yonghu.getYonghuzhanghao()));
if(u!=null) {
return R.error("用户已存在");
}
yonghu.setId(new Date().getTime());
yonghuService.insert(yonghu);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
@Transactional
public R update(@RequestBody YonghuEntity yonghu, HttpServletRequest request){
//ValidatorUtils.validateEntity(yonghu);
yonghuService.updateById(yonghu);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
yonghuService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 提醒接口
*/
@RequestMapping("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type,@RequestParam Map<String, Object> map) {
map.put("column", columnName);
map.put("type", type);
if(type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
Date remindStartDate = nu
没有合适的资源?快使用搜索试试~ 我知道了~
基于SpringBoot+Vue.JS开发的儿童性教育网站 JAVA毕业设计 源码+数据库+启动教程
共589个文件
svg:161个
java:123个
vue:90个
需积分: 0 1 下载量 146 浏览量
2024-09-26
09:51:29
上传
评论
收藏 20.46MB ZIP 举报
温馨提示
项目启动教程:https://www.bilibili.com/video/BV11ktveuE2d 儿童性教育网站是一个旨在为儿童及其家长提供性教育信息和资源的平台,它使用Vue.js和SpringBoot框架进行开发。Vue.js是一个用于构建用户界面的渐进式JavaScript框架,它易于上手且灵活,非常适合用来创建动态的单页应用。SpringBoot则是一个基于Spring框架的项目,它简化了基于Spring的应用开发,提供了快速启动和开发的能力,非常适合构建后端服务。开发这样一个网站需要跨学科的团队合作,包括前端开发人员、后端开发人员、教育专家、内容创作者和安全专家,以确保网站的内容准确、安全且易于使用。
资源推荐
资源详情
资源评论
收起资源包目录
基于SpringBoot+Vue.JS开发的儿童性教育网站 JAVA毕业设计 源码+数据库+启动教程 (589个子文件)
update-password.vue.bak 3KB
main.js.bak 2KB
IndexMain.vue.bak 2KB
IndexAsideStatic.vue.bak 2KB
BreadCrumbs.vue.bak 2KB
IndexHeader.vue.bak 2KB
3-build.bat 15B
2-run.bat 14B
build.bat 14B
run.bat 14B
1-install.bat 12B
install.bat 12B
.classpath 2KB
mvnw.cmd 7KB
app.bc818a07.css 321KB
chunk-vendors.311506b8.css 242KB
app.df35059d.css 84KB
chunk-vendors.1f0a25b2.css 37KB
swiper.min.css 13KB
swiper.min.css 13KB
iconfont.css 622B
canvas-bg-1.css 391B
canvas-bg-1.css 391B
canvas-bg-2.css 83B
canvas-bg-2.css 83B
canvas-bg-4.css 61B
canvas-bg-5.css 61B
canvas-bg-3.css 61B
canvas-bg-3.css 61B
springboot44x94数据库文档.doc 958KB
.factorypath 15KB
.gitignore 364B
index.html 1KB
index.html 971B
index.html 797B
index.html 605B
favicon.ico 4KB
favicon.ico 4KB
favicon.ico 4KB
favicon.ico 4KB
maven-wrapper.jar 50KB
YonghuController.java 9KB
JiaoyuwenzhangController.java 8KB
ForumController.java 8KB
BaiduUtil.java 8KB
CommonController.java 7KB
DiscussjiaoyuwenzhangController.java 7KB
WenzhangfenleiController.java 7KB
StoreupController.java 7KB
SystemintroController.java 7KB
MessagesController.java 7KB
AboutusController.java 6KB
NewsController.java 6KB
UsersController.java 5KB
MPUtil.java 5KB
MavenWrapperDownloader.java 5KB
JiaoyuwenzhangEntity.java 4KB
FileController.java 4KB
StoreupEntity.java 4KB
ForumEntity.java 4KB
MessagesEntity.java 4KB
YonghuEntity.java 3KB
AuthorizationInterceptor.java 3KB
DiscussjiaoyuwenzhangEntity.java 3KB
SystemintroEntity.java 3KB
AboutusEntity.java 3KB
ConfigController.java 3KB
JiaoyuwenzhangModel.java 3KB
JiaoyuwenzhangVO.java 3KB
NewsEntity.java 3KB
StoreupModel.java 3KB
Query.java 3KB
StoreupVO.java 3KB
TokenServiceImpl.java 2KB
MessagesModel.java 2KB
ForumModel.java 2KB
CommonUtil.java 2KB
MessagesVO.java 2KB
ForumVO.java 2KB
DiscussjiaoyuwenzhangServiceImpl.java 2KB
TokenEntity.java 2KB
YonghuModel.java 2KB
DiscussjiaoyuwenzhangModel.java 2KB
WenzhangfenleiEntity.java 2KB
SystemintroModel.java 2KB
AboutusModel.java 2KB
WenzhangfenleiServiceImpl.java 2KB
JiaoyuwenzhangServiceImpl.java 2KB
YonghuVO.java 2KB
DiscussjiaoyuwenzhangVO.java 2KB
SystemintroVO.java 2KB
PageUtils.java 2KB
SystemintroServiceImpl.java 2KB
AboutusVO.java 2KB
MessagesServiceImpl.java 2KB
AboutusServiceImpl.java 2KB
StoreupServiceImpl.java 2KB
YonghuServiceImpl.java 2KB
ForumServiceImpl.java 2KB
NewsServiceImpl.java 2KB
共 589 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
杨荧
- 粉丝: 2w+
- 资源: 2927
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- hadoop ipc-hadoop
- bootshiro-springboot
- 微信文章爬虫 Reptile-爬虫
- AwesomeUnityTutorial-unity
- STM32多功能小车-stm32
- blog-vscode安装
- ultralytics-yolov11
- Image processing based on matlab-matlab下载
- 即用即查XML数据标记语言参考手册pdf版最新版本
- XML轻松学习教程chm版最新版本
- 《XMLHTTP对象参考手册》CHM最新版本
- 单机版锁螺丝机工程图机械结构设计图纸和其它技术资料和技术方案非常好100%好用.zip
- 注册程序示例示例示例示例示例
- 网络实践2222222
- kotlin coroutine blogs
- Windchill前端测试工具class文件
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功