🍊作者:计算机编程-吉哥
🍊简介:专业从事JavaWeb程序开发,微信小程序开发,定制化项目、 源码、代码讲解、文档撰写、ppt制作。做自己喜欢的事,生活就是快乐的。
🍊心愿:点赞 👍 收藏 ⭐评论 📝
🍅 文末获取源码联系
👇🏻 精彩专栏推荐订阅 👇🏻 不然下次找不到哟~
Java毕业设计项目~热门选题推荐《1000套》
目录
[5.1 前台首页](#5.1 前台首页)
[5.2 租房预约](#5.2 租房预约)
[5.3 论坛](#5.3 论坛)
[5.4 公告](#5.4 公告)
[5.5 投诉建议](#5.5 投诉建议)
[5.6 个人中心](#5.6 个人中心)
[5.7 个人中心-房屋租赁](#5.7 个人中心-房屋租赁)
[5.8 租房房源管理](#5.8 租房房源管理)
[5.9 租房合同管理](#5.9 租房合同管理)
[5.10 房屋租赁管理](#5.10 房屋租赁管理)
[7.1 租房合同Controller](#7.1 租房合同Controller)
[7.2 租房合同Service](#7.2 租房合同Service)
[7.3 租房合同ServiceImpl](#7.3 租房合同ServiceImpl)
[7.4 租房合同DAO](#7.4 租房合同DAO)
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 个人中心-房屋租赁
5.8 租房房源管理
5.9 租房合同管理
5.10 房屋租赁管理
6.数据库文件设计
sql
CREATE TABLE `baoxiu` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',
`yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
`baoxiu_uuid_number` varchar(200) DEFAULT NULL COMMENT '报修编号',
`baoxiu_address` varchar(200) DEFAULT NULL COMMENT '报修标题 Search111 ',
`baoxiu_name` varchar(200) DEFAULT NULL COMMENT '报修位置',
`baoxiu_types` int(11) NOT NULL COMMENT '报修类型 Search111 ',
`baoxiu_content` longtext COMMENT '报修内容',
`baoxiu_money` decimal(10,2) DEFAULT NULL COMMENT '报修费用 ',
`insert_time` timestamp NULL DEFAULT NULL COMMENT '报修时间',
`baoxiu_zhuangtai_types` int(11) DEFAULT '1' COMMENT '报修状态 Search111 ',
`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show3 listShow',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=17 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=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=25 DEFAULT CHARSET=utf8 COMMENT='字典';
CREATE TABLE `fangyuan` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',
`fangyuan_name` varchar(200) DEFAULT NULL COMMENT '房源名称 Search111 ',
`fangyuan_uuid_number` varchar(200) DEFAULT NULL COMMENT '房源编号 Search111 ',
`fangyuan_photo` varchar(200) DEFAULT NULL COMMENT '房源照片',
`fangyuan_types` int(11) DEFAULT NULL COMMENT '房源类型 Search111',
`fangyuan_kucun_number` int(11) DEFAULT NULL COMMENT '可以时长/月',
`fangyuan_new_money` decimal(10,2) DEFAULT NULL COMMENT '租赁价格/月 ',
`fangyuan_content` text COMMENT '房源介绍 ',
`fangyuan_delete` int(11) DEFAULT NULL COMMENT '逻辑删除',
`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 photoShow homeMain',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8 COMMENT='租房房源';
CREATE TABLE `fangyuan_commentback` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`fangyuan_id` int(11) DEFAULT NULL COMMENT '租房',
`yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
`fangyuan_commentback_text` text COMMENT '评价内容',
`insert_time` timestamp NULL DEFAULT NULL COMMENT '评价时间',
`reply_text` text COMMENT '回复内容',
`update_time` timestamp NULL DEFAULT NULL COMMENT '回复时间',
`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show3 listShow',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8 COMMENT='租房评价';
CREATE TABLE `fangyuan_order` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`fangyuan_order_uuid_number` varchar(200) DEFAULT NULL COMMENT '订单编号 Search111 ',
`fangyuan_id` int(11) DEFAULT NULL COMMENT '房源',
`yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
`buy_number` int(11) DEFAULT NULL COMMENT '购买数量',
`fangyuan_order_time` timestamp NULL DEFAULT NULL COMMENT '预约时间',
`fangyuan_order_true_price` decimal(10,2) DEFAULT NULL COMMENT '实付价格',
`fangyuan_order_types` int(11) DEFAULT NULL COMMENT '订单类型 Search111 ',
`insert_time` timestamp NULL DEFAULT NULL COMMENT '订单创建时间',
`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show3 listShow',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='房源租赁';
CREATE TABLE `fangyuan_yuyue` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`fangyuan_yuyue_uuid_number` varchar(200) DEFAULT NULL COMMENT '报名唯一编号 Search111 ',
`fangyuan_id` int(11) DEFAULT NULL COMMENT '房源',
`yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
`fangyuan_yuyue_text` text COMMENT '报名理由',
`fangyuan_yuyue_yesno_types` int(11) DEFAULT NULL COMMENT '报名状态 Search111 ',
`fangyuan_yuyue_yesno_text` text COMMENT '审核回复',
`fangyuan_yuyue_shenhe_time` timestamp NULL DEFAULT NULL COMMENT '审核时间',
`fangyuan_yuyue_time` timestamp NULL 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=17 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 '用户',
`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=17 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 `liuyan` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',
`yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
`liuyan_name` varchar(200) DEFAULT NULL COMMENT '投诉建议标题 Search111 ',
`liuyan_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 '创建时间 show2 nameShow',
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=3 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 ',
`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='用户';
CREATE TABLE `zufanghetong` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',
`fangyuan_order_id` int(11) DEFAULT NULL COMMENT '租房订单',
`zufanghetong_name` varchar(200) DEFAULT NULL COMMENT '租房合同 Search111 ',
`zufanghetong_file` varchar(200) DEFAULT NULL COMMENT '上传租房合同',
`shoufanghetong_text` text COMMENT '备注',
`zufanghetong_delete` int(11) DEFAULT NULL COMMENT '逻辑删除',
`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show3 listShow',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8 COMMENT='租房合同';
7.核心代码
7.1 租房合同Controller
java
package com.controller;
/**
* 租房合同
* 后端接口
* @author计算机编程-吉哥
*/
@RestController
@Controller
@RequestMapping("/zufanghetong")
public class ZufanghetongController {
private static final Logger logger = LoggerFactory.getLogger(ZufanghetongController.class);
private static final String TABLE_NAME = "zufanghetong";
@Autowired
private ZufanghetongService zufanghetongService;
@Autowired
private TokenService tokenService;
@Autowired
private BaoxiuService baoxiuService;//报修
@Autowired
private DictionaryService dictionaryService;//字典
@Autowired
private FangyuanService fangyuanService;//租房房源
@Autowired
private FangyuanCommentbackService fangyuanCommentbackService;//租房评价
@Autowired
private FangyuanOrderService fangyuanOrderService;//房源租赁
@Autowired
private FangyuanYuyueService fangyuanYuyueService;//租房预约
@Autowired
private ForumService forumService;//论坛
@Autowired
private GonggaoService gonggaoService;//公告
@Autowired
private LiuyanService liuyanService;//投诉建议
@Autowired
private YonghuService yonghuService;//用户
@Autowired
private 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"));
params.put("zufanghetongDeleteStart",1);params.put("zufanghetongDeleteEnd",1);
CommonUtil.checkMap(params);
PageUtils page = zufanghetongService.queryPage(params);
//字典表数据转换
List<ZufanghetongView> list =(List<ZufanghetongView>)page.getList();
for(ZufanghetongView 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);
ZufanghetongEntity zufanghetong = zufanghetongService.selectById(id);
if(zufanghetong !=null){
//entity转view
ZufanghetongView view = new ZufanghetongView();
BeanUtils.copyProperties( zufanghetong , view );//把实体数据重构到view中
//级联表 房源租赁
//级联表
FangyuanOrderEntity fangyuanOrder = fangyuanOrderService.selectById(zufanghetong.getFangyuanOrderId());
if(fangyuanOrder != null){
BeanUtils.copyProperties( fangyuanOrder , view ,new String[]{ "id", "createTime", "insertTime", "updateTime"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表
view.setFangyuanOrderId(fangyuanOrder.getId());
}
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody ZufanghetongEntity zufanghetong, HttpServletRequest request){
logger.debug("save方法:,,Controller:{},,zufanghetong:{}",this.getClass().getName(),zufanghetong.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
if(false)
return R.error(511,"永远不会进入");
Wrapper<ZufanghetongEntity> queryWrapper = new EntityWrapper<ZufanghetongEntity>()
.eq("fangyuan_order_id", zufanghetong.getFangyuanOrderId())
.eq("zufanghetong_name", zufanghetong.getZufanghetongName())
.eq("zufanghetong_delete", zufanghetong.getZufanghetongDelete())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
ZufanghetongEntity zufanghetongEntity = zufanghetongService.selectOne(queryWrapper);
if(zufanghetongEntity==null){
zufanghetong.setZufanghetongDelete(1);
zufanghetong.setCreateTime(new Date());
zufanghetongService.insert(zufanghetong);
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
/**
* 后端修改
*/
@RequestMapping("/update")
public R update(@RequestBody ZufanghetongEntity zufanghetong, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {
logger.debug("update方法:,,Controller:{},,zufanghetong:{}",this.getClass().getName(),zufanghetong.toString());
ZufanghetongEntity oldZufanghetongEntity = zufanghetongService.selectById(zufanghetong.getId());//查询原先数据
String role = String.valueOf(request.getSession().getAttribute("role"));
if("".equals(zufanghetong.getZufanghetongFile()) || "null".equals(zufanghetong.getZufanghetongFile())){
zufanghetong.setZufanghetongFile(null);
}
zufanghetongService.updateById(zufanghetong);//根据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<ZufanghetongEntity> oldZufanghetongList =zufanghetongService.selectBatchIds(Arrays.asList(ids));//要删除的数据
ArrayList<ZufanghetongEntity> list = new ArrayList<>();
for(Integer id:ids){
ZufanghetongEntity zufanghetongEntity = new ZufanghetongEntity();
zufanghetongEntity.setId(id);
zufanghetongEntity.setZufanghetongDelete(2);
list.add(zufanghetongEntity);
}
if(list != null && list.size() >0){
zufanghetongService.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<ZufanghetongEntity> zufanghetongList = 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){
//循环
ZufanghetongEntity zufanghetongEntity = new ZufanghetongEntity();
zufanghetongList.add(zufanghetongEntity);
//把要查询是否重复的字段放入map中
}
//查询是否重复
zufanghetongService.insertBatch(zufanghetongList);
return R.ok();
}
}
}
}catch (Exception e){
e.printStackTrace();
return R.error(511,"批量插入数据异常,请联系管理员");
}
}
/**
* 前端列表
*/
@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 = zufanghetongService.queryPage(params);
//字典表数据转换
List<ZufanghetongView> list =(List<ZufanghetongView>)page.getList();
for(ZufanghetongView 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);
ZufanghetongEntity zufanghetong = zufanghetongService.selectById(id);
if(zufanghetong !=null){
//entity转view
ZufanghetongView view = new ZufanghetongView();
BeanUtils.copyProperties( zufanghetong , view );//把实体数据重构到view中
//级联表
FangyuanOrderEntity fangyuanOrder = fangyuanOrderService.selectById(zufanghetong.getFangyuanOrderId());
if(fangyuanOrder != null){
BeanUtils.copyProperties( fangyuanOrder , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
view.setFangyuanOrderId(fangyuanOrder.getId());
}
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody ZufanghetongEntity zufanghetong, HttpServletRequest request){
logger.debug("add方法:,,Controller:{},,zufanghetong:{}",this.getClass().getName(),zufanghetong.toString());
Wrapper<ZufanghetongEntity> queryWrapper = new EntityWrapper<ZufanghetongEntity>()
.eq("fangyuan_order_id", zufanghetong.getFangyuanOrderId())
.eq("zufanghetong_name", zufanghetong.getZufanghetongName())
.eq("shoufanghetong_text", zufanghetong.getShoufanghetongText())
.eq("zufanghetong_delete", zufanghetong.getZufanghetongDelete())
// .notIn("zufanghetong_types", new Integer[]{102})
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
ZufanghetongEntity zufanghetongEntity = zufanghetongService.selectOne(queryWrapper);
if(zufanghetongEntity==null){
zufanghetong.setZufanghetongDelete(1);
zufanghetong.setCreateTime(new Date());
zufanghetongService.insert(zufanghetong);
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
}
7.2 租房合同Service
java
package com.service;
import com.baomidou.mybatisplus.service.IService;
import com.utils.PageUtils;
import com.entity.ZufanghetongEntity;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.lang.Nullable;
import java.util.List;
/**
* 租房合同 服务类
*/
public interface ZufanghetongService extends IService<ZufanghetongEntity> {
/**
* @param params 查询参数
* @return 带分页的查询出来的数据
*/
PageUtils queryPage(Map<String, Object> params);
}
7.3 租房合同ServiceImpl
java
package com.service.impl;
/**
* 租房合同 服务实现类
*/
@Service("zufanghetongService")
@Transactional
public class ZufanghetongServiceImpl extends ServiceImpl<ZufanghetongDao, ZufanghetongEntity> implements ZufanghetongService {
@Override
public PageUtils queryPage(Map<String,Object> params) {
Page<ZufanghetongView> page =new Query<ZufanghetongView>(params).getPage();
page.setRecords(baseMapper.selectListView(page,params));
return new PageUtils(page);
}
}
7.4 租房合同DAO
java
package com.dao;
import com.entity.ZufanghetongEntity;
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.ZufanghetongView;
/**
* 租房合同 Dao 接口
*
* @author
*/
public interface ZufanghetongDao extends BaseMapper<ZufanghetongEntity> {
List<ZufanghetongView> selectListView(Pagination page,@Param("params")Map<String,Object> params);
}
8.参考文档
你可能还有感兴趣的项目👇🏻👇🏻👇🏻
更多项目推荐:计算机毕业设计项目
如果大家有任何疑虑,请在下方咨询或评论