本文主要是介绍计算机毕业设计 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 管理员端功能
6.数据库文件设计
7.核心代码
7.1 ShangjiaController
7.2 ShangjiaService
7.3 ShangjiaServiceImpl
7.4 ShangjiaDAO
8.参考文档
1.技术选型
springboot、mybatisplus、vue、elementui、html、css、js、mysql、jdk1.8
2.数据库表结构
14张
3.开发工具
idea、navicat、vscode
4.功能
4.1【角色】
管理员、用户、商家
4.2【前台功能模块】
- 登录注册
- 首页
- 公告
- 商家
- 商品
- 个人中心
- 购物车
4.3【后台功能模块】
- 登录
- 首页
- 个人中心
- 管理员管理
- 商家管理
- 用户管理
- 商品管理
- 用户咨询管理
- 公告管理
- 基础数据管理
- 轮播图管理
5.项目演示截图
5.1 前台首页
5.2 商品详情
5.3 公告
5.4 确认下单
5.5 个人中心
5.6 商家端功能
5.7 管理员端功能
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 '所属用户',`shangpin_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`)
) 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=4 DEFAULT CHARSET=utf8 COMMENT='配置文件';CREATE TABLE `gonggao` (`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',`gonggao_name` varchar(200) DEFAULT NULL COMMENT '公告名称 Search111 ',`gonggao_photo` varchar(200) DEFAULT NULL COMMENT '公告图片 ',`gonggao_types` int(11) NOT NULL COMMENT '公告类型 Search111 ',`insert_time` timestamp NULL DEFAULT NULL COMMENT '公告发布时间 ',`gonggao_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 `shangjia` (`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',`username` varchar(200) DEFAULT NULL COMMENT '账户 ',`password` varchar(200) DEFAULT NULL COMMENT '密码 ',`shangjia_name` varchar(200) DEFAULT NULL COMMENT '商家名称 Search111 ',`shangjia_phone` varchar(200) DEFAULT NULL COMMENT '联系方式',`shangjia_email` varchar(200) DEFAULT NULL COMMENT '邮箱',`shangjia_photo` varchar(200) DEFAULT NULL COMMENT '营业执照展示 ',`shangjia_xingji_types` int(11) DEFAULT NULL COMMENT '商家信用类型',`new_money` decimal(10,2) DEFAULT NULL COMMENT '现有余额',`shangjia_content` longtext COMMENT '商家介绍 ',`shangjia_delete` int(11) DEFAULT NULL COMMENT '逻辑删除',`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 photoShow ',PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='商家';CREATE TABLE `shangpin_collection` (`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',`shangpin_id` int(11) DEFAULT NULL COMMENT '商品',`yonghu_id` int(11) DEFAULT NULL COMMENT '用户',`shangpin_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=16 DEFAULT CHARSET=utf8 COMMENT='商品收藏';CREATE TABLE `shangpin_commentback` (`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',`shangpin_id` int(11) DEFAULT NULL COMMENT '商品',`yonghu_id` int(11) DEFAULT NULL COMMENT '用户',`shangpin_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 '创建时间',PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=16 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=4 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`)
) 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 '性别',`new_money` decimal(10,2) DEFAULT NULL COMMENT '余额 ',`yonghu_email` varchar(200) 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 ShangjiaController
package com.controller;/*** 商家* 后端接口* @author 计算机编程-吉哥* @email
*/
@RestController
@Controller
@RequestMapping("/shangjia")
public class ShangjiaController {private static final Logger logger = LoggerFactory.getLogger(ShangjiaController.class);private static final String TABLE_NAME = "shangjia";@Autowiredprivate ShangjiaService shangjiaService;@Autowiredprivate TokenService tokenService;@Autowiredprivate AddressService addressService;//收货地址@Autowiredprivate CartService cartService;//购物车@Autowiredprivate DictionaryService dictionaryService;//字典@Autowiredprivate GonggaoService gonggaoService;//公告@Autowiredprivate ShangpinService shangpinService;//商品@Autowiredprivate ShangpinChatService shangpinChatService;//用户咨询@Autowiredprivate ShangpinCollectionService shangpinCollectionService;//商品收藏@Autowiredprivate ShangpinCommentbackService shangpinCommentbackService;//商品评价@Autowiredprivate ShangpinOrderService shangpinOrderService;//商品订单@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("shangjiaId",request.getSession().getAttribute("userId"));params.put("shangjiaDeleteStart",1);params.put("shangjiaDeleteEnd",1);CommonUtil.checkMap(params);PageUtils page = shangjiaService.queryPage(params);//字典表数据转换List<ShangjiaView> list =(List<ShangjiaView>)page.getList();for(ShangjiaView 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);ShangjiaEntity shangjia = shangjiaService.selectById(id);if(shangjia !=null){//entity转viewShangjiaView view = new ShangjiaView();BeanUtils.copyProperties( shangjia , view );//把实体数据重构到view中//修改对应字典表字段dictionaryService.dictionaryConvert(view, request);return R.ok().put("data", view);}else {return R.error(511,"查不到数据");}}/*** 后端保存*/@RequestMapping("/save")public R save(@RequestBody ShangjiaEntity shangjia, HttpServletRequest request){logger.debug("save方法:,,Controller:{},,shangjia:{}",this.getClass().getName(),shangjia.toString());String role = String.valueOf(request.getSession().getAttribute("role"));if(false)return R.error(511,"永远不会进入");Wrapper<ShangjiaEntity> queryWrapper = new EntityWrapper<ShangjiaEntity>().eq("username", shangjia.getUsername()).or().eq("shangjia_phone", shangjia.getShangjiaPhone()).andNew().eq("shangjia_delete", 1);logger.info("sql语句:"+queryWrapper.getSqlSegment());ShangjiaEntity shangjiaEntity = shangjiaService.selectOne(queryWrapper);if(shangjiaEntity==null){shangjia.setShangjiaDelete(1);shangjia.setCreateTime(new Date());shangjia.setPassword(MD5Utils.md5("123456"));shangjiaService.insert(shangjia);return R.ok();}else {return R.error(511,"账户或者联系方式已经被使用");}}/*** 后端修改*/@RequestMapping("/update")public R update(@RequestBody ShangjiaEntity shangjia, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {logger.debug("update方法:,,Controller:{},,shangjia:{}",this.getClass().getName(),shangjia.toString());ShangjiaEntity oldShangjiaEntity = shangjiaService.selectById(shangjia.getId());//查询原先数据String role = String.valueOf(request.getSession().getAttribute("role"));
// if(false)
// return R.error(511,"永远不会进入");if("".equals(shangjia.getShangjiaPhoto()) || "null".equals(shangjia.getShangjiaPhoto())){shangjia.setShangjiaPhoto(null);}shangjiaService.updateById(shangjia);//根据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<ShangjiaEntity> oldShangjiaList =shangjiaService.selectBatchIds(Arrays.asList(ids));//要删除的数据ArrayList<ShangjiaEntity> list = new ArrayList<>();for(Integer id:ids){ShangjiaEntity shangjiaEntity = new ShangjiaEntity();shangjiaEntity.setId(id);shangjiaEntity.setShangjiaDelete(2);list.add(shangjiaEntity);}if(list != null && list.size() >0){shangjiaService.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");try {List<ShangjiaEntity> shangjiaList = 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){//循环ShangjiaEntity shangjiaEntity = new ShangjiaEntity();shangjiaList.add(shangjiaEntity);//把要查询是否重复的字段放入map中//账户if(seachFields.containsKey("username")){List<String> username = seachFields.get("username");username.add(data.get(0));//要改的}else{List<String> username = new ArrayList<>();username.add(data.get(0));//要改的seachFields.put("username",username);}//联系方式if(seachFields.containsKey("shangjiaPhone")){List<String> shangjiaPhone = seachFields.get("shangjiaPhone");shangjiaPhone.add(data.get(0));//要改的}else{List<String> shangjiaPhone = new ArrayList<>();shangjiaPhone.add(data.get(0));//要改的seachFields.put("shangjiaPhone",shangjiaPhone);}}//查询是否重复//账户List<ShangjiaEntity> shangjiaEntities_username = shangjiaService.selectList(new EntityWrapper<ShangjiaEntity>().in("username", seachFields.get("username")).eq("shangjia_delete", 1));if(shangjiaEntities_username.size() >0 ){ArrayList<String> repeatFields = new ArrayList<>();for(ShangjiaEntity s:shangjiaEntities_username){repeatFields.add(s.getUsername());}return R.error(511,"数据库的该表中的 [账户] 字段已经存在 存在数据为:"+repeatFields.toString());}//联系方式List<ShangjiaEntity> shangjiaEntities_shangjiaPhone = shangjiaService.selectList(new EntityWrapper<ShangjiaEntity>().in("shangjia_phone", seachFields.get("shangjiaPhone")).eq("shangjia_delete", 1));if(shangjiaEntities_shangjiaPhone.size() >0 ){ArrayList<String> repeatFields = new ArrayList<>();for(ShangjiaEntity s:shangjiaEntities_shangjiaPhone){repeatFields.add(s.getShangjiaPhone());}return R.error(511,"数据库的该表中的 [联系方式] 字段已经存在 存在数据为:"+repeatFields.toString());}shangjiaService.insertBatch(shangjiaList);return R.ok();}}}}catch (Exception e){e.printStackTrace();return R.error(511,"批量插入数据异常,请联系管理员");}}/*** 登录*/@IgnoreAuth@RequestMapping(value = "/login")public R login(String username, String password, String captcha, HttpServletRequest request) {ShangjiaEntity shangjia = shangjiaService.selectOne(new EntityWrapper<ShangjiaEntity>().eq("username", username));if(shangjia==null || !shangjia.getPassword().equals(MD5Utils.md5(password)))return R.error("账号或密码不正确");else if(shangjia.getShangjiaDelete() != 1)return R.error("账户已被删除");String token = tokenService.generateToken(shangjia.getId(),username, "shangjia", "商家");R r = R.ok();r.put("token", token);r.put("role","商家");r.put("username",shangjia.getShangjiaName());r.put("tableName","shangjia");r.put("userId",shangjia.getId());return r;}/*** 注册*/@IgnoreAuth@PostMapping(value = "/register")public R register(@RequestBody ShangjiaEntity shangjia, HttpServletRequest request) {
// ValidatorUtils.validateEntity(user);Wrapper<ShangjiaEntity> queryWrapper = new EntityWrapper<ShangjiaEntity>().eq("username", shangjia.getUsername()).or().eq("shangjia_phone", shangjia.getShangjiaPhone()).andNew().eq("shangjia_delete", 1);ShangjiaEntity shangjiaEntity = shangjiaService.selectOne(queryWrapper);if(shangjiaEntity != null)return R.error("账户或者联系方式已经被使用");shangjia.setPassword(MD5Utils.md5(shangjia.getPassword()));shangjia.setShangjiaXingjiTypes(1);shangjia.setNewMoney(0.0);shangjia.setShangjiaDelete(1);shangjia.setCreateTime(new Date());shangjiaService.insert(shangjia);return R.ok();}/*** 重置密码*/@GetMapping(value = "/resetPassword")public R resetPassword(Integer id, HttpServletRequest request) {ShangjiaEntity shangjia = shangjiaService.selectById(id);shangjia.setPassword(MD5Utils.md5("123456"));shangjiaService.updateById(shangjia);return R.ok();}/*** 修改密码*/@GetMapping(value = "/updatePassword")public R updatePassword(String oldPassword, String newPassword, HttpServletRequest request) {ShangjiaEntity shangjia = shangjiaService.selectById((Integer)request.getSession().getAttribute("userId"));if(newPassword == null){return R.error("新密码不能为空") ;}if(!!MD5Utils.md5(oldPassword).equals(shangjia.getPassword())){return R.error("原密码输入错误");}if(!MD5Utils.md5(newPassword).equals(shangjia.getPassword())){return R.error("新密码不能和原密码一致") ;}shangjia.setPassword(MD5Utils.md5(newPassword));shangjiaService.updateById(shangjia);return R.ok();}/*** 忘记密码*/@IgnoreAuth@RequestMapping(value = "/resetPass")public R resetPass(String username, HttpServletRequest request) {ShangjiaEntity shangjia = shangjiaService.selectOne(new EntityWrapper<ShangjiaEntity>().eq("username", username));if(shangjia!=null){shangjia.setPassword(MD5Utils.md5("123456"));shangjiaService.updateById(shangjia);return R.ok();}else{return R.error("账号不存在");}}/*** 获取用户的session用户信息*/@RequestMapping("/session")public R getCurrShangjia(HttpServletRequest request){Integer id = (Integer)request.getSession().getAttribute("userId");ShangjiaEntity shangjia = shangjiaService.selectById(id);if(shangjia !=null){//entity转viewShangjiaView view = new ShangjiaView();BeanUtils.copyProperties( shangjia , view );//把实体数据重构到view中//修改对应字典表字段dictionaryService.dictionaryConvert(view, request);return R.ok().put("data", view);}else {return R.error(511,"查不到数据");}}/*** 退出*/@GetMapping(value = "logout")public R logout(HttpServletRequest request) {request.getSession().invalidate();return R.ok("退出成功");}/*** 前端列表*/@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 = shangjiaService.queryPage(params);//字典表数据转换List<ShangjiaView> list =(List<ShangjiaView>)page.getList();for(ShangjiaView 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);ShangjiaEntity shangjia = shangjiaService.selectById(id);if(shangjia !=null){//entity转viewShangjiaView view = new ShangjiaView();BeanUtils.copyProperties( shangjia , view );//把实体数据重构到view中//修改对应字典表字段dictionaryService.dictionaryConvert(view, request);return R.ok().put("data", view);}else {return R.error(511,"查不到数据");}}/*** 前端保存*/@RequestMapping("/add")public R add(@RequestBody ShangjiaEntity shangjia, HttpServletRequest request){logger.debug("add方法:,,Controller:{},,shangjia:{}",this.getClass().getName(),shangjia.toString());Wrapper<ShangjiaEntity> queryWrapper = new EntityWrapper<ShangjiaEntity>().eq("username", shangjia.getUsername()).or().eq("shangjia_phone", shangjia.getShangjiaPhone()).andNew().eq("shangjia_delete", 1)
// .notIn("shangjia_types", new Integer[]{102});logger.info("sql语句:"+queryWrapper.getSqlSegment());ShangjiaEntity shangjiaEntity = shangjiaService.selectOne(queryWrapper);if(shangjiaEntity==null){shangjia.setShangjiaDelete(1);shangjia.setCreateTime(new Date());shangjia.setPassword(MD5Utils.md5("123456"));shangjiaService.insert(shangjia);return R.ok();}else {return R.error(511,"账户或者联系方式已经被使用");}}}
7.2 ShangjiaService
package com.service;import com.baomidou.mybatisplus.service.IService;
import com.utils.PageUtils;
import com.entity.ShangjiaEntity;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.lang.Nullable;
import java.util.List;/*** 商家 服务类*/
public interface ShangjiaService extends IService<ShangjiaEntity> {/*** @param params 查询参数* @return 带分页的查询出来的数据*/PageUtils queryPage(Map<String, Object> params);}
7.3 ShangjiaServiceImpl
package com.service.impl;/*** 商家 服务实现类*/
@Service("shangjiaService")
@Transactional
public class ShangjiaServiceImpl extends ServiceImpl<ShangjiaDao, ShangjiaEntity> implements ShangjiaService {@Overridepublic PageUtils queryPage(Map<String,Object> params) {Page<ShangjiaView> page =new Query<ShangjiaView>(params).getPage();page.setRecords(baseMapper.selectListView(page,params));return new PageUtils(page);}}
7.4 ShangjiaDAO
package com.dao;import com.entity.ShangjiaEntity;
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.ShangjiaView;/*** 商家 Dao 接口** @author */
public interface ShangjiaDao extends BaseMapper<ShangjiaEntity> {List<ShangjiaView> selectListView(Pagination page,@Param("params")Map<String,Object> params);}
8.参考文档
你可能还有感兴趣的项目👇🏻👇🏻👇🏻
更多项目推荐:计算机毕业设计项目
如果大家有任何疑虑,请在下方咨询或评论
这篇关于计算机毕业设计 SpringBoot的二手物品交易平台 二手商城系统 Javaweb项目 Java实战项目 前后端分离 文档报告 代码讲解 安装调试的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!