Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -75,6 +75,11 @@
|
||||
<artifactId>giftBook-job</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.xxzhx.giftBook</groupId>
|
||||
<artifactId>giftBook-main</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 代码生成-->
|
||||
<dependency>
|
||||
<groupId>cn.xxzhx.giftBook</groupId>
|
||||
|
||||
@@ -107,7 +107,7 @@ public class AuthController {
|
||||
Long userId = LoginHelper.getUserId();
|
||||
scheduledExecutorService.schedule(() -> {
|
||||
SseMessageDto dto = new SseMessageDto();
|
||||
dto.setMessage("欢迎登录giftBook后台管理系统");
|
||||
dto.setMessage("欢迎登录礼薄后台管理系统");
|
||||
dto.setUserIds(List.of(userId));
|
||||
SseMessageUtils.publishMessage(dto);
|
||||
}, 5, TimeUnit.SECONDS);
|
||||
|
||||
@@ -245,3 +245,7 @@ justauth:
|
||||
client-id: 10**********6
|
||||
client-secret: 1f7d08**********5b7**********29e
|
||||
redirect-uri: ${justauth.address}/social-callback?source=gitlab
|
||||
|
||||
# 字体文件路径
|
||||
ttfFile:
|
||||
path: E:\giftBook\MicrosoftYaHei.ttf
|
||||
|
||||
@@ -63,24 +63,6 @@ spring:
|
||||
# url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
||||
# username:
|
||||
# password:
|
||||
# oracle:
|
||||
# type: ${spring.datasource.type}
|
||||
# driverClassName: oracle.jdbc.OracleDriver
|
||||
# url: jdbc:oracle:thin:@//localhost:1521/XE
|
||||
# username: ROOT
|
||||
# password: root
|
||||
# postgres:
|
||||
# type: ${spring.datasource.type}
|
||||
# driverClassName: org.postgresql.Driver
|
||||
# url: jdbc:postgresql://localhost:5432/postgres?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true
|
||||
# username: root
|
||||
# password: root
|
||||
# sqlserver:
|
||||
# type: ${spring.datasource.type}
|
||||
# driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||
# url: jdbc:sqlserver://localhost:1433;DatabaseName=tempdb;SelectMethod=cursor;encrypt=false;rewriteBatchedStatements=true
|
||||
# username: SA
|
||||
# password: root
|
||||
hikari:
|
||||
# 最大连接池数量
|
||||
maxPoolSize: 20
|
||||
@@ -265,3 +247,7 @@ justauth:
|
||||
client-id: 10**********6
|
||||
client-secret: 1f7d08**********5b7**********29e
|
||||
redirect-uri: ${justauth.address}/social-callback?source=gitlab
|
||||
|
||||
# 字体文件路径
|
||||
ttfFile:
|
||||
path: /usr/local/project/giftBook/jar/fonts/MicrosoftYaHei.ttf
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<description>
|
||||
ruoyi-common-bom common依赖项
|
||||
giftBook-common-bom common依赖项
|
||||
</description>
|
||||
|
||||
<properties>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<artifactId>giftBook-common-core</artifactId>
|
||||
|
||||
<description>
|
||||
ruoyi-common-core 核心模块
|
||||
giftBook-common-core 核心模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<artifactId>giftBook-common-doc</artifactId>
|
||||
|
||||
<description>
|
||||
ruoyi-common-doc 系统接口
|
||||
giftBook-common-doc 系统接口
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<artifactId>giftBook-common-encrypt</artifactId>
|
||||
|
||||
<description>
|
||||
ruoyi-common-encrypt 数据加解密模块
|
||||
giftBook-common-encrypt 数据加解密模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<artifactId>giftBook-common-excel</artifactId>
|
||||
|
||||
<description>
|
||||
ruoyi-common-excel
|
||||
giftBook-common-excel
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<artifactId>giftBook-common-idempotent</artifactId>
|
||||
|
||||
<description>
|
||||
ruoyi-common-idempotent 幂等功能
|
||||
giftBook-common-idempotent 幂等功能
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<artifactId>giftBook-common-job</artifactId>
|
||||
|
||||
<description>
|
||||
ruoyi-common-job 定时任务
|
||||
giftBook-common-job 定时任务
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<artifactId>giftBook-common-json</artifactId>
|
||||
|
||||
<description>
|
||||
ruoyi-common-json 序列化模块
|
||||
giftBook-common-json 序列化模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<artifactId>giftBook-common-log</artifactId>
|
||||
|
||||
<description>
|
||||
ruoyi-common-log 日志记录
|
||||
giftBook-common-log 日志记录
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<artifactId>giftBook-common-mail</artifactId>
|
||||
|
||||
<description>
|
||||
ruoyi-common-mail 邮件模块
|
||||
giftBook-common-mail 邮件模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<artifactId>giftBook-common-mybatis</artifactId>
|
||||
|
||||
<description>
|
||||
ruoyi-common-mybatis 数据库服务
|
||||
giftBook-common-mybatis 数据库服务
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<artifactId>giftBook-common-oss</artifactId>
|
||||
|
||||
<description>
|
||||
ruoyi-common-oss oss服务
|
||||
giftBook-common-oss oss服务
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<artifactId>giftBook-common-ratelimiter</artifactId>
|
||||
|
||||
<description>
|
||||
ruoyi-common-ratelimiter 限流功能
|
||||
giftBook-common-ratelimiter 限流功能
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<artifactId>giftBook-common-redis</artifactId>
|
||||
|
||||
<description>
|
||||
ruoyi-common-redis 缓存服务
|
||||
giftBook-common-redis 缓存服务
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<artifactId>giftBook-common-security</artifactId>
|
||||
|
||||
<description>
|
||||
ruoyi-common-security 安全模块
|
||||
giftBook-common-security 安全模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<artifactId>giftBook-common-sensitive</artifactId>
|
||||
|
||||
<description>
|
||||
ruoyi-common-sensitive 脱敏模块
|
||||
giftBook-common-sensitive 脱敏模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<artifactId>giftBook-common-sms</artifactId>
|
||||
|
||||
<description>
|
||||
ruoyi-common-sms 短信模块
|
||||
giftBook-common-sms 短信模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<artifactId>giftBook-common-social</artifactId>
|
||||
|
||||
<description>
|
||||
ruoyi-common-social 授权认证
|
||||
giftBook-common-social 授权认证
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<artifactId>giftBook-common-sse</artifactId>
|
||||
|
||||
<description>
|
||||
ruoyi-common-sse 模块
|
||||
giftBook-common-sse 模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<artifactId>giftBook-common-tenant</artifactId>
|
||||
|
||||
<description>
|
||||
ruoyi-common-tenant 租户模块
|
||||
giftBook-common-tenant 租户模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<artifactId>giftBook-common-translation</artifactId>
|
||||
|
||||
<description>
|
||||
ruoyi-common-translation 通用翻译功能
|
||||
giftBook-common-translation 通用翻译功能
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<artifactId>giftBook-common-web</artifactId>
|
||||
|
||||
<description>
|
||||
ruoyi-common-web web服务
|
||||
giftBook-common-web web服务
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<artifactId>giftBook-common-websocket</artifactId>
|
||||
|
||||
<description>
|
||||
ruoyi-common-websocket 模块
|
||||
giftBook-common-websocket 模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -47,7 +47,7 @@ public class TestExcelController {
|
||||
list.add(new TestObj("单列表测试1", "列表测试1", "列表测试2", "列表测试3", "列表测试4"));
|
||||
list.add(new TestObj("单列表测试2", "列表测试5", "列表测试6", "列表测试7", "列表测试8"));
|
||||
list.add(new TestObj("单列表测试3", "列表测试9", "列表测试10", "列表测试11", "列表测试12"));
|
||||
ExcelUtil.exportTemplate(CollUtil.newArrayList(map, list), "单列表.xlsx", "excel/单列表.xlsx", response);
|
||||
ExcelUtil.exportTemplate(CollUtil.newArrayList(map, list), "singleList.xlsx", "excel/singleList.xlsx", response);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -81,7 +81,7 @@ public class TestExcelController {
|
||||
multiListMap.put("data2", list2);
|
||||
multiListMap.put("data3", list3);
|
||||
multiListMap.put("data4", list4);
|
||||
ExcelUtil.exportTemplateMultiList(multiListMap, "多列表.xlsx", "excel/多列表.xlsx", response);
|
||||
ExcelUtil.exportTemplateMultiList(multiListMap, "multipleLists.xlsx", "excel/multipleLists.xlsx", response);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -126,7 +126,7 @@ public class TestExcelController {
|
||||
list.add(sheetMap2);
|
||||
list.add(sheetMap3);
|
||||
list.add(sheetMap4);
|
||||
ExcelUtil.exportTemplateMultiSheet(list, "多sheet列表", "excel/多sheet列表.xlsx", response);
|
||||
ExcelUtil.exportTemplateMultiSheet(list, "多sheet列表", "excel/multiSheetLists.xlsx", response);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
75
giftBook-modules/giftBook-main/pom.xml
Normal file
75
giftBook-modules/giftBook-main/pom.xml
Normal file
@@ -0,0 +1,75 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>cn.xxzhx.giftBook</groupId>
|
||||
<artifactId>giftBook-modules</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>giftBook-main</artifactId>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<!-- 通用工具-->
|
||||
<dependency>
|
||||
<groupId>cn.xxzhx.giftBook</groupId>
|
||||
<artifactId>giftBook-common-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.xxzhx.giftBook</groupId>
|
||||
<artifactId>giftBook-common-doc</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.xxzhx.giftBook</groupId>
|
||||
<artifactId>giftBook-common-mybatis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.xxzhx.giftBook</groupId>
|
||||
<artifactId>giftBook-common-translation</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- excel-->
|
||||
<dependency>
|
||||
<groupId>cn.xxzhx.giftBook</groupId>
|
||||
<artifactId>giftBook-common-excel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.xxzhx.giftBook</groupId>
|
||||
<artifactId>giftBook-common-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.xxzhx.giftBook</groupId>
|
||||
<artifactId>giftBook-common-log</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.xxzhx.giftBook</groupId>
|
||||
<artifactId>giftBook-common-idempotent</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.xxzhx.giftBook</groupId>
|
||||
<artifactId>giftBook-common-tenant</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- iText 9 -->
|
||||
<dependency>
|
||||
<groupId>com.itextpdf</groupId>
|
||||
<artifactId>kernel</artifactId>
|
||||
<version>9.1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.itextpdf</groupId>
|
||||
<artifactId>layout</artifactId>
|
||||
<version>9.1.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,105 @@
|
||||
package cn.xxzhx.giftBook.main.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import cn.xxzhx.giftBook.common.idempotent.annotation.RepeatSubmit;
|
||||
import cn.xxzhx.giftBook.common.log.annotation.Log;
|
||||
import cn.xxzhx.giftBook.common.web.core.BaseController;
|
||||
import cn.xxzhx.giftBook.common.mybatis.core.page.PageQuery;
|
||||
import cn.xxzhx.giftBook.common.core.domain.R;
|
||||
import cn.xxzhx.giftBook.common.core.validate.AddGroup;
|
||||
import cn.xxzhx.giftBook.common.core.validate.EditGroup;
|
||||
import cn.xxzhx.giftBook.common.log.enums.BusinessType;
|
||||
import cn.xxzhx.giftBook.common.excel.utils.ExcelUtil;
|
||||
import cn.xxzhx.giftBook.main.domain.vo.TGiftBookVo;
|
||||
import cn.xxzhx.giftBook.main.domain.bo.TGiftBookBo;
|
||||
import cn.xxzhx.giftBook.main.service.ITGiftBookService;
|
||||
import cn.xxzhx.giftBook.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 礼薄
|
||||
*
|
||||
* @author xzh
|
||||
* @date 2025-03-24
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/main/giftBook")
|
||||
public class TGiftBookController extends BaseController {
|
||||
|
||||
private final ITGiftBookService tGiftBookService;
|
||||
|
||||
/**
|
||||
* 查询礼薄列表
|
||||
*/
|
||||
@SaCheckPermission("main:giftBook:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<TGiftBookVo> list(TGiftBookBo bo, PageQuery pageQuery) {
|
||||
return tGiftBookService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出礼薄列表
|
||||
*/
|
||||
@SaCheckPermission("main:giftBook:export")
|
||||
@Log(title = "礼薄", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(TGiftBookBo bo, HttpServletResponse response) {
|
||||
List<TGiftBookVo> list = tGiftBookService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "礼薄", TGiftBookVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取礼薄详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("main:giftBook:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<TGiftBookVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return R.ok(tGiftBookService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增礼薄
|
||||
*/
|
||||
@SaCheckPermission("main:giftBook:add")
|
||||
@Log(title = "礼薄", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody TGiftBookBo bo) {
|
||||
return toAjax(tGiftBookService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改礼薄
|
||||
*/
|
||||
@SaCheckPermission("main:giftBook:edit")
|
||||
@Log(title = "礼薄", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody TGiftBookBo bo) {
|
||||
return toAjax(tGiftBookService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除礼薄
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("main:giftBook:remove")
|
||||
@Log(title = "礼薄", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(tGiftBookService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
package cn.xxzhx.giftBook.main.controller;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import cn.xxzhx.giftBook.common.idempotent.annotation.RepeatSubmit;
|
||||
import cn.xxzhx.giftBook.common.log.annotation.Log;
|
||||
import cn.xxzhx.giftBook.common.web.core.BaseController;
|
||||
import cn.xxzhx.giftBook.common.mybatis.core.page.PageQuery;
|
||||
import cn.xxzhx.giftBook.common.core.domain.R;
|
||||
import cn.xxzhx.giftBook.common.core.validate.AddGroup;
|
||||
import cn.xxzhx.giftBook.common.core.validate.EditGroup;
|
||||
import cn.xxzhx.giftBook.common.log.enums.BusinessType;
|
||||
import cn.xxzhx.giftBook.common.excel.utils.ExcelUtil;
|
||||
import cn.xxzhx.giftBook.main.domain.vo.TGiftBookDetailsVo;
|
||||
import cn.xxzhx.giftBook.main.domain.bo.TGiftBookDetailsBo;
|
||||
import cn.xxzhx.giftBook.main.service.ITGiftBookDetailsService;
|
||||
import cn.xxzhx.giftBook.common.mybatis.core.page.TableDataInfo;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 礼薄详情
|
||||
*
|
||||
* @author xzh
|
||||
* @date 2025-03-24
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/main/giftBookDetails")
|
||||
public class TGiftBookDetailsController extends BaseController {
|
||||
|
||||
private final ITGiftBookDetailsService tGiftBookDetailsService;
|
||||
|
||||
/**
|
||||
* 查询礼薄详情列表
|
||||
*/
|
||||
@SaCheckPermission("main:giftBookDetails:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<TGiftBookDetailsVo> list(TGiftBookDetailsBo bo, PageQuery pageQuery) {
|
||||
return tGiftBookDetailsService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出礼薄详情列表
|
||||
*/
|
||||
@SaCheckPermission("main:giftBookDetails:export")
|
||||
@Log(title = "礼薄详情", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(TGiftBookDetailsBo bo, HttpServletResponse response) {
|
||||
List<TGiftBookDetailsVo> list = tGiftBookDetailsService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "礼薄明细", TGiftBookDetailsVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载礼薄详情模板
|
||||
*/
|
||||
@SaCheckPermission("main:giftBookDetails:import")
|
||||
@PostMapping("/importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
ExcelUtil.exportExcel(new ArrayList<>(), "礼薄详情模板", TGiftBookDetailsVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入礼薄详情
|
||||
*/
|
||||
@SaCheckPermission("main:giftBookDetails:import")
|
||||
@Log(title = "礼薄详情", businessType = BusinessType.IMPORT)
|
||||
@PostMapping(value = "/importData", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
public R<Void> importData(@RequestPart("file") MultipartFile file, boolean updateSupport) throws Exception {
|
||||
List<TGiftBookDetailsVo> tGiftBookDetailsVos = ExcelUtil.importExcel(file.getInputStream(), TGiftBookDetailsVo.class);
|
||||
return R.ok(tGiftBookDetailsService.importData(tGiftBookDetailsVos));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取礼薄详情详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("main:giftBookDetails:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<TGiftBookDetailsVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return R.ok(tGiftBookDetailsService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增礼薄详情
|
||||
*/
|
||||
@SaCheckPermission("main:giftBookDetails:add")
|
||||
@Log(title = "礼薄详情", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody TGiftBookDetailsBo bo) {
|
||||
return toAjax(tGiftBookDetailsService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改礼薄详情
|
||||
*/
|
||||
@SaCheckPermission("main:giftBookDetails:edit")
|
||||
@Log(title = "礼薄详情", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody TGiftBookDetailsBo bo) {
|
||||
return toAjax(tGiftBookDetailsService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除礼薄详情
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("main:giftBookDetails:remove")
|
||||
@Log(title = "礼薄详情", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(tGiftBookDetailsService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出礼薄详情pdf
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@SaCheckPermission("main:giftBookDetails:export")
|
||||
@Log(title = "礼薄详情", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/exportPDF")
|
||||
public void exportPDF(TGiftBookDetailsBo bo, HttpServletResponse response) throws IOException {
|
||||
// 设置响应头
|
||||
response.setContentType("application/pdf");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\"giftBookDetails.pdf\"");
|
||||
|
||||
// 生成PDF并写入响应流
|
||||
byte[] pdfBytes = tGiftBookDetailsService.exportPDF(bo);
|
||||
response.getOutputStream().write(pdfBytes);
|
||||
response.getOutputStream().flush();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package cn.xxzhx.giftBook.main.domain;
|
||||
|
||||
import cn.xxzhx.giftBook.common.tenant.core.TenantEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 礼薄对象 t_gift_book
|
||||
*
|
||||
* @author xzh
|
||||
* @date 2025-03-24
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("t_gift_book")
|
||||
public class TGiftBook extends TenantEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 删除标识(0:未删除,1:已删除)
|
||||
*/
|
||||
private Integer delFlag;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 礼薄名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package cn.xxzhx.giftBook.main.domain;
|
||||
|
||||
import cn.xxzhx.giftBook.common.tenant.core.TenantEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 礼薄详情对象 t_gift_book_details
|
||||
*
|
||||
* @author xzh
|
||||
* @date 2025-03-24
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("t_gift_book_details")
|
||||
public class TGiftBookDetails extends TenantEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 删除标识(0:未删除,1:已删除)
|
||||
*/
|
||||
private Integer delFlag;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 礼薄ID
|
||||
*/
|
||||
private Long giftBookId;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 年份
|
||||
*/
|
||||
private String year;
|
||||
|
||||
/**
|
||||
* 类型(字典:gift_book_event_type)
|
||||
*/
|
||||
private String eventType;
|
||||
|
||||
/**
|
||||
* 金额
|
||||
*/
|
||||
private Long amount;
|
||||
|
||||
/**
|
||||
* 礼物名称
|
||||
*/
|
||||
private String giftName;
|
||||
|
||||
/**
|
||||
* 事件名称
|
||||
*/
|
||||
private String eventName;
|
||||
|
||||
/**
|
||||
* 是否已还(字典:sys_yes_no)
|
||||
*/
|
||||
private String isReturn;
|
||||
|
||||
|
||||
/**
|
||||
* 地址
|
||||
*/
|
||||
private String address;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package cn.xxzhx.giftBook.main.domain.bo;
|
||||
|
||||
import cn.xxzhx.giftBook.common.core.validate.EditGroup;
|
||||
import cn.xxzhx.giftBook.main.domain.TGiftBook;
|
||||
import cn.xxzhx.giftBook.common.mybatis.core.domain.BaseEntity;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 礼薄业务对象 t_gift_book
|
||||
*
|
||||
* @author xzh
|
||||
* @date 2025-03-24
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = TGiftBook.class, reverseConvertGenerate = false)
|
||||
public class TGiftBookBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@NotNull(message = "ID不能为空", groups = { EditGroup.class })
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 删除标识(0:未删除,1:已删除)
|
||||
*/
|
||||
private Integer delFlag;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 礼薄名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package cn.xxzhx.giftBook.main.domain.bo;
|
||||
|
||||
import cn.xxzhx.giftBook.common.core.validate.EditGroup;
|
||||
import cn.xxzhx.giftBook.main.domain.TGiftBookDetails;
|
||||
import cn.xxzhx.giftBook.common.mybatis.core.domain.BaseEntity;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 礼薄详情业务对象 t_gift_book_details
|
||||
*
|
||||
* @author xzh
|
||||
* @date 2025-03-24
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = TGiftBookDetails.class, reverseConvertGenerate = false)
|
||||
public class TGiftBookDetailsBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@NotNull(message = "ID不能为空", groups = { EditGroup.class })
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 删除标识(0:未删除,1:已删除)
|
||||
*/
|
||||
private Integer delFlag;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 礼薄ID
|
||||
*/
|
||||
private Long giftBookId;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 年份
|
||||
*/
|
||||
private String year;
|
||||
|
||||
/**
|
||||
* 类型(字典:gift_book_event_type)
|
||||
*/
|
||||
private String eventType;
|
||||
|
||||
/**
|
||||
* 金额
|
||||
*/
|
||||
private Long amount;
|
||||
|
||||
/**
|
||||
* 礼物名称
|
||||
*/
|
||||
private String giftName;
|
||||
|
||||
/**
|
||||
* 事件名称
|
||||
*/
|
||||
private String eventName;
|
||||
|
||||
/**
|
||||
* 是否已还(字典:sys_yes_no)
|
||||
*/
|
||||
private String isReturn;
|
||||
|
||||
/**
|
||||
* 地址
|
||||
*/
|
||||
private String address;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package cn.xxzhx.giftBook.main.domain.vo;
|
||||
|
||||
import cn.xxzhx.giftBook.main.domain.TGiftBookDetails;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import cn.xxzhx.giftBook.common.excel.annotation.ExcelDictFormat;
|
||||
import cn.xxzhx.giftBook.common.excel.convert.ExcelDictConvert;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 礼薄详情视图对象 t_gift_book_details
|
||||
*
|
||||
* @author xzh
|
||||
* @date 2025-03-24
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = TGiftBookDetails.class)
|
||||
public class TGiftBookDetailsVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 删除标识(0:未删除,1:已删除)
|
||||
*/
|
||||
private Integer delFlag;
|
||||
|
||||
/**
|
||||
* 礼薄ID
|
||||
*/
|
||||
private Long giftBookId;
|
||||
|
||||
/**
|
||||
* 礼薄
|
||||
*/
|
||||
@ExcelProperty(value = "礼薄")
|
||||
private String giftBookName;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
@ExcelProperty(value = "姓名")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 年份
|
||||
*/
|
||||
@ExcelProperty(value = "年份")
|
||||
private String year;
|
||||
|
||||
/**
|
||||
* 类型(字典:gift_book_event_type)
|
||||
*/
|
||||
@ExcelProperty(value = "类型", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(dictType = "gift_book_event_type")
|
||||
private String eventType;
|
||||
|
||||
/**
|
||||
* 金额
|
||||
*/
|
||||
@ExcelProperty(value = "金额")
|
||||
private Long amount;
|
||||
|
||||
/**
|
||||
* 礼物名称
|
||||
*/
|
||||
@ExcelProperty(value = "礼物名称")
|
||||
private String giftName;
|
||||
|
||||
/**
|
||||
* 事件名称
|
||||
*/
|
||||
@ExcelProperty(value = "事件名称")
|
||||
private String eventName;
|
||||
|
||||
/**
|
||||
* 是否已还(字典:sys_yes_no)
|
||||
*/
|
||||
@ExcelProperty(value = "是否已还", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(dictType = "sys_yes_no")
|
||||
private String isReturn;
|
||||
|
||||
/**
|
||||
* 地址
|
||||
*/
|
||||
@ExcelProperty(value = "地址")
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package cn.xxzhx.giftBook.main.domain.vo;
|
||||
|
||||
import cn.xxzhx.giftBook.main.domain.TGiftBook;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import cn.xxzhx.giftBook.common.excel.annotation.ExcelDictFormat;
|
||||
import cn.xxzhx.giftBook.common.excel.convert.ExcelDictConvert;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 礼薄视图对象 t_gift_book
|
||||
*
|
||||
* @author xzh
|
||||
* @date 2025-03-24
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = TGiftBook.class)
|
||||
public class TGiftBookVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 删除标识(0:未删除,1:已删除)
|
||||
*/
|
||||
private Integer delFlag;
|
||||
|
||||
/**
|
||||
* 礼薄名称
|
||||
*/
|
||||
@ExcelProperty(value = "礼薄名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package cn.xxzhx.giftBook.main.mapper;
|
||||
|
||||
import cn.xxzhx.giftBook.common.mybatis.core.page.PageQuery;
|
||||
import cn.xxzhx.giftBook.main.domain.TGiftBookDetails;
|
||||
import cn.xxzhx.giftBook.main.domain.bo.TGiftBookDetailsBo;
|
||||
import cn.xxzhx.giftBook.main.domain.vo.TGiftBookDetailsVo;
|
||||
import cn.xxzhx.giftBook.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 礼薄详情Mapper接口
|
||||
*
|
||||
* @author xzh
|
||||
* @date 2025-03-24
|
||||
*/
|
||||
public interface TGiftBookDetailsMapper extends BaseMapperPlus<TGiftBookDetails, TGiftBookDetailsVo> {
|
||||
|
||||
Page<TGiftBookDetailsVo> selectPageList(@Param("bo") TGiftBookDetailsBo bo, IPage<TGiftBookDetailsVo> page);
|
||||
|
||||
List<TGiftBookDetailsVo> queryList(@Param("bo") TGiftBookDetailsBo bo,@Param("pageQuery") PageQuery pageQuery);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package cn.xxzhx.giftBook.main.mapper;
|
||||
|
||||
import cn.xxzhx.giftBook.main.domain.TGiftBook;
|
||||
import cn.xxzhx.giftBook.main.domain.vo.TGiftBookVo;
|
||||
import cn.xxzhx.giftBook.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 礼薄Mapper接口
|
||||
*
|
||||
* @author xzh
|
||||
* @date 2025-03-24
|
||||
*/
|
||||
public interface TGiftBookMapper extends BaseMapperPlus<TGiftBook, TGiftBookVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package cn.xxzhx.giftBook.main.service;
|
||||
|
||||
import cn.xxzhx.giftBook.main.domain.vo.TGiftBookDetailsVo;
|
||||
import cn.xxzhx.giftBook.main.domain.bo.TGiftBookDetailsBo;
|
||||
import cn.xxzhx.giftBook.common.mybatis.core.page.TableDataInfo;
|
||||
import cn.xxzhx.giftBook.common.mybatis.core.page.PageQuery;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 礼薄详情Service接口
|
||||
*
|
||||
* @author xzh
|
||||
* @date 2025-03-24
|
||||
*/
|
||||
public interface ITGiftBookDetailsService {
|
||||
|
||||
/**
|
||||
* 查询礼薄详情
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 礼薄详情
|
||||
*/
|
||||
TGiftBookDetailsVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询礼薄详情列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 礼薄详情分页列表
|
||||
*/
|
||||
TableDataInfo<TGiftBookDetailsVo> queryPageList(TGiftBookDetailsBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的礼薄详情列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 礼薄详情列表
|
||||
*/
|
||||
List<TGiftBookDetailsVo> queryList(TGiftBookDetailsBo bo);
|
||||
|
||||
/**
|
||||
* 新增礼薄详情
|
||||
*
|
||||
* @param bo 礼薄详情
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(TGiftBookDetailsBo bo);
|
||||
|
||||
/**
|
||||
* 修改礼薄详情
|
||||
*
|
||||
* @param bo 礼薄详情
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(TGiftBookDetailsBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除礼薄详情信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
String importData(List<TGiftBookDetailsVo> tGiftBookDetailsVos);
|
||||
|
||||
byte[] exportPDF(TGiftBookDetailsBo bo);
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package cn.xxzhx.giftBook.main.service;
|
||||
|
||||
import cn.xxzhx.giftBook.main.domain.vo.TGiftBookVo;
|
||||
import cn.xxzhx.giftBook.main.domain.bo.TGiftBookBo;
|
||||
import cn.xxzhx.giftBook.common.mybatis.core.page.TableDataInfo;
|
||||
import cn.xxzhx.giftBook.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 礼薄Service接口
|
||||
*
|
||||
* @author xzh
|
||||
* @date 2025-03-24
|
||||
*/
|
||||
public interface ITGiftBookService {
|
||||
|
||||
/**
|
||||
* 查询礼薄
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 礼薄
|
||||
*/
|
||||
TGiftBookVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询礼薄列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 礼薄分页列表
|
||||
*/
|
||||
TableDataInfo<TGiftBookVo> queryPageList(TGiftBookBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的礼薄列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 礼薄列表
|
||||
*/
|
||||
List<TGiftBookVo> queryList(TGiftBookBo bo);
|
||||
|
||||
/**
|
||||
* 新增礼薄
|
||||
*
|
||||
* @param bo 礼薄
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(TGiftBookBo bo);
|
||||
|
||||
/**
|
||||
* 修改礼薄
|
||||
*
|
||||
* @param bo 礼薄
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(TGiftBookBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除礼薄信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@@ -0,0 +1,358 @@
|
||||
package cn.xxzhx.giftBook.main.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.http.HtmlUtil;
|
||||
import cn.xxzhx.giftBook.common.core.exception.ServiceException;
|
||||
import cn.xxzhx.giftBook.common.core.utils.MapstructUtils;
|
||||
import cn.xxzhx.giftBook.common.core.utils.StreamUtils;
|
||||
import cn.xxzhx.giftBook.common.core.utils.StringUtils;
|
||||
import cn.xxzhx.giftBook.common.mybatis.core.page.PageQuery;
|
||||
import cn.xxzhx.giftBook.common.mybatis.core.page.TableDataInfo;
|
||||
import cn.xxzhx.giftBook.main.domain.TGiftBookDetails;
|
||||
import cn.xxzhx.giftBook.main.domain.bo.TGiftBookBo;
|
||||
import cn.xxzhx.giftBook.main.domain.bo.TGiftBookDetailsBo;
|
||||
import cn.xxzhx.giftBook.main.domain.vo.TGiftBookDetailsVo;
|
||||
import cn.xxzhx.giftBook.main.domain.vo.TGiftBookVo;
|
||||
import cn.xxzhx.giftBook.main.mapper.TGiftBookDetailsMapper;
|
||||
import cn.xxzhx.giftBook.main.service.ITGiftBookDetailsService;
|
||||
import cn.xxzhx.giftBook.main.service.ITGiftBookService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.itextpdf.io.font.PdfEncodings;
|
||||
import com.itextpdf.io.source.ByteArrayOutputStream;
|
||||
import com.itextpdf.kernel.font.PdfFont;
|
||||
import com.itextpdf.kernel.font.PdfFontFactory;
|
||||
import com.itextpdf.kernel.geom.PageSize;
|
||||
import com.itextpdf.kernel.pdf.PdfDocument;
|
||||
import com.itextpdf.kernel.pdf.PdfPage;
|
||||
import com.itextpdf.kernel.pdf.PdfWriter;
|
||||
import com.itextpdf.kernel.pdf.canvas.PdfCanvas;
|
||||
import com.itextpdf.layout.Document;
|
||||
import com.itextpdf.layout.element.AreaBreak;
|
||||
import com.itextpdf.layout.element.Cell;
|
||||
import com.itextpdf.layout.element.Paragraph;
|
||||
import com.itextpdf.layout.element.Table;
|
||||
import com.itextpdf.layout.properties.TextAlignment;
|
||||
import com.itextpdf.layout.properties.UnitValue;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.ConstraintViolation;
|
||||
import jakarta.validation.ConstraintViolationException;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 礼薄详情Service业务层处理
|
||||
*
|
||||
* @author xzh
|
||||
* @date 2025-03-24
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class TGiftBookDetailsServiceImpl implements ITGiftBookDetailsService {
|
||||
|
||||
private final TGiftBookDetailsMapper baseMapper;
|
||||
|
||||
private final ITGiftBookService giftBookService;
|
||||
|
||||
@Value("${ttfFile.path}")
|
||||
private String ttfPath;
|
||||
|
||||
|
||||
/**
|
||||
* 查询礼薄详情
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 礼薄详情
|
||||
*/
|
||||
@Override
|
||||
public TGiftBookDetailsVo queryById(Long id) {
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询礼薄详情列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 礼薄详情分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<TGiftBookDetailsVo> queryPageList(TGiftBookDetailsBo bo, PageQuery pageQuery) {
|
||||
// LambdaQueryWrapper<TGiftBookDetails> lqw = buildQueryWrapper(bo);
|
||||
// Page<TGiftBookDetailsVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
Page<TGiftBookDetailsVo> result = baseMapper.selectPageList(bo, pageQuery.build());
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的礼薄详情列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 礼薄详情列表
|
||||
*/
|
||||
@Override
|
||||
public List<TGiftBookDetailsVo> queryList(TGiftBookDetailsBo bo) {
|
||||
// LambdaQueryWrapper<TGiftBookDetails> lqw = buildQueryWrapper(bo);
|
||||
// return baseMapper.selectVoList(lqw);
|
||||
PageQuery pageQuery = new PageQuery(-1, 0);
|
||||
return baseMapper.queryList(bo, pageQuery);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<TGiftBookDetails> buildQueryWrapper(TGiftBookDetailsBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<TGiftBookDetails> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByAsc(TGiftBookDetails::getId);
|
||||
lqw.eq(bo.getGiftBookId() != null, TGiftBookDetails::getGiftBookId, bo.getGiftBookId());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getName()), TGiftBookDetails::getName, bo.getName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getEventType()), TGiftBookDetails::getEventType, bo.getEventType());
|
||||
lqw.eq(bo.getAmount() != null, TGiftBookDetails::getAmount, bo.getAmount());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getGiftName()), TGiftBookDetails::getGiftName, bo.getGiftName());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getEventName()), TGiftBookDetails::getEventName, bo.getEventName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getAddress()), TGiftBookDetails::getAddress, bo.getAddress());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增礼薄详情
|
||||
*
|
||||
* @param bo 礼薄详情
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(TGiftBookDetailsBo bo) {
|
||||
TGiftBookDetails add = MapstructUtils.convert(bo, TGiftBookDetails.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改礼薄详情
|
||||
*
|
||||
* @param bo 礼薄详情
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(TGiftBookDetailsBo bo) {
|
||||
TGiftBookDetails update = MapstructUtils.convert(bo, TGiftBookDetails.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(TGiftBookDetails entity) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除礼薄详情信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if (isValid) {
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
List<TGiftBookDetails> list = new ArrayList<>();
|
||||
TGiftBookDetails giftBookDetails;
|
||||
for (Long id : ids) {
|
||||
giftBookDetails = new TGiftBookDetails();
|
||||
giftBookDetails.setId(id);
|
||||
giftBookDetails.setDelFlag(1);
|
||||
list.add(giftBookDetails);
|
||||
}
|
||||
return baseMapper.updateBatchById(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String importData(List<TGiftBookDetailsVo> tGiftBookDetailsVos) {
|
||||
int successNum = 0;
|
||||
int failureNum = 0;
|
||||
StringBuilder successMsg = new StringBuilder();
|
||||
StringBuilder failureMsg = new StringBuilder();
|
||||
List<TGiftBookVo> tGiftBookVos = giftBookService.queryList(new TGiftBookBo());
|
||||
Map<String, List<TGiftBookVo>> giftBookMap = tGiftBookVos.stream().collect(Collectors.groupingBy(TGiftBookVo::getName));
|
||||
for (TGiftBookDetailsVo tGiftBookDetailsVo : tGiftBookDetailsVos) {
|
||||
try {
|
||||
List<TGiftBookVo> giftBookVos = giftBookMap.get(tGiftBookDetailsVo.getGiftBookName());
|
||||
if (CollectionUtil.isEmpty(giftBookVos)) {
|
||||
throw new ServiceException("未找到名字为:" + tGiftBookDetailsVo.getGiftBookName() + "请核对礼薄名称!");
|
||||
}
|
||||
TGiftBookVo tGiftBookVo = giftBookVos.get(0);
|
||||
tGiftBookDetailsVo.setGiftBookId(tGiftBookVo.getId());
|
||||
successNum++;
|
||||
} catch (RuntimeException e) {
|
||||
failureNum++;
|
||||
String msg = "<br/>" + failureNum + "、账号 " + HtmlUtil.cleanHtmlTag(tGiftBookDetailsVo.getName()) + " 导入失败:";
|
||||
String message = e.getMessage();
|
||||
if (e instanceof ConstraintViolationException cvException) {
|
||||
message = StreamUtils.join(cvException.getConstraintViolations(), ConstraintViolation::getMessage, ", ");
|
||||
}
|
||||
failureMsg.append(msg).append(message);
|
||||
}
|
||||
}
|
||||
if (successNum > 0) {
|
||||
List<TGiftBookDetails> giftBookDetails = MapstructUtils.convert(tGiftBookDetailsVos, TGiftBookDetails.class);
|
||||
baseMapper.insertBatch(giftBookDetails);
|
||||
}
|
||||
if (failureNum > 0) {
|
||||
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
||||
return failureMsg.toString();
|
||||
} else {
|
||||
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条。");
|
||||
return successMsg.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] exportPDF(TGiftBookDetailsBo bo) {
|
||||
PageQuery pageQuery = new PageQuery(-1, 0);
|
||||
pageQuery.setOrderByColumn("name");
|
||||
pageQuery.setIsAsc("asc");
|
||||
List<TGiftBookDetailsVo> tGiftBookDetailsVos = baseMapper.queryList(bo, pageQuery);
|
||||
try {
|
||||
return createPdf(tGiftBookDetailsVos);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("导出PDF失败!错误:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] createPdf(List<TGiftBookDetailsVo> list) throws IOException {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
PdfWriter writer = new PdfWriter(baos);
|
||||
// 创建 PDF 文档
|
||||
PdfDocument pdfDoc = new PdfDocument(writer);
|
||||
Document document = new Document(pdfDoc, PageSize.A4, false);
|
||||
|
||||
// 设置字体
|
||||
PdfFont font = PdfFontFactory.createFont(ttfPath, PdfEncodings.IDENTITY_H);
|
||||
document.setFont(font);
|
||||
pdfDoc.addNewPage();
|
||||
|
||||
// 4. 统计每页姓氏
|
||||
Map<Integer, Set<String>> pageSurnameMap = new LinkedHashMap<>();
|
||||
|
||||
// 5. 生成数据页(先不创建目录页)
|
||||
Table table = new Table(new float[]{2, 2, 2, 2}); // 多列表格
|
||||
table.setWidth(UnitValue.createPercentValue(100)).setFont(font).setFontSize(17).setTextAlignment(TextAlignment.CENTER);
|
||||
|
||||
List<Table> tableList = new ArrayList<>();
|
||||
// 拼接
|
||||
List<String> cellList;
|
||||
BigDecimal totalAmount = new BigDecimal(0);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (i % 21 == 0 && i != 0) { // 每 22 行换页
|
||||
table.addCell(new Cell(1, 4).add(new Paragraph("总计:" + totalAmount.intValue())));
|
||||
totalAmount = new BigDecimal(0);
|
||||
tableList.add(table);
|
||||
table = new Table(new float[]{2, 2, 2, 2}); // 多列表格
|
||||
table.setWidth(UnitValue.createPercentValue(100)).setFont(font).setFontSize(17).setTextAlignment(TextAlignment.CENTER);
|
||||
}
|
||||
|
||||
TGiftBookDetailsVo tGiftBookDetailsVo = list.get(i);
|
||||
table.addCell(new Cell().add(new Paragraph(tGiftBookDetailsVo.getYear() + "年")).setWidth(100));
|
||||
table.addCell(new Cell().add(new Paragraph(tGiftBookDetailsVo.getName())).setWidth(100));
|
||||
String amount = null == tGiftBookDetailsVo.getAmount() ? "0" : String.valueOf(tGiftBookDetailsVo.getAmount());
|
||||
table.addCell(new Cell().add(new Paragraph(amount)).setWidth(100));
|
||||
totalAmount = totalAmount.add(new BigDecimal(amount));
|
||||
// 拼接
|
||||
cellList = new ArrayList<>();
|
||||
if (StringUtils.isNotBlank(tGiftBookDetailsVo.getAddress())) {
|
||||
cellList.add(tGiftBookDetailsVo.getAddress());
|
||||
}
|
||||
if (StringUtils.isNotBlank(tGiftBookDetailsVo.getGiftName())) {
|
||||
cellList.add(tGiftBookDetailsVo.getGiftName());
|
||||
}
|
||||
if (StringUtils.isNotBlank(tGiftBookDetailsVo.getEventName())) {
|
||||
cellList.add(tGiftBookDetailsVo.getEventName());
|
||||
}
|
||||
if (StringUtils.isNotBlank(tGiftBookDetailsVo.getRemark())) {
|
||||
cellList.add(tGiftBookDetailsVo.getRemark());
|
||||
}
|
||||
if (StringUtils.isNotBlank(tGiftBookDetailsVo.getIsReturn()) && "1".equals(tGiftBookDetailsVo.getIsReturn())) {
|
||||
cellList.add("已还");
|
||||
}
|
||||
|
||||
table.addCell(new Cell().add(new Paragraph(String.join("/", cellList))));
|
||||
|
||||
// 记录姓氏
|
||||
String surname = tGiftBookDetailsVo.getName().substring(0, 1);
|
||||
pageSurnameMap.computeIfAbsent((tableList.size() + 1), k -> new LinkedHashSet<>()).add(surname);
|
||||
}
|
||||
// 最后一页
|
||||
tableList.add(table);
|
||||
table.addCell(new Cell(1, 4).add(new Paragraph("总计:" + totalAmount.intValue())));
|
||||
|
||||
// 最后插入目录页
|
||||
Document directoryDoc = new Document(pdfDoc);
|
||||
|
||||
for (Map.Entry<Integer, Set<String>> entry : pageSurnameMap.entrySet()) {
|
||||
int pageNum = entry.getKey();
|
||||
String surnames = String.join("、", entry.getValue());
|
||||
directoryDoc.add(new Paragraph("第 " + pageNum + " 页 ------ " + surnames).setFont(font).setFontSize(17));
|
||||
}
|
||||
BigDecimal size = new BigDecimal(pageSurnameMap.size());
|
||||
BigDecimal section = new BigDecimal(20);
|
||||
BigDecimal bigDecimal = size.divide(section, 2, RoundingMode.HALF_UP);
|
||||
int num = 0;
|
||||
// 是否是整数
|
||||
num = bigDecimal.intValue();
|
||||
String string = bigDecimal.toString();
|
||||
String[] split = string.split("\\.");
|
||||
if (Integer.parseInt(split[1]) > 0) {
|
||||
num = bigDecimal.intValue() + 1;
|
||||
}
|
||||
for (int i = 0; i < num; i++) {
|
||||
document.add(new AreaBreak()); // 换页
|
||||
}
|
||||
|
||||
for (int i = 0; i < tableList.size(); i++) {
|
||||
Table table1 = tableList.get(i);
|
||||
document.add(table1);
|
||||
if (i != tableList.size() - 1) {
|
||||
document.add(new AreaBreak()); // 换页
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 7. 添加页码(从第二页开始)
|
||||
// 1. 先给 PDF 添加页码
|
||||
int totalPages = pdfDoc.getNumberOfPages();
|
||||
for (int i = num + 1; i <= totalPages; i++) {
|
||||
PdfPage page = pdfDoc.getPage(i);
|
||||
PdfCanvas canvas = new PdfCanvas(page);
|
||||
String pageText = "第 " + (i - num) + " 页"; // 目录是第一页,所以 -1
|
||||
float x = page.getPageSize().getWidth() / 2 - 20; // 居中
|
||||
float y = 20; // 页脚高度 20px
|
||||
|
||||
canvas.beginText()
|
||||
.setFontAndSize(font, 16)
|
||||
.moveText(x, y)
|
||||
.showText(pageText)
|
||||
.endText()
|
||||
.release();
|
||||
}
|
||||
|
||||
// 8. 关闭文档
|
||||
document.close();
|
||||
return baos.toByteArray();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
package cn.xxzhx.giftBook.main.service.impl;
|
||||
|
||||
import cn.xxzhx.giftBook.common.core.utils.MapstructUtils;
|
||||
import cn.xxzhx.giftBook.common.core.utils.StringUtils;
|
||||
import cn.xxzhx.giftBook.common.mybatis.core.page.TableDataInfo;
|
||||
import cn.xxzhx.giftBook.common.mybatis.core.page.PageQuery;
|
||||
import cn.xxzhx.giftBook.main.domain.TGiftBookDetails;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import cn.xxzhx.giftBook.main.domain.bo.TGiftBookBo;
|
||||
import cn.xxzhx.giftBook.main.domain.vo.TGiftBookVo;
|
||||
import cn.xxzhx.giftBook.main.domain.TGiftBook;
|
||||
import cn.xxzhx.giftBook.main.mapper.TGiftBookMapper;
|
||||
import cn.xxzhx.giftBook.main.service.ITGiftBookService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 礼薄Service业务层处理
|
||||
*
|
||||
* @author xzh
|
||||
* @date 2025-03-24
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class TGiftBookServiceImpl implements ITGiftBookService {
|
||||
|
||||
private final TGiftBookMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询礼薄
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 礼薄
|
||||
*/
|
||||
@Override
|
||||
public TGiftBookVo queryById(Long id){
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询礼薄列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 礼薄分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<TGiftBookVo> queryPageList(TGiftBookBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<TGiftBook> lqw = buildQueryWrapper(bo);
|
||||
Page<TGiftBookVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的礼薄列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 礼薄列表
|
||||
*/
|
||||
@Override
|
||||
public List<TGiftBookVo> queryList(TGiftBookBo bo) {
|
||||
LambdaQueryWrapper<TGiftBook> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<TGiftBook> buildQueryWrapper(TGiftBookBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<TGiftBook> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByAsc(TGiftBook::getId);
|
||||
lqw.like(StringUtils.isNotBlank(bo.getName()), TGiftBook::getName, bo.getName());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增礼薄
|
||||
*
|
||||
* @param bo 礼薄
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(TGiftBookBo bo) {
|
||||
TGiftBook add = MapstructUtils.convert(bo, TGiftBook.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改礼薄
|
||||
*
|
||||
* @param bo 礼薄
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(TGiftBookBo bo) {
|
||||
TGiftBook update = MapstructUtils.convert(bo, TGiftBook.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(TGiftBook entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除礼薄信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
List<TGiftBook> list = new ArrayList<>();
|
||||
TGiftBook giftBook;
|
||||
for (Long id : ids) {
|
||||
giftBook = new TGiftBook();
|
||||
giftBook.setId(id);
|
||||
giftBook.setDelFlag(1);
|
||||
list.add(giftBook);
|
||||
}
|
||||
return baseMapper.updateBatchById(list);
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.xxzhx.giftBook.main.mapper.TGiftBookDetailsMapper">
|
||||
|
||||
<select id="selectPageList" resultType="cn.xxzhx.giftBook.main.domain.vo.TGiftBookDetailsVo">
|
||||
SELECT tgbd.*, tgb.name giftBookName
|
||||
FROM t_gift_book tgb
|
||||
LEFT JOIN t_gift_book_details tgbd on tgbd.gift_book_id = tgb.id
|
||||
<where>
|
||||
and tgb.del_flag = 0
|
||||
and tgbd.del_flag = 0
|
||||
<if test="null != bo.giftBookId">
|
||||
and tgb.id = #{bo.giftBookId}
|
||||
</if>
|
||||
<if test="null != bo.name">
|
||||
and tgbd.name like concat('%', #{bo.name}, '%')
|
||||
</if>
|
||||
<if test="null != bo.eventType">
|
||||
and tgbd.event_type = #{bo.eventType}
|
||||
</if>
|
||||
<if test="null != bo.address">
|
||||
and tgbd.address like concat('%', #{bo.address}, '%')
|
||||
</if>
|
||||
<if test="null != bo.eventName">
|
||||
and tgbd.event_name like concat('%', #{bo.eventName}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="queryList" resultType="cn.xxzhx.giftBook.main.domain.vo.TGiftBookDetailsVo">
|
||||
SELECT tgbd.*, tgb.name giftBookName
|
||||
FROM t_gift_book tgb
|
||||
LEFT JOIN t_gift_book_details tgbd on tgbd.gift_book_id = tgb.id
|
||||
<where>
|
||||
and tgb.del_flag = 0
|
||||
and tgbd.del_flag = 0
|
||||
<if test="null != bo.giftBookId">
|
||||
and tgb.id = #{bo.giftBookId}
|
||||
</if>
|
||||
<if test="null != bo.name">
|
||||
and tgbd.name like concat('%', #{bo.name}, '%')
|
||||
</if>
|
||||
<if test="null != bo.eventType">
|
||||
and tgbd.event_type = #{bo.eventType}
|
||||
</if>
|
||||
<if test="null != bo.address">
|
||||
and tgbd.address like concat('%', #{bo.address}, '%')
|
||||
</if>
|
||||
<if test="null != bo.eventName">
|
||||
and tgbd.event_name like concat('%', #{bo.eventName}, '%')
|
||||
</if>
|
||||
</where>
|
||||
order by
|
||||
<choose>
|
||||
<when test="'name' == pageQuery.orderByColumn">
|
||||
CONVERT(tgbd.${pageQuery.orderByColumn} USING gbk) ${pageQuery.isAsc}
|
||||
</when>
|
||||
<when test="null != pageQuery.isAsc and pageQuery.isAsc.length() > 0">
|
||||
tgbd.${pageQuery.orderByColumn} ${pageQuery.isAsc}
|
||||
</when>
|
||||
<otherwise>
|
||||
tgbd.update_time desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.xxzhx.giftBook.main.mapper.TGiftBookMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -15,13 +15,14 @@
|
||||
<module>giftBook-job</module>
|
||||
<module>giftBook-system</module>
|
||||
<module>giftBook-workflow</module>
|
||||
<module>giftBook-main</module>
|
||||
</modules>
|
||||
|
||||
<artifactId>giftBook-modules</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<description>
|
||||
ruoyi-modules 业务模块
|
||||
giftBook-modules 业务模块
|
||||
</description>
|
||||
|
||||
</project>
|
||||
|
||||
6
pom.xml
6
pom.xml
@@ -344,6 +344,12 @@
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.xxzhx.giftBook</groupId>
|
||||
<artifactId>giftBook-main</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.xxzhx.giftBook</groupId>
|
||||
<artifactId>giftBook-generator</artifactId>
|
||||
|
||||
Reference in New Issue
Block a user