添加礼薄模块
This commit is contained in:
63
giftBook-modules/giftBook-main/pom.xml
Normal file
63
giftBook-modules/giftBook-main/pom.xml
Normal file
@@ -0,0 +1,63 @@
|
||||
<?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>
|
||||
</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,129 @@
|
||||
package cn.xxzhx.giftBook.main.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cn.xxzhx.giftBook.common.excel.core.ExcelResult;
|
||||
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));
|
||||
}
|
||||
}
|
||||
@@ -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(TGiftBookDetailsBo bo);
|
||||
}
|
||||
@@ -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,71 @@
|
||||
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 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);
|
||||
|
||||
}
|
||||
@@ -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,200 @@
|
||||
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.TableDataInfo;
|
||||
import cn.xxzhx.giftBook.common.mybatis.core.page.PageQuery;
|
||||
import cn.xxzhx.giftBook.main.domain.bo.TGiftBookBo;
|
||||
import cn.xxzhx.giftBook.main.domain.vo.TGiftBookVo;
|
||||
import cn.xxzhx.giftBook.main.service.ITGiftBookService;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import jakarta.validation.ConstraintViolation;
|
||||
import jakarta.validation.ConstraintViolationException;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import cn.xxzhx.giftBook.main.domain.bo.TGiftBookDetailsBo;
|
||||
import cn.xxzhx.giftBook.main.domain.vo.TGiftBookDetailsVo;
|
||||
import cn.xxzhx.giftBook.main.domain.TGiftBookDetails;
|
||||
import cn.xxzhx.giftBook.main.mapper.TGiftBookDetailsMapper;
|
||||
import cn.xxzhx.giftBook.main.service.ITGiftBookDetailsService;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 查询礼薄详情
|
||||
*
|
||||
* @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);
|
||||
return baseMapper.queryList(bo);
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?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 != giftBookId">
|
||||
and tgb.id = #{giftBookId}
|
||||
</if>
|
||||
<if test="null != name">
|
||||
and tgbd.name like concat('%', #{name}, '%')
|
||||
</if>
|
||||
<if test="null != eventType">
|
||||
and tgbd.event_type = #{eventType}
|
||||
</if>
|
||||
<if test="null != address">
|
||||
and tgbd.address like concat('%', #{address}, '%')
|
||||
</if>
|
||||
<if test="null != eventName">
|
||||
and tgbd.event_name like concat('%', #{eventName}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</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>
|
||||
Reference in New Issue
Block a user