From c8aea93bb0abfa8b118b631c1edf74c031386b7e Mon Sep 17 00:00:00 2001
From: Jinquan_Ou <Jinquan@gdut.com>
Date: 星期六, 18 三月 2023 11:04:21 +0800
Subject: [PATCH] 导出数据
---
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ZfPropertyController.java | 4 +-
zhang-content/src/main/java/com/ruoyi/service/IZfPropertyService.java | 3 +
ruoyi-admin/src/test/java/com/ruoyi/generatorTest.java | 47 ++++++++++-------------
zhang-content/src/main/java/com/ruoyi/service/impl/IZfPropertyServiceImpl.java | 27 +++++++++----
4 files changed, 44 insertions(+), 37 deletions(-)
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ZfPropertyController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ZfPropertyController.java
index 7ca7d36..66522fe 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ZfPropertyController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ZfPropertyController.java
@@ -60,9 +60,9 @@
// @PreAuthorize("@ss.hasPermi('system:property:export')")
@Log(title = "瀹跺涵璧勪骇璁板綍", businessType = BusinessType.EXPORT)
@PostMapping("/export")
- public void export(HttpServletResponse response)
+ public void export(HttpServletResponse response,@RequestBody ZfProperty zfProperty)
{
- List<ZfProperty> list = zfPropertyService.list();
+ List<ZfProperty> list = zfPropertyService.selectByCondition(zfProperty);
ExcelUtil<ZfProperty> util = new ExcelUtil<ZfProperty>(ZfProperty.class);
util.exportExcel(response, list, "瀹跺涵璧勪骇璁板綍鏁版嵁");
}
diff --git a/ruoyi-admin/src/test/java/com/ruoyi/generatorTest.java b/ruoyi-admin/src/test/java/com/ruoyi/generatorTest.java
index 1ffe0cf..2e34aa5 100644
--- a/ruoyi-admin/src/test/java/com/ruoyi/generatorTest.java
+++ b/ruoyi-admin/src/test/java/com/ruoyi/generatorTest.java
@@ -20,8 +20,8 @@
@Test
public void test01() {
//鍒涘缓涓�涓唬鐮佺敓鎴愬櫒
- FastAutoGenerator.create("jdbc:mysql://localhost:3306/ruoyi?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8",
- "root", "123456")
+ FastAutoGenerator.create("jdbc:mysql://192.168.88.68:3306/mall_sms?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8",
+ "root", "root")
//鍏ㄥ眬閰嶇疆(GlobalConfig)
.globalConfig(builder -> {
builder.author("ojq") // 璁剧疆浣滆�咃紝鍙互鍐欒嚜宸卞悕瀛�
@@ -29,40 +29,33 @@
.fileOverride() // 瑕嗙洊宸茬敓鎴愭枃浠�
.dateType(DateType.TIME_PACK) //鏃堕棿绛栫暐
.commentDate("yyyy-MM-dd") //娉ㄩ噴鏃ユ湡
- .outputDir("F:\\IDEAWorkSpace\\src\\main\\java"); // 鎸囧畾杈撳嚭鐩綍锛屼竴鑸寚瀹氬埌java鐩綍
+ .outputDir("F:\\JavaProject\\mail-service\\mall-generator\\src\\main\\java"); // 鎸囧畾杈撳嚭鐩綍锛屼竴鑸寚瀹氬埌java鐩綍
})
//鍖呴厤缃�(PackageConfig)
.packageConfig(builder -> {
builder.parent("com.ojq") // 璁剧疆鐖跺寘鍚�
.moduleName("") // 璁剧疆鐖跺寘妯″潡鍚嶏紝杩欓噷涓�鑸笉璁剧疆
- .pathInfo(Collections.singletonMap(OutputFile.mapperXml, "F:\\IDEAWorkSpace\\src\\main\\resources\\com\\ojq\\mapper")); // 璁剧疆mapperXml鐢熸垚璺緞锛岃繖閲屾槸Mapper閰嶇疆鏂囦欢鐨勮矾寰勶紝寤鸿浣跨敤缁濆璺緞
+ .pathInfo(Collections.singletonMap(OutputFile.mapperXml, "F:\\JavaProject\\mail-service\\mall-generator\\src\\main\\resources\\com\\ojq\\mapper")); // 璁剧疆mapperXml鐢熸垚璺緞锛岃繖閲屾槸Mapper閰嶇疆鏂囦欢鐨勮矾寰勶紝寤鸿浣跨敤缁濆璺緞
})
//绛栫暐閰嶇疆(StrategyConfig)
.strategyConfig(builder -> {
// builder.addInclude("zf_clean") // 璁剧疆闇�瑕佺敓鎴愮殑琛ㄥ悕
// .addInclude("zf_collection") // 璁剧疆闇�瑕佺敓鎴愮殑琛ㄥ悕
- builder.addInclude("z_abroad") // 璁剧疆闇�瑕佺敓鎴愮殑琛ㄥ悕
- .addInclude("z_autobiography") // 璁剧疆闇�瑕佺敓鎴愮殑琛ㄥ悕
- .addInclude("z_certificate") // 璁剧疆闇�瑕佺敓鎴愮殑琛ㄥ悕
- .addInclude("z_child") // 璁剧疆闇�瑕佺敓鎴愮殑琛ㄥ悕
- .addInclude("z_dict") // 璁剧疆闇�瑕佺敓鎴愮殑琛ㄥ悕
- .addInclude("z_experience") // 璁剧疆闇�瑕佺敓鎴愮殑琛ㄥ悕
- .addInclude("z_health_base") // 璁剧疆闇�瑕佺敓鎴愮殑琛ㄥ悕
- .addInclude("z_health_habit") // 璁剧疆闇�瑕佺敓鎴愮殑琛ㄥ悕
- .addInclude("z_health_info") // 璁剧疆闇�瑕佺敓鎴愮殑琛ㄥ悕
- .addInclude("z_honor") // 璁剧疆闇�瑕佺敓鎴愮殑琛ㄥ悕
- .addInclude("z_idea") // 璁剧疆闇�瑕佺敓鎴愮殑琛ㄥ悕
- .addInclude("z_info_user") // 璁剧疆闇�瑕佺敓鎴愮殑琛ㄥ悕
- .addInclude("z_login_user") // 璁剧疆闇�瑕佺敓鎴愮殑琛ㄥ悕
- .addInclude("z_marry") // 璁剧疆闇�瑕佺敓鎴愮殑琛ㄥ悕
- .addInclude("z_property") // 璁剧疆闇�瑕佺敓鎴愮殑琛ㄥ悕
- .addInclude("z_secret") // 璁剧疆闇�瑕佺敓鎴愮殑琛ㄥ悕
- .addInclude("z_self_note") // 璁剧疆闇�瑕佺敓鎴愮殑琛ㄥ悕
- .addInclude("z_stay_out") // 璁剧疆闇�瑕佺敓鎴愮殑琛ㄥ悕
- .addInclude("z_travel_base") // 璁剧疆闇�瑕佺敓鎴愮殑琛ㄥ悕
- .addInclude("z_travel_price") // 璁剧疆闇�瑕佺敓鎴愮殑琛ㄥ悕
- .addInclude("z_year_health") // 璁剧疆闇�瑕佺敓鎴愮殑琛ㄥ悕
- .addInclude("z_year_info"); // 璁剧疆闇�瑕佺敓鎴愮殑琛ㄥ悕
+ builder.addInclude("sms_coupon") // 璁剧疆闇�瑕佺敓鎴愮殑琛ㄥ悕
+ .addInclude("sms_coupon_history") // 璁剧疆闇�瑕佺敓鎴愮殑琛ㄥ悕
+ .addInclude("sms_coupon_spu_category_relation") // 璁剧疆闇�瑕佺敓鎴愮殑琛ㄥ悕
+ .addInclude("sms_coupon_spu_relation") // 璁剧疆闇�瑕佺敓鎴愮殑琛ㄥ悕
+ .addInclude("sms_home_adv") // 璁剧疆闇�瑕佺敓鎴愮殑琛ㄥ悕
+ .addInclude("sms_home_subject") // 璁剧疆闇�瑕佺敓鎴愮殑琛ㄥ悕
+ .addInclude("sms_home_subject_spu") // 璁剧疆闇�瑕佺敓鎴愮殑琛ㄥ悕
+ .addInclude("sms_member_price") // 璁剧疆闇�瑕佺敓鎴愮殑琛ㄥ悕
+ .addInclude("sms_seckill_promotion") // 璁剧疆闇�瑕佺敓鎴愮殑琛ㄥ悕
+ .addInclude("sms_seckill_session") // 璁剧疆闇�瑕佺敓鎴愮殑琛ㄥ悕
+ .addInclude("sms_seckill_sku_notice") // 璁剧疆闇�瑕佺敓鎴愮殑琛ㄥ悕
+ .addInclude("sms_seckill_sku_relation") // 璁剧疆闇�瑕佺敓鎴愮殑琛ㄥ悕
+ .addInclude("sms_sku_full_reduction") // 璁剧疆闇�瑕佺敓鎴愮殑琛ㄥ悕
+ .addInclude("sms_sku_ladder") // 璁剧疆闇�瑕佺敓鎴愮殑琛ㄥ悕
+ .addInclude("sms_spu_bounds"); // 璁剧疆闇�瑕佺敓鎴愮殑琛ㄥ悕
builder.serviceBuilder()
@@ -71,7 +64,7 @@
builder.controllerBuilder()
.enableRestStyle(); // 寮�鍚敓鎴怈RestController 鎺у埗鍣紝涓嶉厤缃繖涓粯璁ゆ槸Controller娉ㄨВ锛孯estController鏄繑鍥濲son瀛楃涓茬殑锛屽鐢ㄤ簬鍓嶅悗绔垎绂婚」鐩��
builder.mapperBuilder()
- .enableMapperAnnotation() ;//寮�鍚� @Mapper 娉ㄨВ锛屼篃灏辨槸鍦╠ao鎺ュ彛涓婃坊鍔犱竴涓狜Mapper娉ㄨВ锛岃繖涓敞瑙g殑浣滅敤鏄紑鍚敞瑙fā寮忥紝灏卞彲浠ュ湪鎺ュ彛鐨勬娊璞℃柟娉曚笂闈㈢洿鎺ヤ娇鐢ˊSelect鍜孈Insert鍜孈Update鍜孈Delete娉ㄨВ銆�
+ .enableMapperAnnotation();//寮�鍚� @Mapper 娉ㄨВ锛屼篃灏辨槸鍦╠ao鎺ュ彛涓婃坊鍔犱竴涓狜Mapper娉ㄨВ锛岃繖涓敞瑙g殑浣滅敤鏄紑鍚敞瑙fā寮忥紝灏卞彲浠ュ湪鎺ュ彛鐨勬娊璞℃柟娉曚笂闈㈢洿鎺ヤ娇鐢ˊSelect鍜孈Insert鍜孈Update鍜孈Delete娉ㄨВ銆�
})
// .templateEngine(new FreemarkerTemplateEngine()) // 浣跨敤Freemarker寮曟搸妯℃澘锛岄粯璁ょ殑鏄疺elocity寮曟搸妯℃澘
.templateEngine(new VelocityTemplateEngine())
diff --git a/zhang-content/src/main/java/com/ruoyi/service/IZfPropertyService.java b/zhang-content/src/main/java/com/ruoyi/service/IZfPropertyService.java
index e6a397f..98e6878 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/IZfPropertyService.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/IZfPropertyService.java
@@ -16,6 +16,9 @@
*/
public interface IZfPropertyService extends IService<ZfProperty>
{
+
+ List<ZfProperty> selectByCondition(ZfProperty zfProperty);
+
AjaxResult selectUserList(ZfProperty zfProperty,Integer pageNum,Integer pageSize);
}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/IZfPropertyServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/IZfPropertyServiceImpl.java
index 09cf3f4..1f5bc62 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/impl/IZfPropertyServiceImpl.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/IZfPropertyServiceImpl.java
@@ -23,16 +23,27 @@
public class IZfPropertyServiceImpl extends ServiceImpl<ZfPropertyMapper, ZfProperty> implements IZfPropertyService {
@Override
+ public List<ZfProperty> selectByCondition(ZfProperty zfProperty) {
+ LambdaQueryWrapper<ZfProperty> lambdaQueryWrapper = buildCondition(zfProperty);
+ return list(lambdaQueryWrapper);
+ }
+
+ private LambdaQueryWrapper<ZfProperty> buildCondition(ZfProperty zfProperty) {
+ LambdaQueryWrapper<ZfProperty> lqw = new LambdaQueryWrapper<>();
+ lqw.like(!StringUtils.isEmpty(zfProperty.getType()),ZfProperty::getType, zfProperty.getType());
+ lqw.like(!StringUtils.isEmpty(zfProperty.getTitle()),ZfProperty::getTitle, zfProperty.getTitle());
+ lqw.like(!StringUtils.isEmpty(zfProperty.getLocation()),ZfProperty::getLocation, zfProperty.getLocation());
+ lqw.like(!StringUtils.isEmpty(zfProperty.getHolder()),ZfProperty::getHolder, zfProperty.getHolder());
+ lqw.like(!StringUtils.isEmpty(zfProperty.getAddress()),ZfProperty::getAddress, zfProperty.getAddress());
+ lqw.like(!StringUtils.isEmpty(zfProperty.getRemark()),ZfProperty::getRemark, zfProperty.getRemark());
+ lqw.like(zfProperty.getCreateTime()!=null,ZfProperty::getCreateTime, zfProperty.getCreateTime());
+ return lqw;
+ }
+
+ @Override
public AjaxResult selectUserList(ZfProperty zfProperty,Integer pageNum,Integer pageSize) {
- LambdaQueryWrapper<ZfProperty> lqw = new LambdaQueryWrapper<>();
- lqw.like(!StringUtils.isEmpty(zfProperty.getType()),ZfProperty::getType,zfProperty.getType());
- lqw.like(!StringUtils.isEmpty(zfProperty.getTitle()),ZfProperty::getTitle,zfProperty.getTitle());
- lqw.like(!StringUtils.isEmpty(zfProperty.getLocation()),ZfProperty::getLocation,zfProperty.getLocation());
- lqw.like(!StringUtils.isEmpty(zfProperty.getHolder()),ZfProperty::getHolder,zfProperty.getHolder());
- lqw.like(!StringUtils.isEmpty(zfProperty.getAddress()),ZfProperty::getAddress,zfProperty.getAddress());
- lqw.like(!StringUtils.isEmpty(zfProperty.getRemark()),ZfProperty::getRemark,zfProperty.getRemark());
- lqw.like(zfProperty.getCreateTime()!=null,ZfProperty::getCreateTime,zfProperty.getCreateTime());
+ LambdaQueryWrapper<ZfProperty> lqw = buildCondition(zfProperty);
Page<ZfProperty> zfPropertyPage = new Page<>(pageNum,pageSize);
Page<ZfProperty> pageResult = page(zfPropertyPage, lqw);
--
Gitblit v1.9.1