Merge remote-tracking branch 'remotes/origin/develop' into 2.0.3-RC2

This commit is contained in:
Zhaoyang 2019-11-13 20:33:08 +08:00
commit 29475e1100
5 changed files with 91 additions and 19 deletions

View File

@ -0,0 +1,38 @@
package com.diboot.component.excel.converter;
import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.CellData;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
import java.math.BigDecimal;
public class BigDecimalConverter implements Converter<BigDecimal> {
@Override
public Class supportJavaTypeKey() {
return BigDecimal.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.NUMBER;
}
@Override
public BigDecimal convertToJavaData(CellData cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception {
BigDecimal value = null;
String colName = contentProperty.getHead().getHeadNameList().get(0);//当前列
try {
value = cellData.getNumberValue();
} catch (Exception e) {
throw new Exception("["+colName+"]列数据格式有误,请填写正确的浮点型数据");
}
return value;
}
@Override
public CellData convertToExcelData(BigDecimal value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception {
return new CellData(value);
}
}

View File

@ -1,6 +1,7 @@
package com.diboot.component.excel.utils;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
import com.diboot.component.excel.entity.BaseExcelDataEntity;
import com.diboot.component.excel.listener.BaseExcelDataListener;
import com.diboot.core.util.V;
@ -81,4 +82,22 @@ public class EasyExcelHelper {
return true;
}
/**
* 简单将数据写入excel文件,列宽自适应数据长度
* @param filePath
* @param clazz
* @param dataList
* @param <T>
* @return
*/
public static <T extends BaseExcelDataEntity> boolean simpleWriteWithAdaptColumnWidth(String filePath, Class<T> clazz, List dataList) throws Exception{
try {
EasyExcel.write(filePath, clazz).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).sheet().doWrite(dataList);
} catch (Exception e) {
logger.error("数据写入excel文件失败",e);
return false;
}
return true;
}
}

View File

@ -19,7 +19,7 @@ public class Message extends BaseExtEntity {
private String businessType;
@TableField
private String businessId;
private Long businessId;
@TableField
private String sender;
@ -45,5 +45,7 @@ public class Message extends BaseExtEntity {
@TableField
private String response;
@TableField
private Long createBy;
}

View File

@ -4,14 +4,12 @@
<div class="hero">
<p class="action">
<a :href="$withBase('/guide/diboot-core/安装.html')" class="button white">快速上手</a>
<!--
<i class="fa fa-2x fa-play-circle" aria-hidden="true"></i>
<i class="fa fa-2x fa-play-circle" aria-hidden="true"></i>
<a href="javascript:;" class="button has-icon" @click="showVideo">
<img class="icon" src="/play-circle.png" alt="">
<img class="icon" src="../public/play-circle.png" alt="">
了解 diboot 2.0
</a>
-->
</p>
</div>
<div class="custom content">
@ -19,13 +17,13 @@
<div class="feature" style="max-width: 35%;">
<h2>diboot-core 精简高效内核</h2>
<p>
<ul>
<li>单表CRUD无SQL</li>
<li>关联查询无SQL - 注解自动绑定</li>
<li>数据字典无SQL - 注解自动绑定</li>
<li>Entity/DTO自动转换查询对象</li>
<li>常用工具类的最佳实践封装</li>
</ul>
<ul>
<li>单表CRUD无SQL</li>
<li>关联查询无SQL - 注解自动绑定</li>
<li>数据字典无SQL - 注解自动绑定</li>
<li>Entity/DTO自动转换查询对象</li>
<li>常用工具类的最佳实践封装</li>
</ul>
</p>
</div>
<div class="feature" style="max-width: 60%">
@ -61,13 +59,13 @@
<div class="footer-item">
</div>
</div>
<p class="copy-right">© 2015-2019 <a href="http://www.dibo.ltd">苏州帝博信息技术有限公司</a></p></p>
<p class="copy-right">© 2015-2019 <a href="http://www.dibo.ltd">苏州帝博信息技术有限公司</a></p>
</div>
</div>
<div class="modal-cover" v-show="showModal" @click="closeModal">
<div class="modal-content">
<iframe width='100%' height='100%' src="//player.bilibili.com/player.html?aid=35545861&cid=62326072&page=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe>
<iframe width='100%' height='100%' src="//player.bilibili.com/player.html?aid=75305809&page=1&high_quality=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"> </iframe>
</div>
</div>
</div>
@ -229,13 +227,15 @@ a.button.white {
box-shadow: 0 0 5px black;
}
.modal-content{
z-index: 1100;
position: fixed;
width: 1180px;
height: 666px;
top: 50%;
left: 50%;
margin-top: -333px;
margin-left: -590px;
z-index: 1100;
background-color: white;
position: fixed;
left: 10%;
top: 10%;
box-shadow: 0 0 15px black;
}
.donate-image{

View File

@ -21,4 +21,17 @@ MySQL、MariaDB、ORACLE、SQLServer、PostgreSQL
参考样例 [diboot-core-example](https://github.com/dibo-software/diboot-v2-example/tree/master/diboot-core-example)
> 如果您使用diboot-devtoolsdiboot-core会被自动引入无需再配置依赖。
> 如果您使用diboot-devtoolsdiboot-core会被自动引入无需再配置依赖。
## 相关依赖
* **javax.servlet-api**(javax.servlet:javax.servlet-api:4.0.1)
* **spring-boot-starter-web**(org.springframework.boot:spring-boot-starter-web:2.1.8.RELEASE)
* **mybatis-plus-boot-starter**(com.baomidou:mybatis-plus-boot-starter:3.2.0)
* **commons-io**(commons-io:commons-io:2.6)
* **commons-lang3**(org.apache.commons:commons-lang3:3.8.1)
* **fastjson**(com.alibaba:fastjson:1.2.60)
:::tip
以上依赖在引入diboot-core-starter依赖的项目中可以不再引入。
:::