开发语言:Java
框架:ssm
JDK版本:JDK1.8
服务器:tomcat7
数据库:mysql 5.7(一定要5.7版本)
数据库工具:Navicat11
开发软件:eclipse/myeclipse/idea
Maven包:Maven3.3.9
浏览器:谷歌浏览器
小程序框架:uniapp
小程序开发软件:HBuilder X
小程序运行软件:微信开发者
数据库:
DROP TABLE IF EXISTS `chat`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `chat` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT ‘主键’,
`addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT ‘创建时间’,
`userid` bigint(20) NOT NULL COMMENT ‘用户id’,
`adminid` bigint(20) DEFAULT NULL COMMENT ‘管理员id’,
`ask` longtext COMMENT ‘提问’,
`reply` longtext COMMENT ‘回复’,
`isreply` int(11) DEFAULT NULL COMMENT ‘是否回复’,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1651332058362 DEFAULT CHARSET=utf8 COMMENT=’在线咨询’;
/*!40101 SET character_set_client = @saved_cs_client */;
—
— Dumping data for table `chat`
—
LOCK TABLES `chat` WRITE;
/*!40000 ALTER TABLE `chat` DISABLE KEYS */;
INSERT INTO `chat` VALUES (51,’2022-04-30 15:11:40′,1,1,’提问1′,’回复1′,0),(52,’2022-04-30 15:11:40′,2,2,’提问2′,’回复2′,2),(53,’2022-04-30 15:11:40′,3,3,’提问3′,’回复3′,3),(54,’2022-04-30 15:11:40′,4,4,’提问4′,’回复4′,4),(55,’2022-04-30 15:11:40′,5,5,’提问5′,’回复5′,5),(56,’2022-04-30 15:11:40′,6,6,’提问6′,’回复6′,6),(1651331856114,’2022-04-30 15:17:36′,1,1,NULL,’电饭锅发的’,NULL),(1651332002502,’2022-04-30 15:20:02′,1651331942243,NULL,’打算发送到发送到发多少’,NULL,0),(1651332058361,’2022-04-30 15:20:58′,1651331942243,1,NULL,’电饭锅地方固定’,NULL);
/*!40000 ALTER TABLE `chat` 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/1651331864060.jpg’),(2,’picture2′,’upload/picture2.jpg’),(3,’picture3′,’upload/picture3.jpg’);
/*!40000 ALTER TABLE `config` ENABLE KEYS */;
UNLOCK TABLES;
—
— Table structure for table `dianyingfenlei`
—
DROP TABLE IF EXISTS `dianyingfenlei`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `dianyingfenlei` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT ‘主键’,
`addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT ‘创建时间’,
`dianyingfenlei` varchar(200) DEFAULT NULL COMMENT ‘电影分类’,
PRIMARY KEY (`id`),
UNIQUE KEY `dianyingfenlei` (`dianyingfenlei`)
) ENGINE=InnoDB AUTO_INCREMENT=1651331777347 DEFAULT CHARSET=utf8 COMMENT=’电影分类’;
/*!40101 SET character_set_client = @saved_cs_client */;
关键代码:
/**
* (按值统计)
*/
@RequestMapping(“/value/{xColumnName}/{yColumnName}”)
public R value(@PathVariable(“yColumnName”) String yColumnName, @PathVariable(“xColumnName”) String xColumnName,HttpServletRequest request) {
Map<String, Object> params = new HashMap<String, Object>();
params.put(“xColumn”, xColumnName);
params.put(“yColumn”, yColumnName);
EntityWrapper<OrdersEntity> ew = new EntityWrapper<OrdersEntity>();
ew.in(“status”, new String[]{“已支付”,”已发货”,”已完成”});
List<Map<String, Object>> result = ordersService.selectValue(params, ew);
SimpleDateFormat sdf = new SimpleDateFormat(“yyyy-MM-dd”);
for(Map<String, Object> m : result) {
for(String k : m.keySet()) {
if(m.get(k) instanceof Date) {
m.put(k, sdf.format((Date)m.get(k)));
}
}
}
return R.ok().put(“data”, result);
}
/**
* (按值统计)时间统计类型
*/
@RequestMapping(“/value/{xColumnName}/{yColumnName}/{timeStatType}”)
public R valueDay(@PathVariable(“yColumnName”) String yColumnName, @PathVariable(“xColumnName”) String xColumnName, @PathVariable(“timeStatType”) String timeStatType,HttpServletRequest request) {
Map<String, Object> params = new HashMap<String, Object>();
params.put(“xColumn”, xColumnName);
params.put(“yColumn”, yColumnName);
params.put(“timeStatType”, timeStatType);
EntityWrapper<OrdersEntity> ew = new EntityWrapper<OrdersEntity>();
ew.in(“status”, new String[]{“已支付”,”已发货”,”已完成”});
List<Map<String, Object>> result = ordersService.selectTimeStatValue(params, ew);
SimpleDateFormat sdf = new SimpleDateFormat(“yyyy-MM-dd”);
for(Map<String, Object> m : result) {
for(String k : m.keySet()) {
if(m.get(k) instanceof Date) {
m.put(k, sdf.format((Date)m.get(k)));
}
}
}
return R.ok().put(“data”, result);
}
/**
* 分组统计
*/
@RequestMapping(“/group/{columnName}”)
public R group(@PathVariable(“columnName”) String columnName,HttpServletRequest request) {
Map<String, Object> params = new HashMap<String, Object>();
params.put(“column”, columnName);
EntityWrapper<OrdersEntity> ew = new EntityWrapper<OrdersEntity>();
ew.in(“status”, new String[]{“已支付”,”已发货”,”已完成”});
List<Map<String, Object>> result = ordersService.selectGroup(params, ew);
SimpleDateFormat sdf = new SimpleDateFormat(“yyyy-MM-dd”);
for(Map<String, Object> m : result) {
for(String k : m.keySet()) {
if(m.get(k) instanceof Date) {
m.put(k, sdf.format((Date)m.get(k)));
}
}
}
return R.ok().put(“data”, result);
}
}