基于ssm的共享客栈管理系统源码和论文058
开发工具:idea
数据库mysql5.7+
数据库链接工具:navcat,小海豚等
技术:ssm
摘 要
互联网发展至今,无论是其理论还是技术都已经成熟,而且它广泛参与在社会中的方方面面。它让信息都可以通过网络传播,搭配信息管理工具可以很好地为人们提供服务。针对房屋出租信息管理混乱,出错率高,信息安全性差,劳动强度大,费时费力等问题,采用共享客栈管理系统可以有效管理,使信息管理能够更加科学和规范。
共享客栈管理系统在Eclipse环境中,使用Java语言进行编码,使用Mysql创建数据表保存本系统产生的数据。系统可以提供信息显示和相应服务,本系统实现房屋管理,合同文件上传与下载,房屋租房与续租,房屋出租管理等功能。
总之,共享客栈管理系统集中管理信息,有着保密性强,效率高,存储空间大,成本低等诸多优点。它可以降低信息管理成本,实现信息管理计算机化。
关键词:共享客栈管理系统;Java语言;Mysql
文章来源:https://www.toymoban.com/news/detail-671105.html
package com.controller;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.annotation.IgnoreAuth;
import com.entity.ChuzhuxinxiEntity;
import com.service.ChuzhuxinxiService;
import com.service.YonghuxinxiService;
import com.utils.MPUtil;
import org.apache.commons.lang3.StringUtils;
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.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.entity.FangwuxinxiEntity;
import com.service.FangwuxinxiService;
import com.utils.PageUtils;
import com.utils.R;
/**
*
* 后端接口
* @author
* @email
* @date 2021-02-05
*/
@RestController
@Controller
@RequestMapping("/fangwuxinxi")
public class FangwuxinxiController {
private static final Logger logger = LoggerFactory.getLogger(FangwuxinxiController.class);
@Autowired
private FangwuxinxiService fangwuxinxiService;
@Autowired
private ChuzhuxinxiService chuzhuxinxiService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
logger.debug("Controller:"+this.getClass().getName()+",page方法");
Object role = request.getSession().getAttribute("role");
PageUtils page = null;
if(role.equals("房东")){
params.put("fd",request.getSession().getAttribute("userId"));
page = fangwuxinxiService.queryPage(params);
}else{
page = fangwuxinxiService.queryPage(params);
}
return R.ok().put("data", page);
}
/**
* 前端详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") String id){
FangwuxinxiEntity fangwu = fangwuxinxiService.selectById(id);
return R.ok().put("data", fangwu);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
logger.debug("Controller:"+this.getClass().getName()+",info方法");
FangwuxinxiEntity fangwuxinxi = fangwuxinxiService.selectById(id);
if(fangwuxinxi!=null){
return R.ok().put("data", fangwuxinxi);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody FangwuxinxiEntity fangwuxinxi, HttpServletRequest request){
logger.debug("Controller:"+this.getClass().getName()+",save");
Wrapper<FangwuxinxiEntity> queryWrapper = new EntityWrapper<FangwuxinxiEntity>()
.eq("fwname", fangwuxinxi.getFwname())
.eq("fwlx_types", fangwuxinxi.getFwlxTypes())
.eq("fd_types", fangwuxinxi.getFdTypes())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
FangwuxinxiEntity fangwuxinxiEntity = fangwuxinxiService.selectOne(queryWrapper);
if("".equals(fangwuxinxi.getImgPhoto()) || "null".equals(fangwuxinxi.getImgPhoto())){
fangwuxinxi.setImgPhoto(null);
}
if(fangwuxinxiEntity==null){
fangwuxinxiService.insert(fangwuxinxi);
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody FangwuxinxiEntity fangwuxinxi, HttpServletRequest request){
logger.debug("Controller:"+this.getClass().getName()+",update");
//根据字段查询是否有相同数据
Wrapper<FangwuxinxiEntity> queryWrapper = new EntityWrapper<FangwuxinxiEntity>()
.notIn("id",fangwuxinxi.getId())
.eq("fwname", fangwuxinxi.getFwname())
.eq("fwlx_types", fangwuxinxi.getFwlxTypes())
.eq("fd_types", fangwuxinxi.getFdTypes())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
FangwuxinxiEntity fangwuxinxiEntity = fangwuxinxiService.selectOne(queryWrapper);
if("".equals(fangwuxinxi.getImgPhoto()) || "null".equals(fangwuxinxi.getImgPhoto())){
fangwuxinxi.setImgPhoto(null);
}
if(fangwuxinxiEntity==null){
fangwuxinxiService.updateById(fangwuxinxi);//根据id更新
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
logger.debug("Controller:"+this.getClass().getName()+",delete");
fangwuxinxiService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 租房
*/
@RequestMapping("/renting")
public R renting(Integer id, String finishTime, HttpServletRequest request){
if(finishTime == null){
return R.error("租房截至日期不能为空");
}
Object role = request.getSession().getAttribute("role");
if(role.equals("房东")){
return R.error("房东是不可以租房子的哦");
} else if(role.equals("管理员")){
return R.error("管理员是不可以租房子的哦");
}
Integer userId = (Integer) request.getSession().getAttribute("userId");
FangwuxinxiEntity fangwuxinxi = fangwuxinxiService.selectById(id);
if(fangwuxinxi != null){
if(fangwuxinxi.getFwstateTypes() == 2 && fangwuxinxi.getFwstateTypes() != 1){
try {
fangwuxinxi.setFwstateTypes(1);
ChuzhuxinxiEntity chuzhuxinxi = new ChuzhuxinxiEntity();
chuzhuxinxi.setFdTypes(fangwuxinxi.getFdTypes());
chuzhuxinxi.setFwTypes(fangwuxinxi.getId());
chuzhuxinxi.setYhTypes(userId);
chuzhuxinxi.setCreateTime(new Date());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
chuzhuxinxi.setFinishTime(sdf.parse(finishTime));
chuzhuxinxiService.insert(chuzhuxinxi);
fangwuxinxiService.updateById(fangwuxinxi);
} catch (ParseException e) {
e.printStackTrace();
}
return R.ok();
}else {
return R.error("这个房子已出租");
}
}
return R.error("出现错误了哦");
}
}
文章来源地址https://www.toymoban.com/news/detail-671105.html
package com.controller;
import java.text.SimpleDateFormat;
import java.util.*;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
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.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.entity.HetongxinxiEntity;
import com.service.HetongxinxiService;
import com.utils.PageUtils;
import com.utils.R;
/**
*
* 后端接口
* @author
* @email
* @date 2021-02-05
*/
@RestController
@Controller
@RequestMapping("/hetongxinxi")
public class HetongxinxiController {
private static final Logger logger = LoggerFactory.getLogger(HetongxinxiController.class);
@Autowired
private HetongxinxiService hetongxinxiService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
logger.debug("Controller:"+this.getClass().getName()+",page方法");
Object role = request.getSession().getAttribute("role");
PageUtils page = null;
if(role.equals("用户")){
params.put("yh",request.getSession().getAttribute("userId"));
page = hetongxinxiService.queryPage(params);
}else{
page = hetongxinxiService.queryPage(params);
}
if(role.equals("房东")){
params.put("fd",request.getSession().getAttribute("userId"));
page = hetongxinxiService.queryPage(params);
}else{
page = hetongxinxiService.queryPage(params);
}
return R.ok().put("data", page);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
logger.debug("Controller:"+this.getClass().getName()+",info方法");
HetongxinxiEntity hetongxinxi = hetongxinxiService.selectById(id);
if(hetongxinxi!=null){
return R.ok().put("data", hetongxinxi);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody HetongxinxiEntity hetongxinxi, HttpServletRequest request){
logger.debug("Controller:"+this.getClass().getName()+",save");
Wrapper<HetongxinxiEntity> queryWrapper = new EntityWrapper<HetongxinxiEntity>()
.eq("htname", hetongxinxi.getHtname())
.eq("fd_types", hetongxinxi.getFdTypes())
.eq("yh_types", hetongxinxi.getYhTypes())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
hetongxinxi.setCreateTime(new Date());
HetongxinxiEntity hetongxinxiEntity = hetongxinxiService.selectOne(queryWrapper);
if("".equals(hetongxinxi.getProveFile()) || "null".equals(hetongxinxi.getProveFile())){
hetongxinxi.setProveFile(null);
}
if(hetongxinxiEntity==null){
hetongxinxiService.insert(hetongxinxi);
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody HetongxinxiEntity hetongxinxi, HttpServletRequest request){
logger.debug("Controller:"+this.getClass().getName()+",update");
//根据字段查询是否有相同数据
Wrapper<HetongxinxiEntity> queryWrapper = new EntityWrapper<HetongxinxiEntity>()
.notIn("id",hetongxinxi.getId())
.eq("htname", hetongxinxi.getHtname())
.eq("fd_types", hetongxinxi.getFdTypes())
.eq("yh_types", hetongxinxi.getYhTypes())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
HetongxinxiEntity hetongxinxiEntity = hetongxinxiService.selectOne(queryWrapper);
if("".equals(hetongxinxi.getProveFile()) || "null".equals(hetongxinxi.getProveFile())){
hetongxinxi.setProveFile(null);
}
if(hetongxinxiEntity==null){
hetongxinxiService.updateById(hetongxinxi);//根据id更新
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
logger.debug("Controller:"+this.getClass().getName()+",delete");
hetongxinxiService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
}
到了这里,关于基于ssm的共享客栈管理系统源码和论文的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!