小工具知识网

当前位置: 首页 > 行业知识 > Java项目:37 springboot003图书个性化推荐系统的设计与实现

行业知识

Java项目:37 springboot003图书个性化推荐系统的设计与实现

2026-11-06 22:20:52 来源:互联网转载
作者主页:源码空间codegym

���介:Java领域优质创作者、Java项目、学习资料、技术互助

文中获取源码

项目介绍

springboot003图书个性化推荐系统的设计与实现

管理员:首页、个人中心、学生管理、图书分类管理、图书信息管理、图书预约管理、退换图书管理、管理员管理、留言板管理、系统管理,

学生:首页、个人中心、图书预约管理、退换图书管理、我的收藏管理,前台首页;首页、图书信息、好书推荐、留言反馈、个人中心、后台管理等功能。

JAVA语言;MYSQL数据库;Spring Boot框架

环境要求

1.运行环境:最好是java jdk1.8,我们在这个平台上运行的。其他版本理论上也可以。

2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;

3.tomcat环境:Tomcat7.x,8.X,9.x版本均可

4.硬件环境:windows7/8/10 4G内存以上;或者Mac OS;

5.是否Maven项目:是;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven.项目

6.数据库:MySql5.7/8.0等版本均可;

技术栈

运行环境:jdk8 + tomcat9 + mysql5.7 + windows10

服务端技术:Spring Boot+ Mybatis +VUE

使用说明

1.使用Navicati或者其它工具,在mysql中创建对应sq文件名称的数据库,并导入项目的sql文件;

2.使用IDEA/Eclipse/MyEclipse导入项目,修改配置,运行项目;

3.将项目中config-propertiesi配置文件中的数据库配置改为自己的配置,然后运行;

运行指导

idea导入源码空间站顶目教程说明(Vindows版)-ssm篇:

http://mtw.so/5MHvZq

源码站地址:http://codegym.top。

运行截图

文档截图

运行界面

代码

GonggaoController

package com.controller;import com.alibaba.fastjson.JSONObject;import com.baomidou.mybatisplus.mapper.EntityWrapper;import com.baomidou.mybatisplus.mapper.Wrapper;import com.entity.GonggaoEntity;import com.entity.view.GonggaoView;import com.service.DictionaryService;import com.service.GonggaoService;import com.service.TokenService;import com.utils.PageUtils;import com.utils.R;import com.utils.StringUtil;import org.slf4j.Logger;import org.slf4j.LoggerFactory;import org.springframework.beans.BeanUtils;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.*;import javax.servlet.http.HttpServletRequest;import java.util.Arrays;import java.util.Date;import java.util.List;import java.util.Map;/** * 公告 * 后端接口 * @author * @email*/@RestController@Controller@RequestMapping("/gonggao")public class GonggaoController {    private static final Logger logger = LoggerFactory.getLogger(GonggaoController.class);    @Autowired    private GonggaoService gonggaoService;    @Autowired    private TokenService tokenService;    @Autowired    private DictionaryService dictionaryService;    //级联表service    /**    * 后端列表    */    @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.isNotEmpty(role) && "用户".equals(role)){            params.put("yonghuId",request.getSession().getAttribute("userId"));        }        params.put("orderBy","id");        PageUtils page = gonggaoService.queryPage(params);        //字典表数据转换        List list =(List)page.getList();        for(GonggaoView c:list){            //修改对应字典表字段            dictionaryService.dictionaryConvert(c);        }        return R.ok().put("data", page);    }    /**    * 后端详情    */    @RequestMapping("/info/{id}")    public R info(@PathVariable("id") Long id){        logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);        GonggaoEntity gonggao = gonggaoService.selectById(id);        if(gonggao !=null){            //entity转view            GonggaoView view = new GonggaoView();            BeanUtils.copyProperties( gonggao , view );//把实体数据重构到view中            //修改对应字典表字段            dictionaryService.dictionaryConvert(view);            return R.ok().put("data", view);        }else {            return R.error(511,"查不到数据");        }    }    /**    * 后端保存    */    @RequestMapping("/save")    public R save(@RequestBody GonggaoEntity gonggao, HttpServletRequest request){        logger.debug("save方法:,,Controller:{},,gonggao:{}",this.getClass().getName(),gonggao.toString());        Wrapper queryWrapper = new EntityWrapper()            .eq("gonggao_name", gonggao.getGonggaoName())            .eq("gonggao_types", gonggao.getGonggaoTypes())            ;        logger.info("sql语句:"+queryWrapper.getSqlSegment());        GonggaoEntity gonggaoEntity = gonggaoService.selectOne(queryWrapper);        if(gonggaoEntity==null){            gonggao.setInsertTime(new Date());            gonggao.setCreateTime(new Date());        //  String role = String.valueOf(request.getSession().getAttribute("role"));        //  if("".equals(role)){        //      gonggao.set        //  }            gonggaoService.insert(gonggao);            return R.ok();        }else {            return R.error(511,"表中有相同数据");        }    }    /**    * 后端修改    */    @RequestMapping("/update")    public R update(@RequestBody GonggaoEntity gonggao, HttpServletRequest request){        logger.debug("update方法:,,Controller:{},,gonggao:{}",this.getClass().getName(),gonggao.toString());        //根据字段查询是否有相同数据        Wrapper queryWrapper = new EntityWrapper()            .notIn("id",gonggao.getId())            .andNew()            .eq("gonggao_name", gonggao.getGonggaoName())            .eq("gonggao_types", gonggao.getGonggaoTypes())            ;        logger.info("sql语句:"+queryWrapper.getSqlSegment());        GonggaoEntity gonggaoEntity = gonggaoService.selectOne(queryWrapper);        if(gonggaoEntity==null){            //  String role = String.valueOf(request.getSession().getAttribute("role"));            //  if("".equals(role)){            //      gonggao.set            //  }            gonggaoService.updateById(gonggao);//根据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());        gonggaoService.deleteBatchIds(Arrays.asList(ids));        return R.ok();    }}

上一篇:服务器黄了怎么办?

下一篇:C# ASP.NET Core Web API 身份授权(JWT)验证(一)