开发语言:Java 框架:ssm JDK版本:JDK1.8 服务器:tomcat7 数据库:mysql 5.7(一定要5.7版本) 数据库工具:Navicat11 开发软件:eclipse/myeclipse/idea Maven包:Maven3.3.9 浏览器:谷歌浏览器
数据库脚本:
DROP TABLE IF EXISTS caiwutongji
;
/*!40101 SET @saved_cs_client = @@character_set_client /;
/!40101 SET character_set_client = utf8 /;
CREATE TABLE caiwutongji
(
id
bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
addtime
timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
tongjibianhao
varchar(200) DEFAULT NULL COMMENT '统计编号',
dangyueshouru
float DEFAULT NULL COMMENT '当月收入',
dangyuezhichu
float DEFAULT NULL COMMENT '当月支出',
chunlirun
float DEFAULT NULL COMMENT '纯利润',
dengjiriqi
date DEFAULT NULL COMMENT '登记日期',
PRIMARY KEY (id
),
UNIQUE KEY tongjibianhao
(tongjibianhao
)
) ENGINE=InnoDB AUTO_INCREMENT=237 DEFAULT CHARSET=utf8 COMMENT='财务统计';
/!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table caiwutongji
--
LOCK TABLES caiwutongji
WRITE;
/*!40000 ALTER TABLE caiwutongji
DISABLE KEYS /;
INSERT INTO caiwutongji
VALUES (231,'2022-03-22 14:11:46','1111111111',1,1,1,'2022-03-22'),(232,'2022-03-22 14:11:46','2222222222',2,2,2,'2022-03-22'),(233,'2022-03-22 14:11:46','3333333333',3,3,3,'2022-03-22'),(234,'2022-03-22 14:11:46','4444444444',4,4,4,'2022-03-22'),(235,'2022-03-22 14:11:46','5555555555',5,5,5,'2022-03-22'),(236,'2022-03-22 14:11:46','6666666666',6,6,6,'2022-03-22');
/!40000 ALTER TABLE caiwutongji
ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table chuangwei
--
DROP TABLE IF EXISTS chuangwei
;
/*!40101 SET @saved_cs_client = @@character_set_client /;
/!40101 SET character_set_client = utf8 /;
CREATE TABLE chuangwei
(
id
bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
addtime
timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
fangjianhao
varchar(200) DEFAULT NULL COMMENT '房间号',
loufangmingcheng
varchar(200) DEFAULT NULL COMMENT '楼房名称',
chuangweihao
varchar(200) NOT NULL COMMENT '床位号',
chuangweizhuangtai
varchar(200) DEFAULT NULL COMMENT '床位状态',
PRIMARY KEY (id
)
) ENGINE=InnoDB AUTO_INCREMENT=57 DEFAULT CHARSET=utf8 COMMENT='床位';
/!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table chuangwei
--
LOCK TABLES chuangwei
WRITE;
/*!40000 ALTER TABLE chuangwei
DISABLE KEYS /;
INSERT INTO chuangwei
VALUES (51,'2022-03-22 14:11:46','房间号1','楼房名称1','床位号1','已使用'),(52,'2022-03-22 14:11:46','房间号2','楼房名称2','床位号2','已使用'),(53,'2022-03-22 14:11:46','房间号3','楼房名称3','床位号3','已使用'),(54,'2022-03-22 14:11:46','房间号4','楼房名称4','床位号4','已使用'),(55,'2022-03-22 14:11:46','房间号5','楼房名称5','床位号5','已使用'),(56,'2022-03-22 14:11:46','房间号6','楼房名称6','床位号6','已使用');
/!40000 ALTER TABLE chuangwei
ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table config
--
DROP TABLE IF EXISTS config
;
/*!40101 SET @saved_cs_client = @@character_set_client /;
/!40101 SET character_set_client = utf8 /;
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='配置文件';
/!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table config
--
LOCK TABLES config
WRITE;
/*!40000 ALTER TABLE config
DISABLE KEYS /;
INSERT INTO config
VALUES (1,'picture1','upload/picture1.jpg'),(2,'picture2','upload/picture2.jpg'),(3,'picture3','upload/picture3.jpg');
/!40000 ALTER TABLE config
ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table fangjianziliao
--
DROP TABLE IF EXISTS fangjianziliao
;
/*!40101 SET @saved_cs_client = @@character_set_client /;
/!40101 SET character_set_client = utf8 /;
CREATE TABLE fangjianziliao
(
id
bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
addtime
timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
fangjianhao
varchar(200) DEFAULT NULL COMMENT '房间号',
loufangmingcheng
varchar(200) DEFAULT NULL COMMENT '楼房名称',
fangjianmianji
varchar(200) DEFAULT NULL COMMENT '房间面积',
fangjiansheshi
longtext COMMENT '房间设施',
PRIMARY KEY (id
)
) ENGINE=InnoDB AUTO_INCREMENT=47 DEFAULT CHARSET=utf8 COMMENT='房间资料';
/!40101 SET character_set_client = @saved_cs_client */;
业务逻辑代码:
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,ZhuanfangdengjiEntity zhuanfangdengji,
HttpServletRequest request){
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("jiashu")) {
zhuanfangdengji.setJiashuzhanghao((String)request.getSession().getAttribute("username"));
}
if(tableName.equals("hugong")) {
zhuanfangdengji.setHugonggonghao((String)request.getSession().getAttribute("username"));
}
EntityWrapper<ZhuanfangdengjiEntity> ew = new EntityWrapper<ZhuanfangdengjiEntity>();
PageUtils page = zhuanfangdengjiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, zhuanfangdengji), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,ZhuanfangdengjiEntity zhuanfangdengji,
HttpServletRequest request){
EntityWrapper<ZhuanfangdengjiEntity> ew = new EntityWrapper<ZhuanfangdengjiEntity>();
PageUtils page = zhuanfangdengjiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, zhuanfangdengji), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( ZhuanfangdengjiEntity zhuanfangdengji){
EntityWrapper<ZhuanfangdengjiEntity> ew = new EntityWrapper<ZhuanfangdengjiEntity>();
ew.allEq(MPUtil.allEQMapPre( zhuanfangdengji, "zhuanfangdengji"));
return R.ok().put("data", zhuanfangdengjiService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(ZhuanfangdengjiEntity zhuanfangdengji){
EntityWrapper< ZhuanfangdengjiEntity> ew = new EntityWrapper< ZhuanfangdengjiEntity>();
ew.allEq(MPUtil.allEQMapPre( zhuanfangdengji, "zhuanfangdengji"));
ZhuanfangdengjiView zhuanfangdengjiView = zhuanfangdengjiService.selectView(ew);
return R.ok("查询转房登记成功").put("data", zhuanfangdengjiView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
ZhuanfangdengjiEntity zhuanfangdengji = zhuanfangdengjiService.selectById(id);
return R.ok().put("data", zhuanfangdengji);
}
/**
* 前端详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
ZhuanfangdengjiEntity zhuanfangdengji = zhuanfangdengjiService.selectById(id);
return R.ok().put("data", zhuanfangdengji);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody ZhuanfangdengjiEntity zhuanfangdengji, HttpServletRequest request){
zhuanfangdengji.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(zhuanfangdengji);
zhuanfangdengjiService.insert(zhuanfangdengji);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody ZhuanfangdengjiEntity zhuanfangdengji, HttpServletRequest request){
zhuanfangdengji.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(zhuanfangdengji);
zhuanfangdengjiService.insert(zhuanfangdengji);
return R.ok();
}