🍊作者:计算机编程-吉哥
🍊简介:专业从事JavaWeb程序开发,微信小程序开发,定制化项目、 源码、代码讲解、文档撰写、ppt制作。做自己喜欢的事,生活就是快乐的。
🍊心愿:点赞 👍 收藏 ⭐评论 📝
🍅 文末获取源码联系👇🏻 精彩专栏推荐订阅 👇🏻 不然下次找不到哟~
Java毕业设计项目~热门选题推荐《1000套》
springboot、mybatisplus、vue、elementui、html、css、js、mysql、jdk1.8
14张
idea、navicat
管理员、用户
1、宠物领养管理
2、宠物领养审核管理
3、宠物认领管理
4、宠物认领审核管理
5、教学视频管理
6、宠物领养
7、宠物认领
8、教学视频
9、感谢信管理
-
- CREATE TABLE `chongwulingyang` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `chongwulingyang_name` varchar(200) DEFAULT NULL COMMENT '标题 Search111',
- `chongwulingyang_types` int(11) DEFAULT NULL COMMENT '类型 Search111',
- `chongwulingyang_photo` varchar(200) DEFAULT NULL COMMENT '宠物图片',
- `jieshu_types` int(11) DEFAULT NULL COMMENT '是否被认领',
- `chongwulingyang_content` text COMMENT '宠物详情',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 photoShow',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='宠物领养';
-
-
- CREATE TABLE `chongwulingyangshenhe` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `chongwulingyang_id` int(11) DEFAULT NULL COMMENT '宠物领养',
- `yonghu_id` int(11) DEFAULT NULL COMMENT '领养用户',
- `chongwurenlingshenhe_text` text COMMENT '认领凭据',
- `chongwulingyangshenhe_yesno_types` int(11) DEFAULT NULL COMMENT '申请状态',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show3 photoShow',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8 COMMENT='宠物领养审核';
-
-
- DROP TABLE IF EXISTS `chongwurenling`;
-
- CREATE TABLE `chongwurenling` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `chongwurenling_name` varchar(200) DEFAULT NULL COMMENT '标题 Search111',
- `chongwulingyang_types` int(11) DEFAULT NULL COMMENT '类型 Search111',
- `chongwurenling_photo` varchar(200) DEFAULT NULL COMMENT '宠物图片',
- `yonghu_id` int(11) DEFAULT NULL COMMENT '发布用户',
- `jieshu_types` int(11) DEFAULT NULL COMMENT '是否找到主人',
- `chongwurenling_content` text COMMENT '宠物详情',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 photoShow',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='宠物认领';
-
-
- CREATE TABLE `chongwurenlingshenhe` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `chongwurenling_id` int(11) DEFAULT NULL COMMENT '宠物认领',
- `yonghu_id` int(11) DEFAULT NULL COMMENT '认领用户',
- `chongwurenlingshenhe_text` text COMMENT '认领凭据',
- `chongwurenlingshenhe_yesno_types` int(11) DEFAULT NULL COMMENT '申请状态',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show3 photoShow',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='宠物认领审核';
-
-
-
- CREATE TABLE `config` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `name` varchar(100) NOT NULL COMMENT '配置参数名称',
- `value` varchar(100) DEFAULT NULL COMMENT '配置参数值',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COMMENT='配置文件';
-
-
- CREATE TABLE `dictionary` (
- `id` int(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `dic_code` varchar(200) DEFAULT NULL COMMENT '字段',
- `dic_name` varchar(200) DEFAULT NULL COMMENT '字段名',
- `code_index` int(11) DEFAULT NULL COMMENT '编码',
- `index_name` varchar(200) DEFAULT NULL COMMENT '编码名字 Search111 ',
- `super_id` int(11) DEFAULT NULL COMMENT '父字段id',
- `beizhu` varchar(200) DEFAULT NULL COMMENT '备注',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=86 DEFAULT CHARSET=utf8 COMMENT='字典表';
-
-
- CREATE TABLE `ganxiexin` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `ganxiexin_name` varchar(200) DEFAULT NULL COMMENT '标题 Search111 ',
- `yonghu_id` int(11) DEFAULT NULL COMMENT '发布用户',
- `ganxiexin_content` text COMMENT '内容',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show2 nameShow',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COMMENT='感谢信';
-
-
- CREATE TABLE `jiaoxueshipin_collection` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `jiaoxueshipin_id` int(11) DEFAULT NULL COMMENT '视频',
- `yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
- `jiaoxueshipin_collection_types` int(11) DEFAULT NULL COMMENT '类型',
- `insert_time` timestamp NULL DEFAULT NULL COMMENT '收藏时间',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show3 photoShow',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=127 DEFAULT CHARSET=utf8 COMMENT='视频收藏';
-
-
- CREATE TABLE `jiaoxueshipin_liuyan` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `jiaoxueshipin_id` int(11) DEFAULT NULL COMMENT '视频',
- `yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
- `jiaoxueshipin_liuyan_text` text COMMENT '留言内容',
- `reply_text` text COMMENT '回复内容',
- `insert_time` timestamp NULL DEFAULT NULL COMMENT '留言时间',
- `update_time` timestamp NULL DEFAULT NULL COMMENT '回复时间',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='视频留言';
-
-
-
- CREATE TABLE `news` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `news_name` varchar(200) DEFAULT NULL COMMENT '公告名称 Search111 ',
- `news_types` int(11) DEFAULT NULL COMMENT '公告类型 Search111 ',
- `news_photo` varchar(200) DEFAULT NULL COMMENT '公告图片',
- `insert_time` timestamp NULL DEFAULT NULL COMMENT '公告时间',
- `news_content` text COMMENT '公告详情',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show2 show1 nameShow',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COMMENT='公告';
-
-
- CREATE TABLE `token` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `userid` bigint(20) NOT NULL COMMENT '用户id',
- `username` varchar(100) NOT NULL COMMENT '用户名',
- `tablename` varchar(100) DEFAULT NULL COMMENT '表名',
- `role` varchar(100) DEFAULT NULL COMMENT '角色',
- `token` varchar(200) NOT NULL COMMENT '密码',
- `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '新增时间',
- `expiratedtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '过期时间',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COMMENT='token表';
-
-
- CREATE TABLE `users` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `username` varchar(100) NOT NULL COMMENT '用户名',
- `password` varchar(100) NOT NULL COMMENT '密码',
- `role` varchar(100) DEFAULT '管理员' COMMENT '角色',
- `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '新增时间',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='用户表';
-
-
-
- CREATE TABLE `yonghu` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `username` varchar(200) DEFAULT NULL COMMENT '账户',
- `password` varchar(200) DEFAULT NULL COMMENT '密码',
- `yonghu_name` varchar(200) DEFAULT NULL COMMENT '用户姓名 Search111',
- `sex_types` int(11) DEFAULT NULL COMMENT '性别 Search111',
- `yonghu_id_number` varchar(200) DEFAULT NULL COMMENT '身份证号',
- `yonghu_phone` varchar(200) DEFAULT NULL COMMENT '手机号',
- `yonghu_address` varchar(200) DEFAULT NULL COMMENT '个人地址',
- `yonghu_photo` varchar(200) DEFAULT NULL COMMENT '照片',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 ',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='用户';
-
- package com.controller;
-
- import java.io.File;
- import java.math.BigDecimal;
- import java.net.URL;
- import java.text.SimpleDateFormat;
- import com.alibaba.fastjson.JSONObject;
- import java.util.*;
- import org.springframework.beans.BeanUtils;
- import javax.servlet.http.HttpServletRequest;
- import org.springframework.web.context.ContextLoader;
- import javax.servlet.ServletContext;
- import com.service.TokenService;
- import com.utils.*;
- import java.lang.reflect.InvocationTargetException;
-
- import com.service.DictionaryService;
- import org.apache.commons.lang3.StringUtils;
- import com.annotation.IgnoreAuth;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Controller;
- import org.springframework.web.bind.annotation.*;
- import com.baomidou.mybatisplus.mapper.EntityWrapper;
- import com.baomidou.mybatisplus.mapper.Wrapper;
- import com.entity.*;
- import com.entity.view.*;
- import com.service.*;
- import com.utils.PageUtils;
- import com.utils.R;
- import com.alibaba.fastjson.*;
-
- /**
- * 宠物领养
- * 后端接口
- * @author 计算机编程-吉哥
- */
- @RestController
- @Controller
- @RequestMapping("/chongwulingyang")
- public class ChongwulingyangController {
- private static final Logger logger = LoggerFactory.getLogger(ChongwulingyangController.class);
-
- @Autowired
- private ChongwulingyangService chongwulingyangService;
-
-
- @Autowired
- private TokenService tokenService;
- @Autowired
- private DictionaryService dictionaryService;
-
- //级联表service
-
- @Autowired
- private YonghuService yonghuService;
-
-
- /**
- * 后端列表
- */
- @RequestMapping("/page")
- public R page(@RequestParam Map
params, HttpServletRequest request) { - logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
- String role = String.valueOf(request.getSession().getAttribute("role"));
- if(StringUtil.isEmpty(role))
- return R.error(511,"权限为空");
- else if("用户".equals(role))
- params.put("yonghuId",request.getSession().getAttribute("userId"));
- if(params.get("orderBy")==null || params.get("orderBy")==""){
- params.put("orderBy","id");
- }
- PageUtils page = chongwulingyangService.queryPage(params);
-
- //字典表数据转换
- List
list =(List)page.getList(); - for(ChongwulingyangView c:list){
- //修改对应字典表字段
- dictionaryService.dictionaryConvert(c, request);
- }
- return R.ok().put("data", page);
- }
-
- /**
- * 后端详情
- */
- @RequestMapping("/info/{id}")
- public R info(@PathVariable("id") Long id, HttpServletRequest request){
- logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
- ChongwulingyangEntity chongwulingyang = chongwulingyangService.selectById(id);
- if(chongwulingyang !=null){
- //entity转view
- ChongwulingyangView view = new ChongwulingyangView();
- BeanUtils.copyProperties( chongwulingyang , view );//把实体数据重构到view中
-
- //修改对应字典表字段
- dictionaryService.dictionaryConvert(view, request);
- return R.ok().put("data", view);
- }else {
- return R.error(511,"查不到数据");
- }
-
- }
-
- /**
- * 后端保存
- */
- @RequestMapping("/save")
- public R save(@RequestBody ChongwulingyangEntity chongwulingyang, HttpServletRequest request){
- logger.debug("save方法:,,Controller:{},,chongwulingyang:{}",this.getClass().getName(),chongwulingyang.toString());
-
- String role = String.valueOf(request.getSession().getAttribute("role"));
- if(StringUtil.isEmpty(role))
- return R.error(511,"权限为空");
-
- Wrapper
queryWrapper = new EntityWrapper() - .eq("chongwulingyang_name", chongwulingyang.getChongwulingyangName())
- .eq("chongwulingyang_types", chongwulingyang.getChongwulingyangTypes())
- .eq("jieshu_types", chongwulingyang.getJieshuTypes())
- ;
-
- logger.info("sql语句:"+queryWrapper.getSqlSegment());
- ChongwulingyangEntity chongwulingyangEntity = chongwulingyangService.selectOne(queryWrapper);
- if(chongwulingyangEntity==null){
- chongwulingyang.setCreateTime(new Date());
- chongwulingyangService.insert(chongwulingyang);
- return R.ok();
- }else {
- return R.error(511,"表中有相同数据");
- }
- }
-
- /**
- * 后端修改
- */
- @RequestMapping("/update")
- public R update(@RequestBody ChongwulingyangEntity chongwulingyang, HttpServletRequest request){
- logger.debug("update方法:,,Controller:{},,chongwulingyang:{}",this.getClass().getName(),chongwulingyang.toString());
-
- String role = String.valueOf(request.getSession().getAttribute("role"));
- if(StringUtil.isEmpty(role))
- return R.error(511,"权限为空");
- //根据字段查询是否有相同数据
- Wrapper
queryWrapper = new EntityWrapper() - .notIn("id",chongwulingyang.getId())
- .andNew()
- .eq("chongwulingyang_name", chongwulingyang.getChongwulingyangName())
- .eq("chongwulingyang_types", chongwulingyang.getChongwulingyangTypes())
- .eq("jieshu_types", chongwulingyang.getJieshuTypes())
- ;
-
- logger.info("sql语句:"+queryWrapper.getSqlSegment());
- ChongwulingyangEntity chongwulingyangEntity = chongwulingyangService.selectOne(queryWrapper);
- if("".equals(chongwulingyang.getChongwulingyangPhoto()) || "null".equals(chongwulingyang.getChongwulingyangPhoto())){
- chongwulingyang.setChongwulingyangPhoto(null);
- }
- if(chongwulingyangEntity==null){
- // String role = String.valueOf(request.getSession().getAttribute("role"));
- // if("".equals(role)){
- // chongwulingyang.set
- // }
- chongwulingyangService.updateById(chongwulingyang);//根据id更新
- return R.ok();
- }else {
- return R.error(511,"表中有相同数据");
- }
- }
-
- /**
- * 删除
- */
- @RequestMapping("/delete")
- public R delete(@RequestBody Integer[] ids){
- logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
- chongwulingyangService.deleteBatchIds(Arrays.asList(ids));
- return R.ok();
- }
-
- /**
- * 批量上传
- */
- @RequestMapping("/batchInsert")
- public R save( String fileName){
- logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
- try {
- List
chongwulingyangList = new ArrayList<>();//上传的东西 - Map
> seachFields= new HashMap<>();//要查询的字段 - Date date = new Date();
- int lastIndexOf = fileName.lastIndexOf(".");
- if(lastIndexOf == -1){
- return R.error(511,"该文件没有后缀");
- }else{
- String suffix = fileName.substring(lastIndexOf);
- if(!".xls".equals(suffix)){
- return R.error(511,"只支持后缀为xls的excel文件");
- }else{
- URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径
- File file = new File(resource.getFile());
- if(!file.exists()){
- return R.error(511,"找不到上传文件,请联系管理员");
- }else{
- List
> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件
- dataList.remove(0);//删除第一行,因为第一行是提示
- for(List
data:dataList){ - //循环
- ChongwulingyangEntity chongwulingyangEntity = new ChongwulingyangEntity();
- // chongwulingyangEntity.setChongwulingyangName(data.get(0)); //标题 要改的
- // chongwulingyangEntity.setChongwulingyangTypes(Integer.valueOf(data.get(0))); //类型 要改的
- // chongwulingyangEntity.setChongwulingyangPhoto("");//照片
- // chongwulingyangEntity.setJieshuTypes(Integer.valueOf(data.get(0))); //是否被认领 要改的
- // chongwulingyangEntity.setChongwulingyangContent("");//照片
- // chongwulingyangEntity.setCreateTime(date);//时间
- chongwulingyangList.add(chongwulingyangEntity);
-
-
- //把要查询是否重复的字段放入map中
- }
-
- //查询是否重复
- chongwulingyangService.insertBatch(chongwulingyangList);
- return R.ok();
- }
- }
- }
- }catch (Exception e){
- return R.error(511,"批量插入数据异常,请联系管理员");
- }
- }
-
-
-
-
- /**
- * 前端列表
- */
- @IgnoreAuth
- @RequestMapping("/list")
- public R list(@RequestParam Map
params, HttpServletRequest request) { - logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
-
- // 没有指定排序字段就默认id倒序
- if(StringUtil.isEmpty(String.valueOf(params.get("orderBy")))){
- params.put("orderBy","id");
- }
- PageUtils page = chongwulingyangService.queryPage(params);
-
- //字典表数据转换
- List
list =(List)page.getList(); - for(ChongwulingyangView c:list)
- dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段
- return R.ok().put("data", page);
- }
-
- /**
- * 前端详情
- */
- @RequestMapping("/detail/{id}")
- public R detail(@PathVariable("id") Long id, HttpServletRequest request){
- logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
- ChongwulingyangEntity chongwulingyang = chongwulingyangService.selectById(id);
- if(chongwulingyang !=null){
-
-
- //entity转view
- ChongwulingyangView view = new ChongwulingyangView();
- BeanUtils.copyProperties( chongwulingyang , view );//把实体数据重构到view中
-
- //修改对应字典表字段
- dictionaryService.dictionaryConvert(view, request);
- return R.ok().put("data", view);
- }else {
- return R.error(511,"查不到数据");
- }
- }
-
-
- /**
- * 前端保存
- */
- @RequestMapping("/add")
- public R add(@RequestBody ChongwulingyangEntity chongwulingyang, HttpServletRequest request){
- logger.debug("add方法:,,Controller:{},,chongwulingyang:{}",this.getClass().getName(),chongwulingyang.toString());
- Wrapper
queryWrapper = new EntityWrapper() - .eq("chongwulingyang_name", chongwulingyang.getChongwulingyangName())
- .eq("chongwulingyang_types", chongwulingyang.getChongwulingyangTypes())
- .eq("jieshu_types", chongwulingyang.getJieshuTypes())
- ;
- logger.info("sql语句:"+queryWrapper.getSqlSegment());
- ChongwulingyangEntity chongwulingyangEntity = chongwulingyangService.selectOne(queryWrapper);
- if(chongwulingyangEntity==null){
- chongwulingyang.setCreateTime(new Date());
- chongwulingyangService.insert(chongwulingyang);
- return R.ok();
- }else {
- return R.error(511,"表中有相同数据");
- }
- }
-
-
- }
更多项目推荐:计算机毕业设计项目
如果大家有任何疑虑,请在下方咨询或评论