计算机毕业设计 SpringBoot的医院门诊在线挂号系统 Javaweb项目 Java实战项目 前后端分离 文档报告 代码讲解 安装调试

本文主要是介绍计算机毕业设计 SpringBoot的医院门诊在线挂号系统 Javaweb项目 Java实战项目 前后端分离 文档报告 代码讲解 安装调试,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

🍊作者:计算机编程-吉哥
🍊简介:专业从事JavaWeb程序开发,微信小程序开发,定制化项目、 源码、代码讲解、文档撰写、ppt制作。做自己喜欢的事,生活就是快乐的。
🍊心愿:点赞 👍 收藏 ⭐评论 📝
🍅 文末获取源码联系

👇🏻 精彩专栏推荐订阅 👇🏻 不然下次找不到哟~
Java毕业设计项目~热门选题推荐《1000套》

目录

1.技术选型

2.数据库表结构

3.开发工具

4.功能

4.1【角色】

4.2【前台功能模块】

4.3【后台功能模块】

5.项目演示截图

5.1 首页

5.2 挂号

5.3 个人中心

5.4 药品详情

5.5 购物车

5.6 挂号管理

5.7 论坛管理

5.8 药品管理

6.数据库文件设计

7.核心代码 

7.1 Controller

7.2 Service

7.3 ServiceImpl

7.4 DAO

8.参考文档


1.技术选型

springboot、mybatisplus、vue、elementui、html、css、js、mysql、jdk1.8

2.数据库表结构

16张 

3.开发工具

idea、navicat

4.功能

4.1【角色】

管理员、用户、医生

4.2【前台功能模块】

  • 登录注册
  • 首页
  • 论坛
  • 公告信息
  • 药品
  • 医生
  • 个人中心
  • 购物车

4.3【后台功能模块】

  • 登录
  • 首页
  • 个人中心
  • 管理员管理
  • 用户管理
  • 医生管理
  • 挂号管理
  • 药品管理
  • 基础数据管理
  • 论坛管理
  • 公告信息管理
  • 轮播图信息

5.项目演示截图

5.1 首页

5.2 挂号

 

5.3 个人中心

 

5.4 药品详情

 

5.5 购物车

 

5.6 挂号管理

 

5.7 论坛管理

 

5.8 药品管理

 

6.数据库文件设计


CREATE TABLE `address` (`id` int(20) NOT NULL AUTO_INCREMENT COMMENT '主键 ',`yonghu_id` int(20) NOT NULL COMMENT '创建用户',`address_name` varchar(200) NOT NULL COMMENT '收货人 ',`address_phone` varchar(200) NOT NULL COMMENT '电话 ',`address_dizhi` varchar(200) NOT NULL COMMENT '地址 ',`isdefault_types` int(11) NOT NULL COMMENT '是否默认地址 ',`insert_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间',`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间 show3',PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8 COMMENT='收货地址';CREATE TABLE `cart` (`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',`yonghu_id` int(11) DEFAULT NULL COMMENT '所属用户',`yaopin_id` int(11) DEFAULT NULL COMMENT '药品',`buy_number` int(11) DEFAULT NULL COMMENT '购买数量',`create_time` timestamp NULL DEFAULT NULL COMMENT '添加时间',`update_time` timestamp NULL DEFAULT NULL COMMENT '更新时间',`insert_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='购物车';CREATE TABLE `config` (`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',`name` varchar(100) DEFAULT NULL COMMENT '配置参数名称',`value` varchar(100) DEFAULT NULL COMMENT '配置参数值',PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='配置文件';CREATE TABLE `dictionary` (`id` bigint(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=33 DEFAULT CHARSET=utf8 COMMENT='字典';CREATE TABLE `forum` (`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',`forum_name` varchar(200) DEFAULT NULL COMMENT '帖子标题  Search111 ',`yonghu_id` int(11) DEFAULT NULL COMMENT '用户',`yisheng_id` int(11) DEFAULT NULL COMMENT '医生',`users_id` int(11) DEFAULT NULL COMMENT '管理员',`forum_content` longtext COMMENT '发布内容',`super_ids` int(11) DEFAULT NULL COMMENT '父id',`forum_state_types` int(11) DEFAULT NULL COMMENT '帖子状态',`insert_time` timestamp NULL DEFAULT NULL COMMENT '发帖时间',`update_time` timestamp NULL DEFAULT NULL COMMENT '修改时间',`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show2',PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=18 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` longtext COMMENT '公告详情',`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 nameShow',PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 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 `yaopin_collection` (`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',`yaopin_id` int(11) DEFAULT NULL COMMENT '药品',`yonghu_id` int(11) DEFAULT NULL COMMENT '用户',`yaopin_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=18 DEFAULT CHARSET=utf8 COMMENT='药品收藏';CREATE TABLE `yaopin_commentback` (`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',`yaopin_id` int(11) DEFAULT NULL COMMENT '药品',`yonghu_id` int(11) DEFAULT NULL COMMENT '用户',`yaopin_commentback_text` longtext COMMENT '评价内容',`insert_time` timestamp NULL DEFAULT NULL COMMENT '评价时间',`reply_text` longtext COMMENT '回复内容',`update_time` timestamp NULL DEFAULT NULL COMMENT '回复时间',`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show3 listShow',PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8 COMMENT='药品评价';CREATE TABLE `yisheng_collection` (`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',`yisheng_id` int(11) DEFAULT NULL COMMENT '医生',`yonghu_id` int(11) DEFAULT NULL COMMENT '用户',`yisheng_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=15 DEFAULT CHARSET=utf8 COMMENT='医生收藏';CREATE TABLE `yisheng_commentback` (`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',`yisheng_id` int(11) DEFAULT NULL COMMENT '医生',`yonghu_id` int(11) DEFAULT NULL COMMENT '用户',`yisheng_commentback_text` longtext COMMENT '评价内容',`insert_time` timestamp NULL DEFAULT NULL COMMENT '评价时间',`reply_text` longtext COMMENT '回复内容',`update_time` timestamp NULL DEFAULT NULL COMMENT '回复时间',`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show3 listShow',PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8 COMMENT='医生评价';CREATE TABLE `yisheng_yuyue` (`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',`yisheng_id` int(11) DEFAULT NULL COMMENT '医生',`yonghu_id` int(11) DEFAULT NULL COMMENT '用户',`yisheng_yuyue_time` timestamp NULL DEFAULT NULL COMMENT '挂号时间 Search111',`yisheng_yuyue_text` longtext COMMENT '备注',`yisheng_yuyue_types` int(11) DEFAULT NULL COMMENT '挂号状态',`insert_time` timestamp NULL DEFAULT NULL COMMENT '添加时间',`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show3 listShow',PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=19 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 ',`yonghu_phone` varchar(200) DEFAULT NULL COMMENT '用户手机号',`yonghu_id_number` varchar(200) DEFAULT NULL COMMENT '用户身份证号',`yonghu_photo` varchar(200) DEFAULT NULL COMMENT '用户头像',`sex_types` int(11) DEFAULT NULL COMMENT '性别 Search111',`yonghu_email` varchar(200) DEFAULT NULL COMMENT '用户邮箱',`new_money` decimal(10,2) DEFAULT NULL COMMENT '余额 ',`yonghu_delete` int(11) DEFAULT NULL COMMENT '逻辑删除',`insert_time` timestamp NULL DEFAULT NULL COMMENT '添加时间',`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='用户';

7.核心代码 

7.1 Controller


package com.controller;/*** 药品* 后端接口* @author 计算机编程-吉哥* @email
*/
@RestController
@Controller
@RequestMapping("/yaopin")
public class YaopinController {private static final Logger logger = LoggerFactory.getLogger(YaopinController.class);private static final String TABLE_NAME = "yaopin";@Autowiredprivate YaopinService yaopinService;@Autowiredprivate TokenService tokenService;@Autowiredprivate AddressService addressService;//收货地址@Autowiredprivate CartService cartService;//购物车@Autowiredprivate DictionaryService dictionaryService;//字典@Autowiredprivate ForumService forumService;//论坛@Autowiredprivate NewsService newsService;//公告信息@Autowiredprivate YaopinCollectionService yaopinCollectionService;//药品收藏@Autowiredprivate YaopinCommentbackService yaopinCommentbackService;//药品评价@Autowiredprivate YaopinOrderService yaopinOrderService;//药品订单@Autowiredprivate YishengService yishengService;//医生@Autowiredprivate YishengCollectionService yishengCollectionService;//医生收藏@Autowiredprivate YishengCommentbackService yishengCommentbackService;//医生评价@Autowiredprivate YishengYuyueService yishengYuyueService;//挂号@Autowiredprivate YonghuService yonghuService;//用户@Autowiredprivate UsersService usersService;//管理员/*** 后端列表*/@RequestMapping("/page")public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));String role = String.valueOf(request.getSession().getAttribute("role"));if(false)return R.error(511,"永不会进入");else if("用户".equals(role))params.put("yonghuId",request.getSession().getAttribute("userId"));else if("医生".equals(role))params.put("yishengId",request.getSession().getAttribute("userId"));params.put("yaopinDeleteStart",1);params.put("yaopinDeleteEnd",1);CommonUtil.checkMap(params);PageUtils page = yaopinService.queryPage(params);//字典表数据转换List<YaopinView> list =(List<YaopinView>)page.getList();for(YaopinView 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);YaopinEntity yaopin = yaopinService.selectById(id);if(yaopin !=null){//entity转viewYaopinView view = new YaopinView();BeanUtils.copyProperties( yaopin , view );//把实体数据重构到view中//修改对应字典表字段dictionaryService.dictionaryConvert(view, request);return R.ok().put("data", view);}else {return R.error(511,"查不到数据");}}/*** 后端保存*/@RequestMapping("/save")public R save(@RequestBody YaopinEntity yaopin, HttpServletRequest request){logger.debug("save方法:,,Controller:{},,yaopin:{}",this.getClass().getName(),yaopin.toString());String role = String.valueOf(request.getSession().getAttribute("role"));if(false)return R.error(511,"永远不会进入");Wrapper<YaopinEntity> queryWrapper = new EntityWrapper<YaopinEntity>().eq("yaopin_name", yaopin.getYaopinName()).eq("zan_number", yaopin.getZanNumber()).eq("cai_number", yaopin.getCaiNumber()).eq("yaopin_types", yaopin.getYaopinTypes()).eq("yaopin_kucun_number", yaopin.getYaopinKucunNumber()).eq("shangxia_types", yaopin.getShangxiaTypes()).eq("yaopin_delete", 1);logger.info("sql语句:"+queryWrapper.getSqlSegment());YaopinEntity yaopinEntity = yaopinService.selectOne(queryWrapper);if(yaopinEntity==null){yaopin.setYaopinClicknum(1);yaopin.setShangxiaTypes(1);yaopin.setYaopinDelete(1);yaopin.setInsertTime(new Date());yaopin.setCreateTime(new Date());yaopinService.insert(yaopin);return R.ok();}else {return R.error(511,"表中有相同数据");}}/*** 后端修改*/@RequestMapping("/update")public R update(@RequestBody YaopinEntity yaopin, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {logger.debug("update方法:,,Controller:{},,yaopin:{}",this.getClass().getName(),yaopin.toString());YaopinEntity oldYaopinEntity = yaopinService.selectById(yaopin.getId());//查询原先数据String role = String.valueOf(request.getSession().getAttribute("role"));
//        if(false)
//            return R.error(511,"永远不会进入");if("".equals(yaopin.getYaopinPhoto()) || "null".equals(yaopin.getYaopinPhoto())){yaopin.setYaopinPhoto(null);}yaopinService.updateById(yaopin);//根据id更新return R.ok();}/*** 删除*/@RequestMapping("/delete")public R delete(@RequestBody Integer[] ids, HttpServletRequest request){logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());List<YaopinEntity> oldYaopinList =yaopinService.selectBatchIds(Arrays.asList(ids));//要删除的数据ArrayList<YaopinEntity> list = new ArrayList<>();for(Integer id:ids){YaopinEntity yaopinEntity = new YaopinEntity();yaopinEntity.setId(id);yaopinEntity.setYaopinDelete(2);list.add(yaopinEntity);}if(list != null && list.size() >0){yaopinService.updateBatchById(list);}return R.ok();}/*** 批量上传*/@RequestMapping("/batchInsert")public R save( String fileName, HttpServletRequest request){logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);Integer yonghuId = Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId")));SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//.eq("time", new SimpleDateFormat("yyyy-MM-dd").format(new Date()))try {List<YaopinEntity> yaopinList = new ArrayList<>();//上传的东西Map<String, List<String>> 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<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件dataList.remove(0);//删除第一行,因为第一行是提示for(List<String> data:dataList){//循环YaopinEntity yaopinEntity = new YaopinEntity();yaopinList.add(yaopinEntity);//把要查询是否重复的字段放入map中//药品编号if(seachFields.containsKey("yaopinUuidNumber")){List<String> yaopinUuidNumber = seachFields.get("yaopinUuidNumber");yaopinUuidNumber.add(data.get(0));//要改的}else{List<String> yaopinUuidNumber = new ArrayList<>();yaopinUuidNumber.add(data.get(0));//要改的seachFields.put("yaopinUuidNumber",yaopinUuidNumber);}}//查询是否重复//药品编号List<YaopinEntity> yaopinEntities_yaopinUuidNumber = yaopinService.selectList(new EntityWrapper<YaopinEntity>().in("yaopin_uuid_number", seachFields.get("yaopinUuidNumber")).eq("yaopin_delete", 1));if(yaopinEntities_yaopinUuidNumber.size() >0 ){ArrayList<String> repeatFields = new ArrayList<>();for(YaopinEntity s:yaopinEntities_yaopinUuidNumber){repeatFields.add(s.getYaopinUuidNumber());}return R.error(511,"数据库的该表中的 [药品编号] 字段已经存在 存在数据为:"+repeatFields.toString());}yaopinService.insertBatch(yaopinList);return R.ok();}}}}catch (Exception e){e.printStackTrace();return R.error(511,"批量插入数据异常,请联系管理员");}}/*** 个性推荐*/@IgnoreAuth@RequestMapping("/gexingtuijian")public R gexingtuijian(@RequestParam Map<String, Object> params, HttpServletRequest request){logger.debug("gexingtuijian方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));CommonUtil.checkMap(params);List<YaopinView> returnYaopinViewList = new ArrayList<>();//查询订单Map<String, Object> params1 = new HashMap<>(params);params1.put("sort","id");params1.put("yonghuId",request.getSession().getAttribute("userId"));PageUtils pageUtils = yaopinOrderService.queryPage(params1);List<YaopinOrderView> orderViewsList =(List<YaopinOrderView>)pageUtils.getList();Map<Integer,Integer> typeMap=new HashMap<>();//购买的类型listfor(YaopinOrderView orderView:orderViewsList){Integer yaopinTypes = orderView.getYaopinTypes();if(typeMap.containsKey(yaopinTypes)){typeMap.put(yaopinTypes,typeMap.get(yaopinTypes)+1);}else{typeMap.put(yaopinTypes,1);}}List<Integer> typeList = new ArrayList<>();//排序后的有序的类型 按最多到最少typeMap.entrySet().stream().sorted((o1, o2) -> o2.getValue() - o1.getValue()).forEach(e -> typeList.add(e.getKey()));//排序Integer limit = Integer.valueOf(String.valueOf(params.get("limit")));for(Integer type:typeList){Map<String, Object> params2 = new HashMap<>(params);params2.put("yaopinTypes",type);PageUtils pageUtils1 = yaopinService.queryPage(params2);List<YaopinView> yaopinViewList =(List<YaopinView>)pageUtils1.getList();returnYaopinViewList.addAll(yaopinViewList);if(returnYaopinViewList.size()>= limit) break;//返回的推荐数量大于要的数量 跳出循环}//正常查询出来商品,用于补全推荐缺少的数据PageUtils page = yaopinService.queryPage(params);if(returnYaopinViewList.size()<limit){//返回数量还是小于要求数量int toAddNum = limit - returnYaopinViewList.size();//要添加的数量List<YaopinView> yaopinViewList =(List<YaopinView>)page.getList();for(YaopinView yaopinView:yaopinViewList){Boolean addFlag = true;for(YaopinView returnYaopinView:returnYaopinViewList){if(returnYaopinView.getId().intValue() ==yaopinView.getId().intValue()) addFlag=false;//返回的数据中已存在此商品}if(addFlag){toAddNum=toAddNum-1;returnYaopinViewList.add(yaopinView);if(toAddNum==0) break;//够数量了}}}else {returnYaopinViewList = returnYaopinViewList.subList(0, limit);}for(YaopinView c:returnYaopinViewList)dictionaryService.dictionaryConvert(c, request);page.setList(returnYaopinViewList);return R.ok().put("data", page);}/*** 前端列表*/@IgnoreAuth@RequestMapping("/list")public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));CommonUtil.checkMap(params);PageUtils page = yaopinService.queryPage(params);//字典表数据转换List<YaopinView> list =(List<YaopinView>)page.getList();for(YaopinView 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);YaopinEntity yaopin = yaopinService.selectById(id);if(yaopin !=null){//点击数量加1yaopin.setYaopinClicknum(yaopin.getYaopinClicknum()+1);yaopinService.updateById(yaopin);//entity转viewYaopinView view = new YaopinView();BeanUtils.copyProperties( yaopin , view );//把实体数据重构到view中//修改对应字典表字段dictionaryService.dictionaryConvert(view, request);return R.ok().put("data", view);}else {return R.error(511,"查不到数据");}}/*** 前端保存*/@RequestMapping("/add")public R add(@RequestBody YaopinEntity yaopin, HttpServletRequest request){logger.debug("add方法:,,Controller:{},,yaopin:{}",this.getClass().getName(),yaopin.toString());Wrapper<YaopinEntity> queryWrapper = new EntityWrapper<YaopinEntity>().eq("yaopin_name", yaopin.getYaopinName()).eq("yaopin_uuid_number", yaopin.getYaopinUuidNumber()).eq("zan_number", yaopin.getZanNumber()).eq("cai_number", yaopin.getCaiNumber()).eq("yaopin_types", yaopin.getYaopinTypes()).eq("yaopin_kucun_number", yaopin.getYaopinKucunNumber()).eq("yaopin_clicknum", yaopin.getYaopinClicknum()).eq("shangxia_types", yaopin.getShangxiaTypes()).eq("yaopin_delete", yaopin.getYaopinDelete())
//            .notIn("yaopin_types", new Integer[]{102});logger.info("sql语句:"+queryWrapper.getSqlSegment());YaopinEntity yaopinEntity = yaopinService.selectOne(queryWrapper);if(yaopinEntity==null){yaopin.setZanNumber(1);yaopin.setCaiNumber(1);yaopin.setYaopinClicknum(1);yaopin.setYaopinDelete(1);yaopin.setInsertTime(new Date());yaopin.setCreateTime(new Date());yaopinService.insert(yaopin);return R.ok();}else {return R.error(511,"表中有相同数据");}}}

7.2 Service

package com.service;import com.baomidou.mybatisplus.service.IService;
import com.utils.PageUtils;
import com.entity.YaopinEntity;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.lang.Nullable;
import java.util.List;/*** 药品 服务类*/
public interface YaopinService extends IService<YaopinEntity> {/*** @param params 查询参数* @return 带分页的查询出来的数据*/PageUtils queryPage(Map<String, Object> params);}

7.3 ServiceImpl

package com.service.impl;
/*** 药品 服务实现类*/
@Service("yaopinService")
@Transactional
public class YaopinServiceImpl extends ServiceImpl<YaopinDao, YaopinEntity> implements YaopinService {@Overridepublic PageUtils queryPage(Map<String,Object> params) {Page<YaopinView> page =new Query<YaopinView>(params).getPage();page.setRecords(baseMapper.selectListView(page,params));return new PageUtils(page);}}

7.4 DAO

package com.dao;import com.entity.YaopinEntity;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.plugins.pagination.Pagination;import org.apache.ibatis.annotations.Param;
import com.entity.view.YaopinView;/*** 药品 Dao 接口** @author */
public interface YaopinDao extends BaseMapper<YaopinEntity> {List<YaopinView> selectListView(Pagination page,@Param("params")Map<String,Object> params);}

8.参考文档

 

你可能还有感兴趣的项目👇🏻👇🏻👇🏻

更多项目推荐:计算机毕业设计项目

如果大家有任何疑虑,请在下方咨询或评论

这篇关于计算机毕业设计 SpringBoot的医院门诊在线挂号系统 Javaweb项目 Java实战项目 前后端分离 文档报告 代码讲解 安装调试的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/479081

相关文章

一文详解如何在idea中快速搭建一个Spring Boot项目

《一文详解如何在idea中快速搭建一个SpringBoot项目》IntelliJIDEA作为Java开发者的‌首选IDE‌,深度集成SpringBoot支持,可一键生成项目骨架、智能配置依赖,这篇文... 目录前言1、创建项目名称2、勾选需要的依赖3、在setting中检查maven4、编写数据源5、开启热

Python UV安装、升级、卸载详细步骤记录

《PythonUV安装、升级、卸载详细步骤记录》:本文主要介绍PythonUV安装、升级、卸载的详细步骤,uv是Astral推出的下一代Python包与项目管理器,主打单一可执行文件、极致性能... 目录安装检查升级设置自动补全卸载UV 命令总结 官方文档详见:https://docs.astral.sh/

Java对异常的认识与异常的处理小结

《Java对异常的认识与异常的处理小结》Java程序在运行时可能出现的错误或非正常情况称为异常,下面给大家介绍Java对异常的认识与异常的处理,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参... 目录一、认识异常与异常类型。二、异常的处理三、总结 一、认识异常与异常类型。(1)简单定义-什么是

Python并行处理实战之如何使用ProcessPoolExecutor加速计算

《Python并行处理实战之如何使用ProcessPoolExecutor加速计算》Python提供了多种并行处理的方式,其中concurrent.futures模块的ProcessPoolExecu... 目录简介完整代码示例代码解释1. 导入必要的模块2. 定义处理函数3. 主函数4. 生成数字列表5.

Python实例题之pygame开发打飞机游戏实例代码

《Python实例题之pygame开发打飞机游戏实例代码》对于python的学习者,能够写出一个飞机大战的程序代码,是不是感觉到非常的开心,:本文主要介绍Python实例题之pygame开发打飞机... 目录题目pygame-aircraft-game使用 Pygame 开发的打飞机游戏脚本代码解释初始化部

SpringBoot项目配置logback-spring.xml屏蔽特定路径的日志

《SpringBoot项目配置logback-spring.xml屏蔽特定路径的日志》在SpringBoot项目中,使用logback-spring.xml配置屏蔽特定路径的日志有两种常用方式,文中的... 目录方案一:基础配置(直接关闭目标路径日志)方案二:结合 Spring Profile 按环境屏蔽关

Java使用HttpClient实现图片下载与本地保存功能

《Java使用HttpClient实现图片下载与本地保存功能》在当今数字化时代,网络资源的获取与处理已成为软件开发中的常见需求,其中,图片作为网络上最常见的资源之一,其下载与保存功能在许多应用场景中都... 目录引言一、Apache HttpClient简介二、技术栈与环境准备三、实现图片下载与保存功能1.

SpringBoot排查和解决JSON解析错误(400 Bad Request)的方法

《SpringBoot排查和解决JSON解析错误(400BadRequest)的方法》在开发SpringBootRESTfulAPI时,客户端与服务端的数据交互通常使用JSON格式,然而,JSON... 目录问题背景1. 问题描述2. 错误分析解决方案1. 手动重新输入jsON2. 使用工具清理JSON3.

java中long的一些常见用法

《java中long的一些常见用法》在Java中,long是一种基本数据类型,用于表示长整型数值,接下来通过本文给大家介绍java中long的一些常见用法,感兴趣的朋友一起看看吧... 在Java中,long是一种基本数据类型,用于表示长整型数值。它的取值范围比int更大,从-922337203685477

Nexus安装和启动的实现教程

《Nexus安装和启动的实现教程》:本文主要介绍Nexus安装和启动的实现教程,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录一、Nexus下载二、Nexus安装和启动三、关闭Nexus总结一、Nexus下载官方下载链接:DownloadWindows系统根