Merge remote-tracking branch 'origin/main' into dyf-device
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
package com.fuyuanshen.app.controller;
|
||||
|
||||
import com.fuyuanshen.app.domain.bo.AppBusinessFileBo;
|
||||
import com.fuyuanshen.app.domain.dto.AppFileDto;
|
||||
import com.fuyuanshen.app.domain.vo.AppFileVo;
|
||||
import com.fuyuanshen.app.service.AppFileService;
|
||||
@ -27,31 +28,27 @@ public class AppFileController extends BaseController {
|
||||
* 查询文件列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public List<AppFileVo> list(AppFileDto bo) {
|
||||
return null;
|
||||
public R<List<AppFileVo>> list(AppBusinessFileBo bo) {
|
||||
return R.ok(appFileService.list(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件添加
|
||||
* 上传文件
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
public R<Void> add(@RequestBody AppFileDto bo) {
|
||||
return null;
|
||||
@PostMapping("/upload")
|
||||
public R<Void> upload(@Validated @ModelAttribute AppFileDto bo) {
|
||||
return toAjax(appFileService.add(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件编辑
|
||||
*/
|
||||
@PostMapping("/edit")
|
||||
public R<Void> edit(@RequestBody AppFileDto bo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件删除
|
||||
*/
|
||||
@DeleteMapping("/delete")
|
||||
public R<Void> delete(AppFileDto bo) {
|
||||
return null;
|
||||
public R<Void> delete(Long[] ids) {
|
||||
if(ids == null || ids.length == 0){
|
||||
return R.fail("请选择要删除的文件");
|
||||
}
|
||||
return toAjax(appFileService.delete(ids));
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,21 @@
|
||||
package com.fuyuanshen.app.domain.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@Data
|
||||
public class AppFileDto {
|
||||
|
||||
private Long deviceId;
|
||||
|
||||
/**
|
||||
* 文件类型(1:操作说明,2:产品参数)
|
||||
*/
|
||||
private Long fileType;
|
||||
|
||||
/**
|
||||
* 文件
|
||||
*/
|
||||
private MultipartFile file;
|
||||
|
||||
}
|
||||
|
@ -1,8 +0,0 @@
|
||||
package com.fuyuanshen.app.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AppFileVo {
|
||||
|
||||
}
|
@ -1,13 +1,20 @@
|
||||
package com.fuyuanshen.app.service;
|
||||
|
||||
import com.fuyuanshen.app.domain.bo.AppUserBo;
|
||||
import com.fuyuanshen.app.domain.vo.DeviceVo;
|
||||
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||
import com.fuyuanshen.app.domain.bo.AppBusinessFileBo;
|
||||
import com.fuyuanshen.app.domain.dto.AppFileDto;
|
||||
import com.fuyuanshen.app.domain.vo.AppBusinessFileVo;
|
||||
import com.fuyuanshen.app.domain.vo.AppFileVo;
|
||||
import com.fuyuanshen.common.oss.core.OssClient;
|
||||
import com.fuyuanshen.common.oss.factory.OssFactory;
|
||||
import com.fuyuanshen.common.satoken.utils.AppLoginHelper;
|
||||
import com.fuyuanshen.system.domain.vo.SysOssVo;
|
||||
import com.fuyuanshen.system.service.ISysOssService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 登录校验方法
|
||||
*
|
||||
@ -18,8 +25,44 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class AppFileService {
|
||||
|
||||
private final ISysOssService sysOssService;
|
||||
|
||||
public TableDataInfo<DeviceVo> queryPageList(AppUserBo bo, PageQuery pageQuery) {
|
||||
return null;
|
||||
private final IAppBusinessFileService appBusinessFileService;
|
||||
|
||||
public List<AppFileVo> list(AppBusinessFileBo bo) {
|
||||
bo.setCreateBy(AppLoginHelper.getUserId());
|
||||
return appBusinessFileService.queryAppFileList(bo);
|
||||
}
|
||||
|
||||
public Boolean add(AppFileDto bo) {
|
||||
|
||||
// 上传文件
|
||||
SysOssVo upload = sysOssService.upload(bo.getFile());
|
||||
|
||||
if (upload == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
AppBusinessFileBo appBusinessFileBo = new AppBusinessFileBo();
|
||||
appBusinessFileBo.setFileId(upload.getOssId());
|
||||
appBusinessFileBo.setBusinessId(bo.getDeviceId());
|
||||
appBusinessFileBo.setFileType(bo.getFileType());
|
||||
appBusinessFileBo.setCreateBy(AppLoginHelper.getUserId());
|
||||
|
||||
return appBusinessFileService.insertByBo(appBusinessFileBo);
|
||||
}
|
||||
|
||||
public Boolean delete(Long[] ids) {
|
||||
AppBusinessFileBo bo = new AppBusinessFileBo();
|
||||
bo.setCreateBy(AppLoginHelper.getUserId());
|
||||
bo.setIds(List.of(ids));
|
||||
List<AppBusinessFileVo> appBusinessFileVos = appBusinessFileService.queryList(bo);
|
||||
List<Long> fileIds = appBusinessFileVos.stream().map(AppBusinessFileVo::getFileId).toList();
|
||||
List<SysOssVo> list = sysOssService.listByIds(fileIds);
|
||||
for (SysOssVo sysOss : list) {
|
||||
OssClient storage = OssFactory.instance(sysOss.getService());
|
||||
storage.delete(sysOss.getUrl());
|
||||
}
|
||||
return appBusinessFileService.deleteWithValidByIds(List.of(ids), true);
|
||||
}
|
||||
}
|
||||
|
@ -49,9 +49,9 @@ spring:
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
|
||||
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
|
||||
url: jdbc:mysql://120.79.224.186:3366/fys-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
||||
url: jdbc:mysql://47.120.79.150:3306/fys-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
||||
username: root
|
||||
password: 1fys@QWER..
|
||||
password: Jq_123456#
|
||||
# # 从库数据源
|
||||
# slave:
|
||||
# lazy: true
|
||||
@ -98,13 +98,13 @@ spring:
|
||||
spring.data:
|
||||
redis:
|
||||
# 地址
|
||||
host: 120.79.224.186
|
||||
host: 47.120.79.150
|
||||
# 端口,默认为6379
|
||||
port: 26379
|
||||
port: 6379
|
||||
# 数据库索引
|
||||
database: 2
|
||||
# redis 密码必须配置
|
||||
password: 1fys@QWER..
|
||||
password: xhYc_djkl382^#780!
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
# 是否开启ssl
|
||||
|
@ -0,0 +1,105 @@
|
||||
package com.fuyuanshen.app.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 com.fuyuanshen.common.idempotent.annotation.RepeatSubmit;
|
||||
import com.fuyuanshen.common.log.annotation.Log;
|
||||
import com.fuyuanshen.common.web.core.BaseController;
|
||||
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||
import com.fuyuanshen.common.core.domain.R;
|
||||
import com.fuyuanshen.common.core.validate.AddGroup;
|
||||
import com.fuyuanshen.common.core.validate.EditGroup;
|
||||
import com.fuyuanshen.common.log.enums.BusinessType;
|
||||
import com.fuyuanshen.common.excel.utils.ExcelUtil;
|
||||
import com.fuyuanshen.app.domain.vo.AppBusinessFileVo;
|
||||
import com.fuyuanshen.app.domain.bo.AppBusinessFileBo;
|
||||
import com.fuyuanshen.app.service.IAppBusinessFileService;
|
||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* app业务文件
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-07-03
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/app/businessFile")
|
||||
public class AppBusinessFileController extends BaseController {
|
||||
|
||||
private final IAppBusinessFileService appBusinessFileService;
|
||||
|
||||
/**
|
||||
* 查询app业务文件列表
|
||||
*/
|
||||
@SaCheckPermission("app:businessFile:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<AppBusinessFileVo> list(AppBusinessFileBo bo, PageQuery pageQuery) {
|
||||
return appBusinessFileService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出app业务文件列表
|
||||
*/
|
||||
@SaCheckPermission("app:businessFile:export")
|
||||
@Log(title = "app业务文件", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(AppBusinessFileBo bo, HttpServletResponse response) {
|
||||
List<AppBusinessFileVo> list = appBusinessFileService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "app业务文件", AppBusinessFileVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取app业务文件详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("app:businessFile:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<AppBusinessFileVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return R.ok(appBusinessFileService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增app业务文件
|
||||
*/
|
||||
@SaCheckPermission("app:businessFile:add")
|
||||
@Log(title = "app业务文件", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody AppBusinessFileBo bo) {
|
||||
return toAjax(appBusinessFileService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改app业务文件
|
||||
*/
|
||||
@SaCheckPermission("app:businessFile:edit")
|
||||
@Log(title = "app业务文件", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody AppBusinessFileBo bo) {
|
||||
return toAjax(appBusinessFileService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除app业务文件
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("app:businessFile:remove")
|
||||
@Log(title = "app业务文件", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(appBusinessFileService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package com.fuyuanshen.app.domain;
|
||||
|
||||
import com.fuyuanshen.common.tenant.core.TenantEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* app业务文件对象 app_business_file
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-07-03
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("app_business_file")
|
||||
public class AppBusinessFile extends TenantEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 文件id
|
||||
*/
|
||||
private Long fileId;
|
||||
|
||||
/**
|
||||
* 业务id
|
||||
*/
|
||||
private Long businessId;
|
||||
|
||||
/**
|
||||
* 文件类型(1:操作说明,2:产品参数)
|
||||
*/
|
||||
private Long fileType;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package com.fuyuanshen.app.domain.bo;
|
||||
|
||||
import com.fuyuanshen.app.domain.AppBusinessFile;
|
||||
import com.fuyuanshen.common.core.validate.EditGroup;
|
||||
import com.fuyuanshen.common.mybatis.core.domain.BaseEntity;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* app业务文件业务对象 app_business_file
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-07-03
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = AppBusinessFile.class, reverseConvertGenerate = false)
|
||||
public class AppBusinessFileBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@NotNull(message = "主键id不能为空", groups = { EditGroup.class })
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 文件id
|
||||
*/
|
||||
private Long fileId;
|
||||
|
||||
/**
|
||||
* 业务id
|
||||
*/
|
||||
private Long businessId;
|
||||
|
||||
/**
|
||||
* 文件类型(1:操作说明,2:产品参数)
|
||||
*/
|
||||
private Long fileType;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
private List<Long> ids;
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package com.fuyuanshen.app.domain.vo;
|
||||
|
||||
import com.fuyuanshen.app.domain.AppBusinessFile;
|
||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import com.fuyuanshen.common.excel.annotation.ExcelDictFormat;
|
||||
import com.fuyuanshen.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;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* app业务文件视图对象 app_business_file
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-07-03
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = AppBusinessFile.class)
|
||||
public class AppBusinessFileVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@ExcelProperty(value = "主键id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 文件id
|
||||
*/
|
||||
@ExcelProperty(value = "文件id")
|
||||
private Long fileId;
|
||||
|
||||
/**
|
||||
* 业务id
|
||||
*/
|
||||
@ExcelProperty(value = "业务id")
|
||||
private Long businessId;
|
||||
|
||||
/**
|
||||
* 文件类型(1:操作说明,2:产品参数)
|
||||
*/
|
||||
@ExcelProperty(value = "文件类型(1:操作说明,2:产品参数)")
|
||||
private Long fileType;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.fuyuanshen.app.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AppFileVo {
|
||||
|
||||
private Long id;
|
||||
/**
|
||||
* 文件id
|
||||
*/
|
||||
private Long fileId;
|
||||
/**
|
||||
* 文件名称
|
||||
*/
|
||||
private String fileName;
|
||||
/**
|
||||
* 文件url
|
||||
*/
|
||||
private String fileUrl;
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.fuyuanshen.app.mapper;
|
||||
|
||||
import com.fuyuanshen.app.domain.AppBusinessFile;
|
||||
import com.fuyuanshen.app.domain.bo.AppBusinessFileBo;
|
||||
import com.fuyuanshen.app.domain.vo.AppBusinessFileVo;
|
||||
import com.fuyuanshen.app.domain.vo.AppFileVo;
|
||||
import com.fuyuanshen.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* app业务文件Mapper接口
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-07-03
|
||||
*/
|
||||
public interface AppBusinessFileMapper extends BaseMapperPlus<AppBusinessFile, AppBusinessFileVo> {
|
||||
|
||||
List<AppFileVo> queryAppFileList(AppBusinessFileBo bo);
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
package com.fuyuanshen.app.service;
|
||||
|
||||
import com.fuyuanshen.app.domain.vo.AppBusinessFileVo;
|
||||
import com.fuyuanshen.app.domain.bo.AppBusinessFileBo;
|
||||
import com.fuyuanshen.app.domain.vo.AppFileVo;
|
||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* app业务文件Service接口
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-07-03
|
||||
*/
|
||||
public interface IAppBusinessFileService {
|
||||
|
||||
/**
|
||||
* 查询app业务文件
|
||||
*
|
||||
* @param id 主键
|
||||
* @return app业务文件
|
||||
*/
|
||||
AppBusinessFileVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询app业务文件列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return app业务文件分页列表
|
||||
*/
|
||||
TableDataInfo<AppBusinessFileVo> queryPageList(AppBusinessFileBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的app业务文件列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return app业务文件列表
|
||||
*/
|
||||
List<AppBusinessFileVo> queryList(AppBusinessFileBo bo);
|
||||
|
||||
/**
|
||||
* 新增app业务文件
|
||||
*
|
||||
* @param bo app业务文件
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(AppBusinessFileBo bo);
|
||||
|
||||
/**
|
||||
* 修改app业务文件
|
||||
*
|
||||
* @param bo app业务文件
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(AppBusinessFileBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除app业务文件信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
|
||||
List<AppFileVo> queryAppFileList(AppBusinessFileBo bo);
|
||||
}
|
@ -0,0 +1,142 @@
|
||||
package com.fuyuanshen.app.service.impl;
|
||||
|
||||
import com.fuyuanshen.app.domain.vo.AppFileVo;
|
||||
import com.fuyuanshen.common.core.utils.MapstructUtils;
|
||||
import com.fuyuanshen.common.core.utils.StringUtils;
|
||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||
import com.fuyuanshen.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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.fuyuanshen.app.domain.bo.AppBusinessFileBo;
|
||||
import com.fuyuanshen.app.domain.vo.AppBusinessFileVo;
|
||||
import com.fuyuanshen.app.domain.AppBusinessFile;
|
||||
import com.fuyuanshen.app.mapper.AppBusinessFileMapper;
|
||||
import com.fuyuanshen.app.service.IAppBusinessFileService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* app业务文件Service业务层处理
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-07-03
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class AppBusinessFileServiceImpl implements IAppBusinessFileService {
|
||||
|
||||
private final AppBusinessFileMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询app业务文件
|
||||
*
|
||||
* @param id 主键
|
||||
* @return app业务文件
|
||||
*/
|
||||
@Override
|
||||
public AppBusinessFileVo queryById(Long id){
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询app业务文件列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return app业务文件分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<AppBusinessFileVo> queryPageList(AppBusinessFileBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<AppBusinessFile> lqw = buildQueryWrapper(bo);
|
||||
Page<AppBusinessFileVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的app业务文件列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return app业务文件列表
|
||||
*/
|
||||
@Override
|
||||
public List<AppBusinessFileVo> queryList(AppBusinessFileBo bo) {
|
||||
LambdaQueryWrapper<AppBusinessFile> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<AppBusinessFile> buildQueryWrapper(AppBusinessFileBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<AppBusinessFile> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByAsc(AppBusinessFile::getId);
|
||||
lqw.eq(bo.getFileId()!=null, AppBusinessFile::getFileId, bo.getFileId());
|
||||
lqw.eq(bo.getBusinessId() != null, AppBusinessFile::getBusinessId, bo.getBusinessId());
|
||||
lqw.eq(bo.getFileType() != null, AppBusinessFile::getFileType, bo.getFileType());
|
||||
lqw.in(bo.getIds()!=null, AppBusinessFile::getId, bo.getIds());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增app业务文件
|
||||
*
|
||||
* @param bo app业务文件
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(AppBusinessFileBo bo) {
|
||||
AppBusinessFile add = MapstructUtils.convert(bo, AppBusinessFile.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改app业务文件
|
||||
*
|
||||
* @param bo app业务文件
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(AppBusinessFileBo bo) {
|
||||
AppBusinessFile update = MapstructUtils.convert(bo, AppBusinessFile.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(AppBusinessFile entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除app业务文件信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AppFileVo> queryAppFileList(AppBusinessFileBo bo) {
|
||||
return baseMapper.queryAppFileList(bo);
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
<?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="com.fuyuanshen.app.mapper.AppBusinessFileMapper">
|
||||
|
||||
<select id="queryAppFileList" resultType="com.fuyuanshen.app.domain.vo.AppFileVo">
|
||||
select a.business_id id,a.file_id,b.file_name,b.url fileUrl from app_business_file a left join sys_oss b on a.file_id = b.oss_id
|
||||
where
|
||||
<if test="businessId != null">
|
||||
and a.business_id = #{businessId}
|
||||
</if>
|
||||
<if test="fileId != null">
|
||||
and a.file_id = #{fileId}
|
||||
</if>
|
||||
<if test="createBy != null">
|
||||
a.create_by = #{createBy}
|
||||
</if>
|
||||
order by a.create_time desc
|
||||
</select>
|
||||
</mapper>
|
Reference in New Issue
Block a user