package mapper;
import com.calculation.bean.*;
import com.calculation.dao.*;
import com.factor.bean.GridEmissionFactor;
import com.factor.dao.GridEmissionFactorMapper;
import com.utils.DateParse;
import org.apache.ibatis.session.SqlSession;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.Date;
import java.util.List;
/**
* @Description: 测试 Consumption 的 Dao 层
* @Author: Alex McAvoy
* @Date: 2022/5/13 21:09
* @Version: 1.0
**/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:applicationContext.xml"})
public class ConsumptionMapperTest {
@Autowired
SqlSession sqlSession;
@Autowired(required = false)
GridEmissionFactorMapper gridEmissionFactorMapper;
@Autowired(required = false)
ElectricityConsumptionMapper electricityConsumptionMapper;
@Autowired(required = false)
GasConsumptionMapper gasConsumptionMapper;
@Autowired(required = false)
GasolineConsumptionMapper gasolineConsumptionMapper;
@Autowired(required = false)
DieselFuelConsumptionMapper dieselFuelConsumptionMapper;
@Autowired(required = false)
SteamConsumptionMapper steamConsumptionMapper;
@Autowired(required = false)
HeatConsumptionMapper heatConsumptionMapper;
/**
* @Description: 测试表 electricity_consumption
* @Param: []
* @Return: void
* @Author: Alex McAvoy
* @Date: 2022/5/21 16:50
**/
@Test
public void testElectricityConsumptionMapper() {
//根据主键查询
ElectricityConsumption obj = electricityConsumptionMapper.selectByPrimaryKey(1);
System.out.println(obj);
//根据日期查询
DateParse dateParse = new DateParse("2022-05-08");
Date date = dateParse.getCreatedTime();
obj = electricityConsumptionMapper.selectByCreatedTime(date);
System.out.println(obj);
//获取按Id升序的所有数据
List<ElectricityConsumption> list = electricityConsumptionMapper.getAllOrderById();
System.out.println(list);
//获取按日期升序的所有数据
list = electricityConsumptionMapper.getAllOrderByCreatedTime();
System.out.println(list);
//获取日期最小的数据
ElectricityConsumption min = electricityConsumptionMapper.getMinCreatedTime();
System.out.println(min);
//插入
GridEmissionFactor grid = gridEmissionFactorMapper.selectByPrimaryKey(1);
ElectricityConsumption newObj = new ElectricityConsumption(2,1000.0,1000.0,1000.0,1000.0,1000.0,0.1229,0.1229,0.1229,0.1229,3000.0,0.36869,grid,2.8257,new Date());
electricityConsumptionMapper.insert(newObj);
//删除
electricityConsumptionMapper.deleteByPrimaryKey(2);
//更新
GridEmissionFactor updateGrid = gridEmissionFactorMapper.selectByPrimaryKey(1);
ElectricityConsumption updateObj = new ElectricityConsumption(1,1000.0,1000.0,1000.0,1000.0,1000.0,0.1229,0.1229,0.1229,0.1229,3000.0,0.36869,updateGrid,2.8257,new Date());
electricityConsumptionMapper.update(updateObj);
}
/**
* @Description: 测试表 gas_consumption
* @Param: []
* @Return: void
* @Author: Alex McAvoy
* @Date: 2022/5/19 20:56
**/
@Test
public void testGasConsumption() {
//根据主键查询
GasConsumption obj = gasConsumptionMapper.selectByPrimaryKey(1);
System.out.println(obj);
//根据日期查询
DateParse dateParse = new DateParse("2022-05-20");
Date date = dateParse.getCreatedTime();
obj = gasConsumptionMapper.selectByCreatedTime(date);
System.out.println(obj);
//获取按Id升序的所有数据
List<GasConsumption> list = gasConsumptionMapper.getAllOrderById();
System.out.println(list);
//获取按日期升序的所有数据
list = gasConsumptionMapper.getAllOrderByCreatedTime();
System.out.println(list);
//获取日期最小的数据
GasConsumption min = gasConsumptionMapper.getMinCreatedTime();
System.out.println(min);
//插入
GasConsumption newObj = new GasConsumption(2,16.0,0.02128,0.0345952,new Date());
gasConsumptionMapper.insert(newObj);
//删除
gasConsumptionMapper.deleteByPrimaryKey(2);
//更新
GasConsumption updateObj = new GasConsumption(2,20.0,0.02128,0.0345952,new Date());
gasConsumptionMapper.update(updateObj);
}
/**
* @Description: 测试表 gasoline_consumption
* @Param: []
* @Return: void
* @Author: Alex McAvoy
* @Date: 2022/5/20 0:10
**/
@Test
public void testGasolineConsumption() {
//根据主键查询
GasolineConsumption obj = gasolineConsumptionMapper.selectByPrimaryKey(1);
System.out.println(obj);
//根据日期查询
DateParse dateParse = new DateParse("2022-05-21");
Date date = dateParse.getCreatedTime();
obj = gasolineConsumptionMapper.selectByCreatedTime(date);
System.out.println(obj);
//获取按Id升序的所有数据
List<GasolineConsumption> list = gasolineConsumptionMapper.getAllOrderById();
System.out.println(list);
//获取按日期升序的所有数据
list = gasolineConsumptionMapper.getAllOrderByCreatedTime();
System.out.println(list);
//获取日期最小的数据
GasolineConsumption min = gasolineConsumptionMapper.getMinCreatedTime();
System.out.println(min);
//插入
GasolineConsumption newObj = new GasolineConsumption(2,12.0,0.0176568,0.0351012,new Date());
gasolineConsumptionMapper.insert(newObj);
//删除
gasolineConsumptionMapper.deleteByPrimaryKey(2);
//更新
GasolineConsumption updateObj = new GasolineConsumption(2,12.0,0.0176568,0.0351012,new Date());
gasolineConsumptionMapper.update(updateObj);
}
/**
* @Description: 测试表 diesel_fuel_consumption
* @Param: []
* @Return: void
* @Author: Alex McAvoy
* @Date: 2022/5/19 23:58
**/
@Test
public void testDieselFuelConsumption() {
//根据主键查询
DieselFuelConsumption obj = dieselFuelConsumptionMapper.selectByPrimaryKey(1);
System.out.println(obj);
//根据日期查询
DateParse dateParse = new DateParse("2022-05-21");
Date date = dateParse.getCreatedTime();
obj = dieselFuelConsumptionMapper.selectByCreatedTime(date);
System.out.println(obj);
//获取按Id升序的所有数据
List<DieselFuelConsumption> list = dieselFuelConsumptionMapper.getAllOrderById();
System.out.println(list);
//获取按日期升序的所有数据
list = dieselFuelConsumptionMapper.getAllOrderByCreatedTime();
System.out.println(list);
//获取日期最小的数据
DieselFuelConsumption min = dieselFuelConsumptionMapper.getMinCreatedTime();
System.out.println(min);
//插入
DieselFuelConsumption newObj = new DieselFuelConsumption(2,11.0,0.0160281,0.0340549,new Date());
dieselFuelConsumptionMapper.insert(newObj);
//删除
dieselFuelConsumptionMapper.deleteByPrimaryKey(2);
//更新
DieselFuelConsumption updateObj = new DieselFuelConsumption(2,10.0,0.0160281,0.0340549,new Date());
dieselFuelConsumptionMapper.update(updateObj);
}
/
没有合适的资源?快使用搜索试试~ 我知道了~
基于java开发的智慧楼宇碳检测系统源码+sql数据库.zip
共152个文件
java:55个
js:45个
xml:16个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 165 浏览量
2023-07-05
11:53:32
上传
评论
收藏 951KB ZIP 举报
温馨提示
【资源说明】 基于java开发的智慧楼宇碳检测系统源码+sql数据库.zip 基于java开发的智慧楼宇碳检测系统源码+sql数据库.zip 基于java开发的智慧楼宇碳检测系统源码+sql数据库.zip 该项目是个人毕设项目源码,评审分达到95分,都经过严格调试,确保可以运行!放心下载使用。 该项目资源主要针对计算机、自动化等相关专业的学生或从业者下载使用,也可作为期末课程设计、课程大作业、毕业设计等。 具有较高的学习借鉴价值!基础能力强的可以在此基础上修改调整,以实现类似其他功能。
资源推荐
资源详情
资源评论
收起资源包目录
基于java开发的智慧楼宇碳检测系统源码+sql数据库.zip (152个子文件)
layui.css 78KB
layer.css 14KB
laydate.css 7KB
main.css 3KB
button.css 2KB
restyle.css 2KB
code.css 1KB
form.css 957B
main.css 765B
code.css 648B
import-page.css 554B
data-input.css 387B
iconfont.eot 46KB
loading-0.gif 6KB
loading-2.gif 2KB
loading-1.gif 701B
.gitignore 394B
ConsumptionMapperTest.java 11KB
ElectricityConsumptionController.java 7KB
DieselFuelController.java 5KB
GasolineController.java 5KB
HeatController.java 5KB
SteamController.java 5KB
GasController.java 5KB
ElectricityConsumption.java 5KB
CalElectricityConsumption.java 4KB
FactorMapperTest.java 3KB
utilsTest.java 3KB
ElectricityConsumptionService.java 3KB
GasConsumptionService.java 3KB
DieselFuelConsumptionService.java 3KB
GasolineConsumptionService.java 3KB
SteamConsumptionService.java 3KB
HeatConsumptionService.java 3KB
PageController.java 3KB
CalGasolineConsumption.java 2KB
CalDieselFuelConsumption.java 2KB
CalHeatConsumption.java 2KB
CalGasConsumption.java 2KB
CalSteamConsumption.java 2KB
UserController.java 2KB
CarbonEmissionFactor.java 2KB
EnergyCoalFactor.java 2KB
GasolineConsumption.java 2KB
DieselFuelConsumption.java 2KB
MVCTest.java 2KB
SteamConsumption.java 2KB
HeatConsumption.java 2KB
GasConsumption.java 2KB
CarbonEmissionFactorService.java 2KB
GridEmissionFactorService.java 1KB
User.java 1KB
EnergyCoalFactorService.java 1KB
GridEmissionFactor.java 1KB
Msg.java 1KB
EnergyController.java 1KB
GridController.java 1KB
UserMapperTest.java 1KB
CarbonController.java 1KB
MBGTest.java 1009B
DieselFuelConsumptionMapper.java 976B
ElectricityConsumptionMapper.java 942B
GasolineConsumptionMapper.java 912B
HeatConsumptionMapper.java 878B
SteamConsumptionMapper.java 876B
GasConsumptionMapper.java 860B
UserService.java 739B
DateParse.java 647B
CarbonEmissionFactorMapper.java 497B
GridEmissionFactorMapper.java 496B
EnergyCoalFactorMapper.java 487B
UserMapper.java 278B
login-background.jpg 91KB
echarts-5.3.2.min.js 993KB
layui.js 284KB
jquery-3.4.1.min.js 86KB
visualization.js 16KB
visualization.js 7KB
visualization.js 7KB
visualization.js 7KB
visualization.js 7KB
visualization.js 7KB
form.js 5KB
edit.js 3KB
consumption-emission.js 3KB
updateModal.js 3KB
edit.js 3KB
edit.js 3KB
edit.js 3KB
edit.js 3KB
edit.js 3KB
consumption-emission.js 3KB
consumption-emission.js 3KB
consumption-emission.js 3KB
consumption-emission.js 3KB
consumption-emission.js 3KB
login-verification.js 2KB
importPage.js 2KB
updateModal.js 2KB
updateModal.js 2KB
共 152 条
- 1
- 2
资源评论
onnx
- 粉丝: 9388
- 资源: 5592
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功