43 changed files with 1263 additions and 140 deletions
@ -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<BusinessAlertConstructInfoOss> list(BusinessAlertConstructInfoOssBo bo, PageQuery pageQuery) { |
||||
|
TableDataInfo<BusinessAlertConstructInfoOss> businessAlertConstructInfoOssVoTableDataInfo = businessAlertConstructInfoOssService.queryPageList(bo, pageQuery); |
||||
|
return businessAlertConstructInfoOssVoTableDataInfo; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 预警任务-施工信息-oss - 上传 |
||||
|
*/ |
||||
|
// @SaCheckPermission("business:businessAlertConstructInfoOss:upload")
|
||||
|
// @Log(title = "预警任务-施工信息-oss", businessType = BusinessType.EXPORT)
|
||||
|
@PostMapping("/upload") |
||||
|
public R<BusinessAlertConstructInfoOssBo> 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<BusinessAlertConstructInfoOssVo> list = businessAlertConstructInfoOssService.queryList(bo); |
||||
|
ExcelUtil.exportExcel(list, "预警任务-施工信息-oss", BusinessAlertConstructInfoOssVo.class, response); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取预警任务-施工信息-oss详细信息 |
||||
|
* |
||||
|
* @param id 主键 |
||||
|
*/ |
||||
|
// @SaCheckPermission("business:businessAlertConstructInfoOss:query")
|
||||
|
@GetMapping("/{id}") |
||||
|
public R<BusinessAlertConstructInfoOssVo> 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<Void> 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<Void> 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<Void> remove(@NotEmpty(message = "主键不能为空") |
||||
|
@PathVariable Long[] ids) { |
||||
|
Boolean result = businessAlertConstructInfoOssService.deleteWithValidByIds(List.of(ids), true); |
||||
|
return toAjax(result); |
||||
|
} |
||||
|
} |
@ -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; |
||||
|
|
||||
|
|
||||
|
} |
@ -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; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,23 @@ |
|||||
|
package org.dromara.business.domain.model.enums; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum LayerTypeEnum { |
||||
|
|
||||
|
menu(0,"目录"), |
||||
|
|
||||
|
threeDimensional(1,"三维"), |
||||
|
|
||||
|
vector(2,"矢量"), |
||||
|
|
||||
|
image(3,"影像"); |
||||
|
|
||||
|
|
||||
|
private Integer type; |
||||
|
|
||||
|
private String desc; |
||||
|
|
||||
|
} |
@ -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; |
||||
|
|
||||
|
|
||||
|
} |
@ -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<BusinessAlertConstructInfoOss, BusinessAlertConstructInfoOssVo> { |
||||
|
|
||||
|
Page<BusinessAlertConstructInfoOss> selectVoPageData(@Param("page") Page<BusinessAlertConstructInfoOss> page,@Param("ew") QueryWrapper<BusinessAlertConstructInfoOss> qw); |
||||
|
} |
@ -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<BusinessAlertConstructInfoOss> queryPageList(BusinessAlertConstructInfoOssBo bo, PageQuery pageQuery); |
||||
|
|
||||
|
/** |
||||
|
* 查询符合条件的预警任务-施工信息-oss列表 |
||||
|
* |
||||
|
* @param bo 查询条件 |
||||
|
* @return 预警任务-施工信息-oss列表 |
||||
|
*/ |
||||
|
List<BusinessAlertConstructInfoOssVo> 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<Long> ids, Boolean isValid); |
||||
|
} |
@ -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<BusinessAlertConstructInfoOss> queryPageList(BusinessAlertConstructInfoOssBo bo, PageQuery pageQuery) { |
||||
|
QueryWrapper<BusinessAlertConstructInfoOss> wrapper = buildQueryWrapperQuery(bo); |
||||
|
Page<BusinessAlertConstructInfoOss> 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<BusinessAlertConstructInfoOssVo> queryList(BusinessAlertConstructInfoOssBo bo) { |
||||
|
LambdaQueryWrapper<BusinessAlertConstructInfoOss> lqw = buildQueryWrapper(bo); |
||||
|
return baseMapper.selectVoList(lqw); |
||||
|
} |
||||
|
|
||||
|
private LambdaQueryWrapper<BusinessAlertConstructInfoOss> buildQueryWrapper(BusinessAlertConstructInfoOssBo bo) { |
||||
|
Map<String, Object> params = bo.getParams(); |
||||
|
LambdaQueryWrapper<BusinessAlertConstructInfoOss> 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<BusinessAlertConstructInfoOss> buildQueryWrapperQuery(BusinessAlertConstructInfoOssBo bo) { |
||||
|
QueryWrapper<BusinessAlertConstructInfoOss> 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<Long> ids, Boolean isValid) { |
||||
|
if(isValid){ |
||||
|
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
|
} |
||||
|
return baseMapper.deleteByIds(ids) > 0; |
||||
|
} |
||||
|
} |
@ -0,0 +1,12 @@ |
|||||
|
<?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="org.dromara.business.mapper.BusinessAlertConstructInfoOssMapper"> |
||||
|
|
||||
|
|
||||
|
<select id="selectVoPageData" resultType="org.dromara.business.domain.BusinessAlertConstructInfoOss"> |
||||
|
select t.* from business_alert_construct_info_oss t |
||||
|
${ew.getCustomSqlSegment} |
||||
|
</select> |
||||
|
</mapper> |
Loading…
Reference in new issue