feat(imgFiles): 新增图片文件管理功能
- 实现图片文件的增删改查接口 - 支持单文件和批量文件上传 - 提供分页查询和全量查询功能 - 实现文件删除和批量删除功能 - 集成文件上传工具类,支持路径生成和文件存储 - 完成DO、CO、DTO各层对象转换和数据映射 - 实现基础的文件信息持久化操作- 添加Swagger文档注解便于接口调试- 集成COLA框架实现CQRS架构模式 - 实现基础的异常处理和业务校验逻辑main
parent
445c395e3d
commit
06a4a52f14
|
|
@ -0,0 +1,91 @@
|
||||||
|
package com.zcloud.basic.info.web;
|
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.cola.dto.MultiResponse;
|
||||||
|
import com.alibaba.cola.dto.PageResponse;
|
||||||
|
import com.alibaba.cola.dto.Response;
|
||||||
|
import com.alibaba.cola.dto.SingleResponse;
|
||||||
|
import com.jjb.saas.framework.auth.model.SSOUser;
|
||||||
|
import com.jjb.saas.framework.auth.utils.AuthContext;
|
||||||
|
import com.zcloud.basic.info.api.ImgFilesServiceI;
|
||||||
|
import com.zcloud.basic.info.dto.ImgFilesAddCmd;
|
||||||
|
import com.zcloud.basic.info.dto.ImgFilesPageQry;
|
||||||
|
import com.zcloud.basic.info.dto.ImgFilesQryCmd;
|
||||||
|
import com.zcloud.basic.info.dto.ImgFilesUpdateCmd;
|
||||||
|
import com.zcloud.basic.info.dto.clientobject.ImgFilesCO;
|
||||||
|
import com.zcloud.basic.info.dto.clientobject.ImgFilesInfoCO;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* web-adapter
|
||||||
|
* @Author zhangyue
|
||||||
|
* @Date 2025-10-30 16:10:05
|
||||||
|
*/
|
||||||
|
@Api(tags = "图片信息表")
|
||||||
|
@RequestMapping("/${application.gateway}/imgFiles")
|
||||||
|
@RestController
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ImgFilesController {
|
||||||
|
private final ImgFilesServiceI imgFilesService;
|
||||||
|
|
||||||
|
@ApiOperation("新增")
|
||||||
|
@PostMapping("/save")
|
||||||
|
public SingleResponse<ImgFilesCO> add(@Validated ImgFilesAddCmd cmd) {
|
||||||
|
return imgFilesService.add(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("批量新增")
|
||||||
|
@PostMapping("/batchSave")
|
||||||
|
public SingleResponse<ImgFilesInfoCO> batchAdd(@Validated ImgFilesAddCmd cmd) {
|
||||||
|
return imgFilesService.batchAdd(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation("分页")
|
||||||
|
@PostMapping("/list")
|
||||||
|
public PageResponse<ImgFilesCO> page(@RequestBody ImgFilesPageQry qry) {
|
||||||
|
return imgFilesService.listPage(qry);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("所有数据")
|
||||||
|
@GetMapping("/listAll")
|
||||||
|
public MultiResponse<ImgFilesCO> listAll(ImgFilesQryCmd imgFilesQryCmd) {
|
||||||
|
return imgFilesService.listAll(imgFilesQryCmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("详情")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public SingleResponse<ImgFilesCO> getInfoById(@PathVariable("id") Long id) {
|
||||||
|
return SingleResponse.of(new ImgFilesCO());
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("删除")
|
||||||
|
@DeleteMapping("/{filePath}")
|
||||||
|
public Response removeFile(@PathVariable("filePath") String filePath) {
|
||||||
|
imgFilesService.removeFile(filePath);
|
||||||
|
return SingleResponse.buildSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("删除多个")
|
||||||
|
@DeleteMapping("/ids")
|
||||||
|
public Response removeBatch(@RequestParam Long[] ids) {
|
||||||
|
imgFilesService.removeBatch(ids);
|
||||||
|
return SingleResponse.buildSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("修改")
|
||||||
|
@PutMapping("/edit")
|
||||||
|
public SingleResponse edit(@Validated @RequestBody ImgFilesUpdateCmd imgFilesUpdateCmd) {
|
||||||
|
imgFilesService.edit(imgFilesUpdateCmd);
|
||||||
|
return SingleResponse.buildSuccess();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,85 @@
|
||||||
|
package com.zcloud.basic.info.command;
|
||||||
|
|
||||||
|
import com.alibaba.cola.dto.MultiResponse;
|
||||||
|
import com.alibaba.cola.dto.SingleResponse;
|
||||||
|
import com.alibaba.cola.exception.BizException;
|
||||||
|
import com.jjb.saas.framework.auth.utils.AuthContext;
|
||||||
|
import com.zcloud.basic.info.command.convertor.ImgFilesCoConvertor;
|
||||||
|
import com.zcloud.basic.info.domain.gateway.ImgFilesGateway;
|
||||||
|
import com.zcloud.basic.info.domain.model.ImgFilesE;
|
||||||
|
import com.zcloud.basic.info.dto.ImgFilesAddCmd;
|
||||||
|
import com.jjb.saas.framework.auth.model.SSOUser;
|
||||||
|
import com.zcloud.basic.info.dto.clientobject.ImgFilesCO;
|
||||||
|
import com.zcloud.basic.info.dto.clientobject.ImgFilesInfoCO;
|
||||||
|
import com.zcloud.basic.info.persistence.dataobject.ImgFilesDO;
|
||||||
|
import com.zcloud.basic.info.persistence.repository.ImgFilesRepository;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.apache.commons.math3.analysis.function.Sin;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* web-app
|
||||||
|
*
|
||||||
|
* @Author zhangyue
|
||||||
|
* @Date 2025-10-30 16:10:00
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ImgFilesAddExe {
|
||||||
|
private final ImgFilesGateway imgFilesGateway;
|
||||||
|
private final ImgFilesCoConvertor imgFilesCoConvertor;
|
||||||
|
private final ImgFilesRepository imgFilesRepository;
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public SingleResponse<ImgFilesCO> execute(ImgFilesAddCmd cmd) {
|
||||||
|
SSOUser ssoUser = AuthContext.getCurrentUser();
|
||||||
|
Long tenantId = ssoUser.getTenantId();
|
||||||
|
ImgFilesE imgFilesE = new ImgFilesE();
|
||||||
|
BeanUtils.copyProperties(cmd, imgFilesE);
|
||||||
|
boolean res = false;
|
||||||
|
ImgFilesCO imgFilesCO = new ImgFilesCO();
|
||||||
|
try {
|
||||||
|
String filePath = imgFilesE.initAdd(tenantId, imgFilesE);
|
||||||
|
imgFilesCO.setFilePath(filePath);
|
||||||
|
res = true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
if (!res) {
|
||||||
|
throw new BizException("保存失败");
|
||||||
|
}
|
||||||
|
return SingleResponse.of(imgFilesCO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public SingleResponse<ImgFilesInfoCO> batchExecute(ImgFilesAddCmd cmd) {
|
||||||
|
SSOUser ssoUser = AuthContext.getCurrentUser();
|
||||||
|
Long tenantId = ssoUser.getTenantId();
|
||||||
|
ImgFilesE imgFilesE = new ImgFilesE();
|
||||||
|
BeanUtils.copyProperties(cmd, imgFilesE);
|
||||||
|
boolean res = false;
|
||||||
|
ImgFilesInfoCO imgFilesCO = new ImgFilesInfoCO();
|
||||||
|
try {
|
||||||
|
List<ImgFilesE> imgFilesEList = imgFilesE.initBatchAdd(tenantId, imgFilesE);
|
||||||
|
List<ImgFilesDO> imgFilesDOList = imgFilesCoConvertor.converEsToDOs(imgFilesEList);
|
||||||
|
imgFilesRepository.saveBatch(imgFilesDOList);
|
||||||
|
List<ImgFilesCO> imgFilesCOList = imgFilesCoConvertor.converDOsToCOs(imgFilesDOList);
|
||||||
|
imgFilesCO.setFileList(imgFilesCOList);
|
||||||
|
imgFilesCO.setForeignKey(imgFilesE.getForeignKey());
|
||||||
|
res = true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
if (!res) {
|
||||||
|
throw new BizException("保存失败");
|
||||||
|
}
|
||||||
|
return SingleResponse.of(imgFilesCO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
package com.zcloud.basic.info.command;
|
||||||
|
|
||||||
|
import com.alibaba.cola.exception.BizException;
|
||||||
|
import com.zcloud.basic.info.domain.gateway.ImgFilesGateway;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* web-app
|
||||||
|
*
|
||||||
|
* @Author zhangyue
|
||||||
|
* @Date 2025-10-30 16:10:07
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ImgFilesRemoveExe {
|
||||||
|
private final ImgFilesGateway imgFilesGateway;
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public boolean execute(String filePath) {
|
||||||
|
|
||||||
|
// if (!res) {
|
||||||
|
// throw new BizException("删除失败");
|
||||||
|
// }
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public boolean execute(Long[] ids) {
|
||||||
|
boolean res = imgFilesGateway.deletedImgFilesByIds(ids);
|
||||||
|
if (!res) {
|
||||||
|
throw new BizException("删除失败");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.zcloud.basic.info.command;
|
||||||
|
|
||||||
|
import com.alibaba.cola.exception.BizException;
|
||||||
|
import com.zcloud.basic.info.domain.gateway.ImgFilesGateway;
|
||||||
|
import com.zcloud.basic.info.domain.model.ImgFilesE;
|
||||||
|
import com.zcloud.basic.info.dto.ImgFilesUpdateCmd;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* web-app
|
||||||
|
*
|
||||||
|
* @Author zhangyue
|
||||||
|
* @Date 2025-10-30 16:10:08
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ImgFilesUpdateExe {
|
||||||
|
private final ImgFilesGateway imgFilesGateway;
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void execute(ImgFilesUpdateCmd imgFilesUpdateCmd) {
|
||||||
|
ImgFilesE imgFilesE = new ImgFilesE();
|
||||||
|
BeanUtils.copyProperties(imgFilesUpdateCmd, imgFilesE);
|
||||||
|
boolean res = imgFilesGateway.update(imgFilesE);
|
||||||
|
if (!res) {
|
||||||
|
throw new BizException("修改失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.zcloud.basic.info.command.convertor;
|
||||||
|
|
||||||
|
import com.zcloud.basic.info.domain.model.ImgFilesE;
|
||||||
|
import com.zcloud.basic.info.dto.clientobject.ImgFilesCO;
|
||||||
|
import com.zcloud.basic.info.persistence.dataobject.ImgFilesDO;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* web-app
|
||||||
|
* @Author zhangyue
|
||||||
|
* @Date 2025-10-30 16:10:05
|
||||||
|
*/
|
||||||
|
@Mapper(componentModel = "spring")
|
||||||
|
public interface ImgFilesCoConvertor {
|
||||||
|
/**
|
||||||
|
* @param imgFilesDOs
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<ImgFilesCO> converDOsToCOs(List<ImgFilesDO> imgFilesDOs);
|
||||||
|
List<ImgFilesDO> converEsToDOs(List<ImgFilesE> imgFilesEs);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
package com.zcloud.basic.info.command.query;
|
||||||
|
|
||||||
|
import com.alibaba.cola.dto.MultiResponse;
|
||||||
|
import com.alibaba.cola.dto.PageResponse;
|
||||||
|
import com.zcloud.basic.info.command.convertor.ImgFilesCoConvertor;
|
||||||
|
import com.zcloud.basic.info.dto.ImgFilesAddCmd;
|
||||||
|
import com.zcloud.basic.info.dto.ImgFilesPageQry;
|
||||||
|
import com.zcloud.basic.info.dto.ImgFilesQryCmd;
|
||||||
|
import com.zcloud.basic.info.dto.clientobject.ImgFilesCO;
|
||||||
|
import com.zcloud.basic.info.persistence.dataobject.ImgFilesDO;
|
||||||
|
import com.zcloud.basic.info.persistence.repository.ImgFilesRepository;
|
||||||
|
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* web-app
|
||||||
|
* @Author zhangyue
|
||||||
|
* @Date 2025-10-30 16:10:07
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ImgFilesQueryExe {
|
||||||
|
private final ImgFilesRepository imgFilesRepository;
|
||||||
|
private final ImgFilesCoConvertor imgFilesCoConvertor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页
|
||||||
|
*
|
||||||
|
* @param imgFilesPageQry
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public PageResponse<ImgFilesCO> execute(ImgFilesPageQry imgFilesPageQry) {
|
||||||
|
Map<String,Object> parmas = PageQueryHelper.toHashMap(imgFilesPageQry);
|
||||||
|
PageResponse<ImgFilesDO> pageResponse = imgFilesRepository.listPage(parmas);
|
||||||
|
List<ImgFilesCO> examCenterCOS = imgFilesCoConvertor.converDOsToCOs(pageResponse.getData());
|
||||||
|
return PageResponse.of(examCenterCOS, pageResponse.getTotalCount(), pageResponse.getPageSize(), pageResponse.getPageIndex());
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* list
|
||||||
|
*
|
||||||
|
* @param imgFilesQryCmd
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public MultiResponse<ImgFilesCO> executeList(ImgFilesQryCmd imgFilesQryCmd) {
|
||||||
|
Map<String,Object> parmas = PageQueryHelper.toHashMap(imgFilesQryCmd);
|
||||||
|
List<ImgFilesDO> imgFilesDOList = imgFilesRepository.listAll(parmas);
|
||||||
|
List<ImgFilesCO> imgFilesCOList = imgFilesCoConvertor.converDOsToCOs(imgFilesDOList);
|
||||||
|
return MultiResponse.of(imgFilesCOList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,70 @@
|
||||||
|
package com.zcloud.basic.info.service;
|
||||||
|
|
||||||
|
import com.alibaba.cola.dto.MultiResponse;
|
||||||
|
import com.alibaba.cola.dto.PageResponse;
|
||||||
|
import com.alibaba.cola.dto.SingleResponse;
|
||||||
|
import com.zcloud.basic.info.api.ImgFilesServiceI;
|
||||||
|
import com.zcloud.basic.info.command.ImgFilesAddExe;
|
||||||
|
import com.zcloud.basic.info.command.ImgFilesRemoveExe;
|
||||||
|
import com.zcloud.basic.info.command.ImgFilesUpdateExe;
|
||||||
|
import com.zcloud.basic.info.command.query.ImgFilesQueryExe;
|
||||||
|
import com.zcloud.basic.info.dto.ImgFilesAddCmd;
|
||||||
|
import com.zcloud.basic.info.dto.ImgFilesPageQry;
|
||||||
|
import com.zcloud.basic.info.dto.ImgFilesQryCmd;
|
||||||
|
import com.zcloud.basic.info.dto.ImgFilesUpdateCmd;
|
||||||
|
import com.zcloud.basic.info.dto.clientobject.ImgFilesCO;
|
||||||
|
import com.zcloud.basic.info.dto.clientobject.ImgFilesInfoCO;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* web-app
|
||||||
|
*
|
||||||
|
* @Author zhangyue
|
||||||
|
* @Date 2025-10-30 16:10:08
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ImgFilesServiceImpl implements ImgFilesServiceI {
|
||||||
|
private final ImgFilesAddExe imgFilesAddExe;
|
||||||
|
private final ImgFilesUpdateExe imgFilesUpdateExe;
|
||||||
|
private final ImgFilesRemoveExe imgFilesRemoveExe;
|
||||||
|
private final ImgFilesQueryExe imgFilesQueryExe;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResponse<ImgFilesCO> listPage(ImgFilesPageQry qry) {
|
||||||
|
|
||||||
|
return imgFilesQueryExe.execute(qry);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SingleResponse add(ImgFilesAddCmd cmd) {
|
||||||
|
return imgFilesAddExe.execute(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SingleResponse<ImgFilesInfoCO> batchAdd(ImgFilesAddCmd cmd) {
|
||||||
|
return imgFilesAddExe.batchExecute(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void edit(ImgFilesUpdateCmd imgFilesUpdateCmd) {
|
||||||
|
imgFilesUpdateExe.execute(imgFilesUpdateCmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeFile(String filePath) {
|
||||||
|
imgFilesRemoveExe.execute(filePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeBatch(Long[] ids) {
|
||||||
|
imgFilesRemoveExe.execute(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MultiResponse<ImgFilesCO> listAll(ImgFilesQryCmd imgFilesQryCmd) {
|
||||||
|
return imgFilesQueryExe.executeList(imgFilesQryCmd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.zcloud.basic.info.api;
|
||||||
|
|
||||||
|
import com.alibaba.cola.dto.MultiResponse;
|
||||||
|
import com.alibaba.cola.dto.PageResponse;
|
||||||
|
import com.alibaba.cola.dto.SingleResponse;
|
||||||
|
import com.zcloud.basic.info.dto.ImgFilesAddCmd;
|
||||||
|
import com.zcloud.basic.info.dto.ImgFilesPageQry;
|
||||||
|
import com.zcloud.basic.info.dto.ImgFilesQryCmd;
|
||||||
|
import com.zcloud.basic.info.dto.ImgFilesUpdateCmd;
|
||||||
|
import com.zcloud.basic.info.dto.clientobject.ImgFilesCO;
|
||||||
|
import com.zcloud.basic.info.dto.clientobject.ImgFilesInfoCO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* web-client
|
||||||
|
* @Author zhangyue
|
||||||
|
* @Date 2025-10-30 16:10:08
|
||||||
|
*/
|
||||||
|
public interface ImgFilesServiceI {
|
||||||
|
PageResponse<ImgFilesCO> listPage(ImgFilesPageQry qry);
|
||||||
|
|
||||||
|
SingleResponse<ImgFilesCO> add(ImgFilesAddCmd cmd);
|
||||||
|
SingleResponse<ImgFilesInfoCO> batchAdd(ImgFilesAddCmd cmd);
|
||||||
|
|
||||||
|
void edit(ImgFilesUpdateCmd cmd);
|
||||||
|
|
||||||
|
void removeFile(String filePath);
|
||||||
|
|
||||||
|
void removeBatch(Long[] ids);
|
||||||
|
|
||||||
|
MultiResponse<ImgFilesCO> listAll(ImgFilesQryCmd imgFilesQryCmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
package com.zcloud.basic.info.dto;
|
||||||
|
|
||||||
|
import com.alibaba.cola.dto.Command;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* web-client
|
||||||
|
*
|
||||||
|
* @Author zhangyue
|
||||||
|
* @Date 2025-10-30 16:09:58
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ImgFilesAddCmd extends Command {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "类型,参考 com.zcloud.imgfiles.enums.filetype", name = "type", required = true)
|
||||||
|
@NotNull(message = "类型,参考 com.zcloud.imgfiles.enums.filetype不能为空")
|
||||||
|
private Integer type;
|
||||||
|
@ApiModelProperty(value = "路径", name = "path", required = true)
|
||||||
|
@NotEmpty(message = "文件存储路径不能为空")
|
||||||
|
private String path;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "文件集合", name = "files")
|
||||||
|
@NotEmpty(message = "至少上传一个文件")
|
||||||
|
private MultipartFile[] files;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "外键", name = "foreignKey")
|
||||||
|
private String foreignKey;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "附件名称", name = "fileName")
|
||||||
|
private String fileName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "企业id", name = "corpinfoId")
|
||||||
|
private Long corpinfoId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "路径", name = "filePath")
|
||||||
|
private String filePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.zcloud.basic.info.dto;
|
||||||
|
|
||||||
|
import com.alibaba.cola.dto.PageQuery;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* web-client
|
||||||
|
*
|
||||||
|
* @Author zhangyue
|
||||||
|
* @Date 2025-10-30 16:10:07
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ImgFilesPageQry extends PageQuery {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询条件操作前缀,支持以下几种数据库查询操作:
|
||||||
|
* - `ImgFilesPageQry`: 模糊匹配查询,对应SQL的LIKE操作符
|
||||||
|
* - `eq`: 等值查询,对应SQL的=操作符
|
||||||
|
* - `gt`: 大于比较查询
|
||||||
|
* - `lt`: 小于比较查询
|
||||||
|
* - `ge`: 大于等于比较查询
|
||||||
|
* - `le`: 小于等于比较查询
|
||||||
|
* - `ne`: 不等比较查询,对应SQL的!=操作符
|
||||||
|
*/
|
||||||
|
private String likeImgFilesId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.zcloud.basic.info.dto;
|
||||||
|
|
||||||
|
import com.alibaba.cola.dto.Command;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* web-client
|
||||||
|
*
|
||||||
|
* @Author zhangyue
|
||||||
|
* @Date 2025-10-30 16:09:58
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ImgFilesQryCmd extends Command {
|
||||||
|
/**
|
||||||
|
* 查询条件操作前缀,支持以下几种数据库查询操作:
|
||||||
|
* - `ImgFilesQryCmd`: 模糊匹配查询,对应SQL的LIKE操作符
|
||||||
|
* - `eq`: 等值查询,对应SQL的=操作符
|
||||||
|
* - `gt`: 大于比较查询
|
||||||
|
* - `lt`: 小于比较查询
|
||||||
|
* - `ge`: 大于等于比较查询
|
||||||
|
* - `le`: 小于等于比较查询
|
||||||
|
* - `ne`: 不等比较查询,对应SQL的!=操作符
|
||||||
|
*/
|
||||||
|
private String eqImgFilesId;
|
||||||
|
private Integer eqType;
|
||||||
|
private String eqForeignKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
package com.zcloud.basic.info.dto;
|
||||||
|
|
||||||
|
import com.alibaba.cola.dto.Command;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* web-client
|
||||||
|
*
|
||||||
|
* @Author zhangyue
|
||||||
|
* @Date 2025-10-30 16:10:08
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ImgFilesUpdateCmd extends Command {
|
||||||
|
@ApiModelProperty(value = "主键", name = "id", required = true)
|
||||||
|
@NotNull(message = "主键不能为空")
|
||||||
|
private Long id;
|
||||||
|
@ApiModelProperty(value = "业务主键id", name = "imgFilesId", required = true)
|
||||||
|
@NotEmpty(message = "业务主键id不能为空")
|
||||||
|
private String imgFilesId;
|
||||||
|
@ApiModelProperty(value = "路径", name = "filePath", required = true)
|
||||||
|
@NotEmpty(message = "路径不能为空")
|
||||||
|
private String filePath;
|
||||||
|
@ApiModelProperty(value = "类型,参考 com.zcloud.imgfiles.enums.filetype", name = "type", required = true)
|
||||||
|
@NotNull(message = "类型,参考 com.zcloud.imgfiles.enums.filetype不能为空")
|
||||||
|
private Integer type;
|
||||||
|
@ApiModelProperty(value = "外键", name = "foreignKey", required = true)
|
||||||
|
private String foreignKey;
|
||||||
|
@ApiModelProperty(value = "附件名称", name = "fileName", required = true)
|
||||||
|
@NotEmpty(message = "附件名称不能为空")
|
||||||
|
private String fileName;
|
||||||
|
@ApiModelProperty(value = "企业id", name = "corpinfoId", required = true)
|
||||||
|
@NotNull(message = "企业id不能为空")
|
||||||
|
private Long corpinfoId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,80 @@
|
||||||
|
package com.zcloud.basic.info.dto.clientobject;
|
||||||
|
|
||||||
|
import com.alibaba.cola.dto.ClientObject;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* web-client
|
||||||
|
*
|
||||||
|
* @Author zhangyue
|
||||||
|
* @Date 2025-10-30 16:10:04
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ImgFilesCO extends ClientObject {
|
||||||
|
//主键
|
||||||
|
@ApiModelProperty(value = "主键")
|
||||||
|
private Long id;
|
||||||
|
//业务主键id
|
||||||
|
@ApiModelProperty(value = "业务主键id")
|
||||||
|
private String imgFilesId;
|
||||||
|
//路径
|
||||||
|
@ApiModelProperty(value = "路径")
|
||||||
|
private String filePath;
|
||||||
|
//类型,参考 com.zcloud.imgfiles.enums.filetype
|
||||||
|
@ApiModelProperty(value = "类型,参考 com.zcloud.imgfiles.enums.filetype")
|
||||||
|
private Integer type;
|
||||||
|
//外键
|
||||||
|
@ApiModelProperty(value = "外键")
|
||||||
|
private String foreignKey;
|
||||||
|
//附件名称
|
||||||
|
@ApiModelProperty(value = "附件名称")
|
||||||
|
private String fileName;
|
||||||
|
//企业id
|
||||||
|
@ApiModelProperty(value = "企业id")
|
||||||
|
private Long corpinfoId;
|
||||||
|
//乐观锁
|
||||||
|
@ApiModelProperty(value = "乐观锁")
|
||||||
|
private Integer version;
|
||||||
|
//创建人
|
||||||
|
@ApiModelProperty(value = "创建人")
|
||||||
|
private Long createId;
|
||||||
|
//创建人姓名
|
||||||
|
@ApiModelProperty(value = "创建人姓名")
|
||||||
|
private String createName;
|
||||||
|
//创建时间
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
//更新人
|
||||||
|
@ApiModelProperty(value = "更新人")
|
||||||
|
private Long updateId;
|
||||||
|
//修改人名称
|
||||||
|
@ApiModelProperty(value = "修改人名称")
|
||||||
|
private String updateName;
|
||||||
|
//更新时间
|
||||||
|
@ApiModelProperty(value = "更新时间")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
//描述
|
||||||
|
@ApiModelProperty(value = "描述")
|
||||||
|
private String remarks;
|
||||||
|
//是否删除
|
||||||
|
@ApiModelProperty(value = "是否删除")
|
||||||
|
private String deleteEnum;
|
||||||
|
//租户id
|
||||||
|
@ApiModelProperty(value = "租户id")
|
||||||
|
private Long tenantId;
|
||||||
|
//机构id
|
||||||
|
@ApiModelProperty(value = "机构id")
|
||||||
|
private Long orgId;
|
||||||
|
//环境
|
||||||
|
@ApiModelProperty(value = "环境")
|
||||||
|
private String env;
|
||||||
|
@ApiModelProperty
|
||||||
|
private List<ImgFilesCO> fileList;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.zcloud.basic.info.dto.clientobject;
|
||||||
|
|
||||||
|
import com.alibaba.cola.dto.ClientObject;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* web-client
|
||||||
|
*
|
||||||
|
* @Author zhangyue
|
||||||
|
* @Date 2025-10-30 16:10:04
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ImgFilesInfoCO extends ClientObject {
|
||||||
|
//主键
|
||||||
|
@ApiModelProperty(value = "外键")
|
||||||
|
private String foreignKey;
|
||||||
|
//附件名称
|
||||||
|
@ApiModelProperty
|
||||||
|
private List<ImgFilesCO> fileList;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
package com.zcloud.basic.info.domain.gateway;
|
||||||
|
|
||||||
|
|
||||||
|
import com.zcloud.basic.info.domain.model.ImgFilesE;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* web-domain
|
||||||
|
* @Author zhangyue
|
||||||
|
* @Date 2025-10-30 16:10:06
|
||||||
|
*/
|
||||||
|
public interface ImgFilesGateway {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
Boolean add(ImgFilesE imgFilesE) ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
Boolean update(ImgFilesE imgFilesE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
Boolean deletedImgFilesById(Long id);
|
||||||
|
Boolean deletedImgFilesByIds(Long[] id);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,107 @@
|
||||||
|
package com.zcloud.basic.info.domain.model;
|
||||||
|
|
||||||
|
import com.jjb.saas.framework.domain.model.BaseE;
|
||||||
|
import com.zcloud.gbscommon.utils.DateUtil;
|
||||||
|
import com.zcloud.gbscommon.utils.FileUpload;
|
||||||
|
//import com.zcloud.gbscommon.utils.Smb;
|
||||||
|
import com.zcloud.gbscommon.utils.Tools;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.apache.commons.beanutils.BeanUtils;
|
||||||
|
import org.springframework.util.ObjectUtils;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* web-domain
|
||||||
|
*
|
||||||
|
* @Author zhangyue
|
||||||
|
* @Date 2025-10-30 16:10:06
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ImgFilesE extends BaseE {
|
||||||
|
//主键
|
||||||
|
private Long id;
|
||||||
|
//业务主键id
|
||||||
|
private String imgFilesId;
|
||||||
|
//路径
|
||||||
|
private String filePath;
|
||||||
|
//类型,参考 com.zcloud.imgfiles.enums.filetype
|
||||||
|
private Integer type;
|
||||||
|
//外键
|
||||||
|
private String foreignKey;
|
||||||
|
//附件名称
|
||||||
|
private String fileName;
|
||||||
|
//企业id
|
||||||
|
private Long corpinfoId;
|
||||||
|
// 文件存储路径
|
||||||
|
private String path;
|
||||||
|
|
||||||
|
private MultipartFile[] files;
|
||||||
|
//乐观锁
|
||||||
|
private Integer version;
|
||||||
|
//创建人
|
||||||
|
private Long createId;
|
||||||
|
//创建人姓名
|
||||||
|
private String createName;
|
||||||
|
//创建时间
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
//更新人
|
||||||
|
private Long updateId;
|
||||||
|
//修改人名称
|
||||||
|
private String updateName;
|
||||||
|
//更新时间
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
//描述
|
||||||
|
private String remarks;
|
||||||
|
//是否删除
|
||||||
|
private String deleteEnum;
|
||||||
|
//租户id
|
||||||
|
private Long tenantId;
|
||||||
|
//机构id
|
||||||
|
private Long orgId;
|
||||||
|
//环境
|
||||||
|
private String env;
|
||||||
|
|
||||||
|
public String initAdd(Long tenantId, ImgFilesE baseImgFilesE) throws InvocationTargetException, IllegalAccessException {
|
||||||
|
|
||||||
|
MultipartFile[] files = baseImgFilesE.getFiles();
|
||||||
|
List<ImgFilesE> imgFilesList = new ArrayList<ImgFilesE>();
|
||||||
|
String foreignKey = ObjectUtils.isEmpty(baseImgFilesE.getForeignKey()) ? Tools.get32UUID() : baseImgFilesE.getForeignKey();
|
||||||
|
Long corpinfoId = ObjectUtils.isEmpty(baseImgFilesE.getCorpinfoId()) ? tenantId : baseImgFilesE.getCorpinfoId();
|
||||||
|
String filePath = corpinfoId.toString() + "/" + DateUtil.getMonth() + "/" + baseImgFilesE.getPath();
|
||||||
|
ImgFilesE imgFile = new ImgFilesE();
|
||||||
|
BeanUtils.copyProperties(baseImgFilesE, imgFile);
|
||||||
|
// 文件上传并获取上传路径
|
||||||
|
String resultFilePath = FileUpload.fileUp(files[0], filePath, Tools.get32UUID());
|
||||||
|
return filePath + resultFilePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ImgFilesE> initBatchAdd(Long tenantId, ImgFilesE baseImgFilesE) throws Exception {
|
||||||
|
MultipartFile[] files = baseImgFilesE.getFiles();
|
||||||
|
List<ImgFilesE> imgFilesList = new ArrayList<ImgFilesE>();
|
||||||
|
String foreignKey = ObjectUtils.isEmpty(baseImgFilesE.getForeignKey()) ? Tools.get32UUID() : baseImgFilesE.getForeignKey();
|
||||||
|
Long corpinfoId = ObjectUtils.isEmpty(baseImgFilesE.getCorpinfoId()) ? tenantId : baseImgFilesE.getCorpinfoId();
|
||||||
|
String filePath = corpinfoId.toString() + "/" + DateUtil.getMonth() + "/" + baseImgFilesE.getPath();
|
||||||
|
|
||||||
|
for (MultipartFile file : files) {
|
||||||
|
ImgFilesE imgFile = new ImgFilesE();
|
||||||
|
BeanUtils.copyProperties(baseImgFilesE, imgFile);
|
||||||
|
// 文件上传并获取上传路径
|
||||||
|
// Smb.saveFile(file, filePath);
|
||||||
|
imgFile.setImgFilesId(Tools.get32UUID());
|
||||||
|
// imgFile.setFilePath(filePath+);
|
||||||
|
imgFile.setType(baseImgFilesE.getType());
|
||||||
|
imgFile.setForeignKey(foreignKey);
|
||||||
|
imgFile.setFileName(file.getOriginalFilename());
|
||||||
|
imgFile.setCorpinfoId(corpinfoId);
|
||||||
|
imgFilesList.add(imgFile);
|
||||||
|
}
|
||||||
|
baseImgFilesE.setForeignKey(foreignKey);
|
||||||
|
return imgFilesList;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
package com.zcloud.basic.info.gatewayimpl;
|
||||||
|
|
||||||
|
import com.zcloud.basic.info.domain.gateway.ImgFilesGateway;
|
||||||
|
import com.zcloud.basic.info.domain.model.ImgFilesE;
|
||||||
|
import com.zcloud.basic.info.persistence.dataobject.ImgFilesDO;
|
||||||
|
import com.zcloud.basic.info.persistence.repository.ImgFilesRepository;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* web-infrastructure
|
||||||
|
* @Author zhangyue
|
||||||
|
* @Date 2025-10-30 16:10:06
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ImgFilesGatewayImpl implements ImgFilesGateway {
|
||||||
|
private final ImgFilesRepository imgFilesRepository;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean add(ImgFilesE imgFilesE) {
|
||||||
|
ImgFilesDO d = new ImgFilesDO();
|
||||||
|
BeanUtils.copyProperties(imgFilesE, d);
|
||||||
|
imgFilesRepository.save(d);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean update(ImgFilesE imgFilesE) {
|
||||||
|
ImgFilesDO d = new ImgFilesDO();
|
||||||
|
BeanUtils.copyProperties(imgFilesE, d);
|
||||||
|
imgFilesRepository.updateById(d);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean deletedImgFilesById(Long id) {
|
||||||
|
return imgFilesRepository.removeById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean deletedImgFilesByIds(Long[] ids) {
|
||||||
|
return imgFilesRepository.removeByIds(Arrays.asList(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
package com.zcloud.basic.info.persistence.dataobject;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.jjb.saas.framework.repository.basedo.BaseDO;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* web-infrastructure
|
||||||
|
* @Author zhangyue
|
||||||
|
* @Date 2025-10-30 16:10:06
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("img_files")
|
||||||
|
@NoArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class ImgFilesDO extends BaseDO {
|
||||||
|
//业务主键id
|
||||||
|
@ApiModelProperty(value = "业务主键id")
|
||||||
|
private String imgFilesId;
|
||||||
|
//路径
|
||||||
|
@ApiModelProperty(value = "路径")
|
||||||
|
private String filePath;
|
||||||
|
//类型,参考 com.zcloud.imgfiles.enums.filetype
|
||||||
|
@ApiModelProperty(value = "类型,参考 com.zcloud.imgfiles.enums.filetype")
|
||||||
|
private Integer type;
|
||||||
|
//外键
|
||||||
|
@ApiModelProperty(value = "外键")
|
||||||
|
private String foreignKey;
|
||||||
|
//附件名称
|
||||||
|
@ApiModelProperty(value = "附件名称")
|
||||||
|
private String fileName;
|
||||||
|
//企业id
|
||||||
|
@ApiModelProperty(value = "企业id")
|
||||||
|
private Long corpinfoId;
|
||||||
|
|
||||||
|
public ImgFilesDO(String imgFilesId) {
|
||||||
|
this.imgFilesId = imgFilesId;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.zcloud.basic.info.persistence.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.zcloud.basic.info.persistence.dataobject.ImgFilesDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* web-infrastructure
|
||||||
|
* @Author zhangyue
|
||||||
|
* @Date 2025-10-30 16:10:07
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface ImgFilesMapper extends BaseMapper<ImgFilesDO> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.zcloud.basic.info.persistence.repository;
|
||||||
|
|
||||||
|
import com.alibaba.cola.dto.MultiResponse;
|
||||||
|
import com.alibaba.cola.dto.PageResponse;
|
||||||
|
import com.jjb.saas.framework.repository.repo.BaseRepository;
|
||||||
|
import com.zcloud.basic.info.persistence.dataobject.ImgFilesDO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* web-infrastructure
|
||||||
|
* @Author zhangyue
|
||||||
|
* @Date 2025-10-30 16:10:07
|
||||||
|
*/
|
||||||
|
public interface ImgFilesRepository extends BaseRepository<ImgFilesDO> {
|
||||||
|
PageResponse<ImgFilesDO> listPage(Map<String,Object> parmas);
|
||||||
|
|
||||||
|
|
||||||
|
List<ImgFilesDO> listAll(Map<String,Object> parmas);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
package com.zcloud.basic.info.persistence.repository.impl;
|
||||||
|
|
||||||
|
import com.alibaba.cola.dto.MultiResponse;
|
||||||
|
import com.alibaba.cola.dto.PageResponse;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.jjb.saas.framework.repository.common.PageHelper;
|
||||||
|
import com.jjb.saas.framework.repository.repo.impl.BaseRepositoryImpl;
|
||||||
|
import com.zcloud.basic.info.persistence.dataobject.ImgFilesDO;
|
||||||
|
import com.zcloud.basic.info.persistence.mapper.ImgFilesMapper;
|
||||||
|
import com.zcloud.basic.info.persistence.repository.ImgFilesRepository;
|
||||||
|
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
||||||
|
import com.zcloud.gbscommon.utils.Query;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* web-infrastructure
|
||||||
|
*
|
||||||
|
* @Author zhangyue
|
||||||
|
* @Date 2025-10-30 16:10:07
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class ImgFilesRepositoryImpl extends BaseRepositoryImpl<ImgFilesMapper, ImgFilesDO> implements ImgFilesRepository {
|
||||||
|
private final ImgFilesMapper imgFilesMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResponse<ImgFilesDO> listPage(Map<String, Object> parmas) {
|
||||||
|
IPage<ImgFilesDO> iPage = new Query<ImgFilesDO>().getPage(parmas);
|
||||||
|
QueryWrapper<ImgFilesDO> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper = PageQueryHelper.createPageQueryWrapper(queryWrapper, parmas);
|
||||||
|
queryWrapper.orderByDesc("create_time");
|
||||||
|
IPage<ImgFilesDO> result = imgFilesMapper.selectPage(iPage, queryWrapper);
|
||||||
|
return PageHelper.pageToResponse(result, result.getRecords());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ImgFilesDO> listAll(Map<String, Object> parmas) {
|
||||||
|
QueryWrapper<ImgFilesDO> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper = PageQueryHelper.createPageQueryWrapper(queryWrapper, parmas);
|
||||||
|
queryWrapper.orderByDesc("create_time");
|
||||||
|
// queryWrapper.select("id", "img_files_id", "file_path", "type", "foreign_key", "file_name", "corpinfo_id");
|
||||||
|
return imgFilesMapper.selectList(queryWrapper);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
Reference in New Issue