Commit 2ae2b1d3 authored by ma's avatar ma

下载文件新增设备SN列

parent d65e92dc
...@@ -28,6 +28,9 @@ public class ResourceVo { ...@@ -28,6 +28,9 @@ public class ResourceVo {
@ApiModelProperty("设备编号") @ApiModelProperty("设备编号")
private String sn; private String sn;
@ApiModelProperty("绑定的SN")
private String snBind;
@ApiModelProperty("设备状态") @ApiModelProperty("设备状态")
private String status; private String status;
......
...@@ -83,6 +83,10 @@ public class ResourceManager { ...@@ -83,6 +83,10 @@ public class ResourceManager {
cell = row.createCell((short)5); //第六个单元格 cell = row.createCell((short)5); //第六个单元格
cell.setCellValue("状态"); cell.setCellValue("状态");
cell.setCellStyle(styleRow); cell.setCellStyle(styleRow);
cell = row.createCell((short)6); //第七个单元格
cell.setCellValue("设备编码");
cell.setCellStyle(styleRow);
//第五步插入数据 //第五步插入数据
List<ResourceVo> resourceList = resourceService.getResource(userId); List<ResourceVo> resourceList = resourceService.getResource(userId);
for (int i = 0; i < resourceList.size(); i++) { for (int i = 0; i < resourceList.size(); i++) {
...@@ -114,9 +118,13 @@ public class ResourceManager { ...@@ -114,9 +118,13 @@ public class ResourceManager {
cell = row.createCell((short)5); // 第六个单元格 cell = row.createCell((short)5); // 第六个单元格
cell.setCellValue(resourceVo.getStatus()); cell.setCellValue(resourceVo.getStatus());
cell.setCellStyle(style); cell.setCellStyle(style);
cell = row.createCell((short)6); // 第七个单元格
cell.setCellValue(resourceVo.getSnBind());
cell.setCellStyle(style);
} }
//在填完所有值以后,对每一列设置自适应宽度 //在填完所有值以后,对每一列设置自适应宽度
for (int n = 0; n < 6; n++) { for (int n = 0; n < 7; n++) {
sheet.autoSizeColumn(n); sheet.autoSizeColumn(n);
} }
wb.write(os); wb.write(os);
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<mapper namespace="iot.sixiang.license.mapper.ResourceMapper"> <mapper namespace="iot.sixiang.license.mapper.ResourceMapper">
<select id="getResource" resultType="iot.sixiang.license.model.vo.ResourceVo"> <select id="getResource" resultType="iot.sixiang.license.model.vo.ResourceVo">
SELECT a.user_name,a.password,a.company,b.app_name,b.app_key,c.sn, b.app_id, SELECT a.user_name,a.password,a.company,b.app_name,b.app_key,c.sn, c.sn_bind, b.app_id,
(CASE c.`status` WHEN 1 THEN '已使用' WHEN 2 THEN '失效' ELSE '未使用' END) `status` (CASE c.`status` WHEN 1 THEN '已使用' WHEN 2 THEN '失效' ELSE '未使用' END) `status`
FROM USER a, apply b, device c WHERE a.user_id = b.user_id FROM USER a, apply b, device c WHERE a.user_id = b.user_id
AND b.app_id = c.app_id AND a.user_id = #{userId} AND b.app_id = c.app_id AND a.user_id = #{userId}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment