From aa45e4c9d7ebbad5f4a578dce8f99c3c7c52901a Mon Sep 17 00:00:00 2001 From: shizisheng Date: Fri, 6 Jun 2025 10:30:44 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=84=E8=AD=A6=E8=AE=B0=E5=BD=95=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E6=96=87=E4=BB=B6=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...sinessAlertConstructInfoOssController.java | 160 +++++++++++++++ .../domain/BusinessAlertConstructInfoOss.java | 74 +++++++ .../bo/BusinessAlertConstructInfoOssBo.java | 73 +++++++ .../vo/BusinessAlertConstructInfoOssVo.java | 88 ++++++++ .../BusinessAlertConstructInfoOssMapper.java | 20 ++ ...IBusinessAlertConstructInfoOssService.java | 69 +++++++ ...inessAlertConstructInfoOssServiceImpl.java | 193 ++++++++++++++++++ .../BusinessAlertConstructInfoOssMapper.xml | 12 ++ 8 files changed, 689 insertions(+) create mode 100644 dk-modules/business/src/main/java/org/dromara/business/controller/BusinessAlertConstructInfoOssController.java create mode 100644 dk-modules/business/src/main/java/org/dromara/business/domain/BusinessAlertConstructInfoOss.java create mode 100644 dk-modules/business/src/main/java/org/dromara/business/domain/bo/BusinessAlertConstructInfoOssBo.java create mode 100644 dk-modules/business/src/main/java/org/dromara/business/domain/vo/BusinessAlertConstructInfoOssVo.java create mode 100644 dk-modules/business/src/main/java/org/dromara/business/mapper/BusinessAlertConstructInfoOssMapper.java create mode 100644 dk-modules/business/src/main/java/org/dromara/business/service/IBusinessAlertConstructInfoOssService.java create mode 100644 dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertConstructInfoOssServiceImpl.java create mode 100644 dk-modules/business/src/main/resources/mapper/business/BusinessAlertConstructInfoOssMapper.xml diff --git a/dk-modules/business/src/main/java/org/dromara/business/controller/BusinessAlertConstructInfoOssController.java b/dk-modules/business/src/main/java/org/dromara/business/controller/BusinessAlertConstructInfoOssController.java new file mode 100644 index 0000000..4b28248 --- /dev/null +++ b/dk-modules/business/src/main/java/org/dromara/business/controller/BusinessAlertConstructInfoOssController.java @@ -0,0 +1,160 @@ +package org.dromara.business.controller; + +import java.io.IOException; +import java.net.URL; +import java.util.List; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.util.ObjectUtil; +import lombok.RequiredArgsConstructor; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.constraints.*; +import cn.dev33.satoken.annotation.SaCheckPermission; +import org.dromara.business.domain.BusinessAlertConstructInfoOss; +import org.dromara.business.utils.MinioUntil; +import org.dromara.business.utils.constants.MinIOConstants; +import org.dromara.common.core.exception.ServiceException; +import org.dromara.common.core.utils.StringUtils; +import org.dromara.common.core.utils.file.MimeTypeUtils; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.oss.core.OssClient; +import org.dromara.common.oss.entity.UploadResult; +import org.dromara.common.oss.factory.OssFactory; +import org.dromara.business.domain.bo.BusinessAlertConstructInfoOssBo; +import org.dromara.business.service.IBusinessAlertConstructInfoOssService; +import org.dromara.business.domain.vo.BusinessAlertConstructInfoOssVo; +import org.springframework.web.bind.annotation.*; +import org.springframework.validation.annotation.Validated; +import org.dromara.common.idempotent.annotation.RepeatSubmit; +import org.dromara.common.log.annotation.Log; +import org.dromara.common.web.core.BaseController; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.common.core.domain.R; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import org.dromara.common.log.enums.BusinessType; +import org.dromara.common.excel.utils.ExcelUtil; +import org.springframework.web.multipart.MultipartFile; + +/** + * 预警任务-施工信息-oss + * 前端访问路由地址为:/business/businessAlertConstructInfoOss + * + * @author szs + * @date 2025-06-04 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/alertConstructInfoOss") +public class BusinessAlertConstructInfoOssController extends BaseController { + + private final IBusinessAlertConstructInfoOssService businessAlertConstructInfoOssService; + + /** + * 查询预警任务-施工信息-oss列表 + */ +// @SaCheckPermission("business:businessAlertConstructInfoOss:list") + @GetMapping("/list") + public TableDataInfo list(BusinessAlertConstructInfoOssBo bo, PageQuery pageQuery) { + TableDataInfo businessAlertConstructInfoOssVoTableDataInfo = businessAlertConstructInfoOssService.queryPageList(bo, pageQuery); + return businessAlertConstructInfoOssVoTableDataInfo; + } + + + /** + * 预警任务-施工信息-oss - 上传 + */ +// @SaCheckPermission("business:businessAlertConstructInfoOss:upload") +// @Log(title = "预警任务-施工信息-oss", businessType = BusinessType.EXPORT) + @PostMapping("/upload") + public R upload(@RequestPart("file") MultipartFile file, BusinessAlertConstructInfoOssBo bo, HttpServletResponse response) { + if (ObjectUtil.isNull(file)) { + return R.fail("上传文件不能为空"); + } + if(ObjectUtil.isNull(bo.getAlertConstructInfoId())){ + return R.fail("施工信息ID不能为空!"); + } + + //文件上传 +// OssClient storage = OssFactory.instance(MinIOConstants.BUCKET_DKCY); + OssClient storage = OssFactory.instance(MinIOConstants.BUCKET_NANTONG); + String originalfileName = file.getOriginalFilename(); + String suffix = StringUtils.substring(originalfileName, originalfileName.lastIndexOf("."), originalfileName.length()); + UploadResult uploadResult; + try { + uploadResult = storage.uploadPrefix(file.getBytes(),"construct", suffix, originalfileName, file.getContentType()); + } catch (IOException e) { + throw new ServiceException(e.getMessage()); + } + //保存记录 + BusinessAlertConstructInfoOssBo businessAlertConstructInfoOssBo = new BusinessAlertConstructInfoOssBo(); + businessAlertConstructInfoOssBo.setAlertConstructInfoId(bo.getAlertConstructInfoId()); + businessAlertConstructInfoOssBo.setFileName(file.getName()); + businessAlertConstructInfoOssBo.setOriginalName(originalfileName); + businessAlertConstructInfoOssBo.setFileSuffix(suffix); + businessAlertConstructInfoOssBo.setUrl(uploadResult.getFilename()); //格式:construct/2025/06/05/46e26e2df3a94a2dabb0d445ad3438f2DJI_20250602104843_0001_V.jpeg + businessAlertConstructInfoOssBo.setService(storage.getConfigKey()); + businessAlertConstructInfoOssService.insertByBo(businessAlertConstructInfoOssBo); + return R.ok(businessAlertConstructInfoOssBo); + } + + /** + * 导出预警任务-施工信息-oss列表 + */ +// @SaCheckPermission("business:businessAlertConstructInfoOss:export") +// @Log(title = "预警任务-施工信息-oss", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(BusinessAlertConstructInfoOssBo bo, HttpServletResponse response) { + List list = businessAlertConstructInfoOssService.queryList(bo); + ExcelUtil.exportExcel(list, "预警任务-施工信息-oss", BusinessAlertConstructInfoOssVo.class, response); + } + + /** + * 获取预警任务-施工信息-oss详细信息 + * + * @param id 主键 + */ +// @SaCheckPermission("business:businessAlertConstructInfoOss:query") + @GetMapping("/{id}") + public R getInfo(@NotNull(message = "主键不能为空") + @PathVariable Long id) { + return R.ok(businessAlertConstructInfoOssService.queryById(id)); + } + + /** + * 新增预警任务-施工信息-oss + */ +// @SaCheckPermission("business:businessAlertConstructInfoOss:add") +// @Log(title = "预警任务-施工信息-oss", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R add(@Validated(AddGroup.class) @RequestBody BusinessAlertConstructInfoOssBo bo) { + return toAjax(businessAlertConstructInfoOssService.insertByBo(bo)); + } + + /** + * 修改预警任务-施工信息-oss + */ +// @SaCheckPermission("business:businessAlertConstructInfoOss:edit") +// @Log(title = "预警任务-施工信息-oss", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R edit(@Validated(EditGroup.class) @RequestBody BusinessAlertConstructInfoOssBo bo) { + return toAjax(businessAlertConstructInfoOssService.updateByBo(bo)); + } + + /** + * 删除预警任务-施工信息-oss + * + * @param ids 主键串 + */ +// @SaCheckPermission("business:businessAlertConstructInfoOss:remove") +// @Log(title = "预警任务-施工信息-oss", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public R remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] ids) { + Boolean result = businessAlertConstructInfoOssService.deleteWithValidByIds(List.of(ids), true); + return toAjax(result); + } +} diff --git a/dk-modules/business/src/main/java/org/dromara/business/domain/BusinessAlertConstructInfoOss.java b/dk-modules/business/src/main/java/org/dromara/business/domain/BusinessAlertConstructInfoOss.java new file mode 100644 index 0000000..07e4d61 --- /dev/null +++ b/dk-modules/business/src/main/java/org/dromara/business/domain/BusinessAlertConstructInfoOss.java @@ -0,0 +1,74 @@ +package org.dromara.business.domain; + +import org.dromara.common.tenant.core.TenantEntity; +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serial; + +/** + * 预警任务-施工信息-oss对象 business_alert_construct_info_oss + * + * @author szs + * @date 2025-06-04 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("business_alert_construct_info_oss") +public class BusinessAlertConstructInfoOss extends TenantEntity { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableId(value = "id") + private Long id; + + /** + * 施工信息ID + */ + private Long alertConstructInfoId; + + /** + * 施工信息 + */ + private Long alertConstructInfoName; + + /** + * 文件名 + */ + private String fileName; + + /** + * 原名 + */ + private String originalName; + + /** + * 文件后缀名 + */ + private String fileSuffix; + + /** + * URL地址 + */ + private String url; + + @TableField(exist = false) + private String previewUrl; + + /** + * 备注 + */ + private String remark; + + /** + * 服务商 + */ + private String service; + + +} diff --git a/dk-modules/business/src/main/java/org/dromara/business/domain/bo/BusinessAlertConstructInfoOssBo.java b/dk-modules/business/src/main/java/org/dromara/business/domain/bo/BusinessAlertConstructInfoOssBo.java new file mode 100644 index 0000000..d340f85 --- /dev/null +++ b/dk-modules/business/src/main/java/org/dromara/business/domain/bo/BusinessAlertConstructInfoOssBo.java @@ -0,0 +1,73 @@ +package org.dromara.business.domain.bo; + +import org.dromara.business.domain.BusinessAlertConstructInfoOss; +import org.dromara.common.mybatis.core.domain.BaseEntity; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; +import lombok.EqualsAndHashCode; +import jakarta.validation.constraints.*; + +/** + * 预警任务-施工信息-oss业务对象 business_alert_construct_info_oss + * + * @author szs + * @date 2025-06-04 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@AutoMapper(target = BusinessAlertConstructInfoOss.class, reverseConvertGenerate = false) +public class BusinessAlertConstructInfoOssBo extends BaseEntity { + + /** + * 主键 + */ + @NotNull(message = "主键不能为空", groups = { EditGroup.class }) + private Long id; + + /** + * 施工信息ID + */ + @NotNull(message = "施工信息ID不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long alertConstructInfoId; + + /** + * 施工信息 + */ + private Long alertConstructInfoName; + + /** + * 文件名 + */ + @NotBlank(message = "文件名不能为空", groups = { AddGroup.class, EditGroup.class }) + private String fileName; + + /** + * 原名 + */ + private String originalName; + + /** + * 文件后缀名 + */ + private String fileSuffix; + + /** + * URL地址 + */ + private String url; + + /** + * 备注 + */ + private String remark; + + /** + * 服务商 + */ + @NotBlank(message = "服务商不能为空", groups = { AddGroup.class, EditGroup.class }) + private String service; + + +} diff --git a/dk-modules/business/src/main/java/org/dromara/business/domain/vo/BusinessAlertConstructInfoOssVo.java b/dk-modules/business/src/main/java/org/dromara/business/domain/vo/BusinessAlertConstructInfoOssVo.java new file mode 100644 index 0000000..a6270a5 --- /dev/null +++ b/dk-modules/business/src/main/java/org/dromara/business/domain/vo/BusinessAlertConstructInfoOssVo.java @@ -0,0 +1,88 @@ +package org.dromara.business.domain.vo; + +import org.dromara.business.domain.BusinessAlertConstructInfoOss; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import org.dromara.common.excel.annotation.ExcelDictFormat; +import org.dromara.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; + + + +/** + * 预警任务-施工信息-oss视图对象 business_alert_construct_info_oss + * + * @author szs + * @date 2025-06-04 + */ +@Data +@ExcelIgnoreUnannotated +@AutoMapper(target = BusinessAlertConstructInfoOss.class) +public class BusinessAlertConstructInfoOssVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @ExcelProperty(value = "主键") + private Long id; + + /** + * 施工信息ID + */ + @ExcelProperty(value = "施工信息ID") + private Long alertConstructInfoId; + + /** + * 施工信息 + */ + @ExcelProperty(value = "施工信息") + private Long alertConstructInfoName; + + /** + * 文件名 + */ + @ExcelProperty(value = "文件名") + private String fileName; + + /** + * 原名 + */ + @ExcelProperty(value = "原名") + private String originalName; + + /** + * 文件后缀名 + */ + @ExcelProperty(value = "文件后缀名") + private String fileSuffix; + + /** + * URL地址 + */ + @ExcelProperty(value = "URL地址") + private String url; + + private String previewUrl; + + /** + * 备注 + */ + @ExcelProperty(value = "备注") + private String remark; + + /** + * 服务商 + */ + @ExcelProperty(value = "服务商") + private String service; + + +} diff --git a/dk-modules/business/src/main/java/org/dromara/business/mapper/BusinessAlertConstructInfoOssMapper.java b/dk-modules/business/src/main/java/org/dromara/business/mapper/BusinessAlertConstructInfoOssMapper.java new file mode 100644 index 0000000..ccccccc --- /dev/null +++ b/dk-modules/business/src/main/java/org/dromara/business/mapper/BusinessAlertConstructInfoOssMapper.java @@ -0,0 +1,20 @@ +package org.dromara.business.mapper; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.ibatis.annotations.Param; +import org.dromara.business.domain.BusinessAlertConstructInfoOss; +import org.dromara.business.domain.vo.BusinessAlertConstructInfoOssVo; +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; + +/** + * 预警任务-施工信息-ossMapper接口 + * + * @author szs + * @date 2025-06-04 + */ +public interface BusinessAlertConstructInfoOssMapper extends BaseMapperPlus { + + Page selectVoPageData(@Param("page") Page page,@Param("ew") QueryWrapper qw); +} diff --git a/dk-modules/business/src/main/java/org/dromara/business/service/IBusinessAlertConstructInfoOssService.java b/dk-modules/business/src/main/java/org/dromara/business/service/IBusinessAlertConstructInfoOssService.java new file mode 100644 index 0000000..4ab5544 --- /dev/null +++ b/dk-modules/business/src/main/java/org/dromara/business/service/IBusinessAlertConstructInfoOssService.java @@ -0,0 +1,69 @@ +package org.dromara.business.service; + +import org.dromara.business.domain.BusinessAlertConstructInfoOss; +import org.dromara.business.domain.vo.BusinessAlertConstructInfoOssVo; +import org.dromara.business.domain.bo.BusinessAlertConstructInfoOssBo; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; + +import java.util.Collection; +import java.util.List; + +/** + * 预警任务-施工信息-ossService接口 + * + * @author szs + * @date 2025-06-04 + */ +public interface IBusinessAlertConstructInfoOssService { + + /** + * 查询预警任务-施工信息-oss + * + * @param id 主键 + * @return 预警任务-施工信息-oss + */ + BusinessAlertConstructInfoOssVo queryById(Long id); + + /** + * 分页查询预警任务-施工信息-oss列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 预警任务-施工信息-oss分页列表 + */ + TableDataInfo queryPageList(BusinessAlertConstructInfoOssBo bo, PageQuery pageQuery); + + /** + * 查询符合条件的预警任务-施工信息-oss列表 + * + * @param bo 查询条件 + * @return 预警任务-施工信息-oss列表 + */ + List queryList(BusinessAlertConstructInfoOssBo bo); + + /** + * 新增预警任务-施工信息-oss + * + * @param bo 预警任务-施工信息-oss + * @return 是否新增成功 + */ + Boolean insertByBo(BusinessAlertConstructInfoOssBo bo); + + /** + * 修改预警任务-施工信息-oss + * + * @param bo 预警任务-施工信息-oss + * @return 是否修改成功 + */ + Boolean updateByBo(BusinessAlertConstructInfoOssBo bo); + + /** + * 校验并批量删除预警任务-施工信息-oss信息 + * + * @param ids 待删除的主键集合 + * @param isValid 是否进行有效性校验 + * @return 是否删除成功 + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); +} diff --git a/dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertConstructInfoOssServiceImpl.java b/dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertConstructInfoOssServiceImpl.java new file mode 100644 index 0000000..79c362d --- /dev/null +++ b/dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertConstructInfoOssServiceImpl.java @@ -0,0 +1,193 @@ +package org.dromara.business.service.impl; + +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import org.dromara.business.domain.BusinessAlert; +import org.dromara.business.service.IBusinessAlertConstructInfoOssService; +import org.dromara.business.utils.MinioUntil; +import org.dromara.business.utils.constants.MinIOConstants; +import org.dromara.common.core.utils.MapstructUtils; +import org.dromara.common.core.utils.StringUtils; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; +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.dromara.business.domain.BusinessAlertConstructInfoOss; +import org.dromara.business.domain.bo.BusinessAlertConstructInfoOssBo; +import org.dromara.business.domain.vo.BusinessAlertConstructInfoOssVo; +import org.dromara.business.mapper.BusinessAlertConstructInfoOssMapper; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; +import java.util.Collection; + +/** + * 预警任务-施工信息-ossService业务层处理 + * + * @author szs + * @date 2025-06-04 + */ +@RequiredArgsConstructor +@Service +public class BusinessAlertConstructInfoOssServiceImpl implements IBusinessAlertConstructInfoOssService { + + private final BusinessAlertConstructInfoOssMapper baseMapper; + + /** + * 查询预警任务-施工信息-oss + * + * @param id 主键 + * @return 预警任务-施工信息-oss + */ + @Override + public BusinessAlertConstructInfoOssVo queryById(Long id){ + return baseMapper.selectVoById(id); + } + + /** + * 分页查询预警任务-施工信息-oss列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 预警任务-施工信息-oss分页列表 + */ + @Override + public TableDataInfo queryPageList(BusinessAlertConstructInfoOssBo bo, PageQuery pageQuery) { + QueryWrapper wrapper = buildQueryWrapperQuery(bo); + Page result = baseMapper.selectVoPageData(pageQuery.build(), wrapper); + result.getRecords().forEach(item -> { + item.setPreviewUrl(MinioUntil.getObjectUrlOne(MinIOConstants.BUCKET_NANTONG, item.getUrl(), 3600).toString()); + }); + return TableDataInfo.build(result); + } + + /** + * 查询符合条件的预警任务-施工信息-oss列表 + * + * @param bo 查询条件 + * @return 预警任务-施工信息-oss列表 + */ + @Override + public List queryList(BusinessAlertConstructInfoOssBo bo) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private LambdaQueryWrapper buildQueryWrapper(BusinessAlertConstructInfoOssBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.eq(bo.getAlertConstructInfoId() != null, BusinessAlertConstructInfoOss::getAlertConstructInfoId, bo.getAlertConstructInfoId()); + lqw.like(bo.getAlertConstructInfoName() != null, BusinessAlertConstructInfoOss::getAlertConstructInfoName, bo.getAlertConstructInfoName()); + lqw.like(StringUtils.isNotBlank(bo.getFileName()), BusinessAlertConstructInfoOss::getFileName, bo.getFileName()); + lqw.like(StringUtils.isNotBlank(bo.getOriginalName()), BusinessAlertConstructInfoOss::getOriginalName, bo.getOriginalName()); + lqw.eq(StringUtils.isNotBlank(bo.getFileSuffix()), BusinessAlertConstructInfoOss::getFileSuffix, bo.getFileSuffix()); + lqw.eq(StringUtils.isNotBlank(bo.getUrl()), BusinessAlertConstructInfoOss::getUrl, bo.getUrl()); + lqw.eq(StringUtils.isNotBlank(bo.getService()), BusinessAlertConstructInfoOss::getService, bo.getService()); + return lqw; + } + + private QueryWrapper buildQueryWrapperQuery(BusinessAlertConstructInfoOssBo bo) { + QueryWrapper wrapper = new QueryWrapper<>(); + if(ObjectUtil.isNotEmpty(bo.getId())){ + wrapper.eq("t.id", bo.getId()); + } + if(ObjectUtil.isNotEmpty(bo.getAlertConstructInfoId())){ + wrapper.eq("t.alert_construct_info_id", bo.getAlertConstructInfoId()); + } + if(ObjectUtil.isNotEmpty(bo.getAlertConstructInfoName())){ + wrapper.eq("t.alert_construct_info_name", bo.getAlertConstructInfoName()); + } + if(ObjectUtil.isNotEmpty(bo.getFileName())){ + wrapper.eq("t.file_name", bo.getFileName()); + } + + if(ObjectUtil.isNotEmpty(bo.getOriginalName())){ + wrapper.eq("t.original_name", bo.getOriginalName()); + } + if(ObjectUtil.isNotEmpty(bo.getFileSuffix())){ + wrapper.eq("t.file_suffix", bo.getFileSuffix()); + } + if(ObjectUtil.isNotEmpty(bo.getUrl())){ + wrapper.eq("t.url", bo.getUrl()); + } + if(ObjectUtil.isNotEmpty(bo.getCreateDept())){ + wrapper.eq("t.create_dept", bo.getCreateDept()); + } + if(ObjectUtil.isNotEmpty(bo.getCreateTime())){ + wrapper.eq("t.create_time", bo.getCreateTime()); + } + if(ObjectUtil.isNotEmpty(bo.getCreateBy())){ + wrapper.eq("t.create_by", bo.getCreateBy()); + } + + if(ObjectUtil.isNotEmpty(bo.getUpdateTime())){ + wrapper.eq("t.update_time", bo.getUpdateTime()); + } + + if(ObjectUtil.isNotEmpty(bo.getUpdateBy())){ + wrapper.eq("t.update_by", bo.getUpdateBy()); + } + if(ObjectUtil.isNotEmpty(bo.getRemark())){ + wrapper.eq("t.remark", bo.getRemark()); + } + if(ObjectUtil.isNotEmpty(bo.getService())){ + wrapper.eq("t.service", bo.getService()); + } + return wrapper; + } + + /** + * 新增预警任务-施工信息-oss + * + * @param bo 预警任务-施工信息-oss + * @return 是否新增成功 + */ + @Override + public Boolean insertByBo(BusinessAlertConstructInfoOssBo bo) { + BusinessAlertConstructInfoOss add = MapstructUtils.convert(bo, BusinessAlertConstructInfoOss.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setId(add.getId()); + } + return flag; + } + + /** + * 修改预警任务-施工信息-oss + * + * @param bo 预警任务-施工信息-oss + * @return 是否修改成功 + */ + @Override + public Boolean updateByBo(BusinessAlertConstructInfoOssBo bo) { + BusinessAlertConstructInfoOss update = MapstructUtils.convert(bo, BusinessAlertConstructInfoOss.class); + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(BusinessAlertConstructInfoOss entity){ + //TODO 做一些数据校验,如唯一约束 + } + + /** + * 校验并批量删除预警任务-施工信息-oss信息 + * + * @param ids 待删除的主键集合 + * @param isValid 是否进行有效性校验 + * @return 是否删除成功 + */ + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if(isValid){ + //TODO 做一些业务上的校验,判断是否需要校验 + } + return baseMapper.deleteByIds(ids) > 0; + } +} diff --git a/dk-modules/business/src/main/resources/mapper/business/BusinessAlertConstructInfoOssMapper.xml b/dk-modules/business/src/main/resources/mapper/business/BusinessAlertConstructInfoOssMapper.xml new file mode 100644 index 0000000..f05efa0 --- /dev/null +++ b/dk-modules/business/src/main/resources/mapper/business/BusinessAlertConstructInfoOssMapper.xml @@ -0,0 +1,12 @@ + + + + + + +