|
@@ -1,27 +1,59 @@
|
|
|
package com.jzg.organization.service.impl;
|
|
package com.jzg.organization.service.impl;
|
|
|
|
|
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.jzg.commons.core.page.HttpResult;
|
|
import com.jzg.commons.core.page.HttpResult;
|
|
|
import com.jzg.commons.entity.dto.PosterParam;
|
|
import com.jzg.commons.entity.dto.PosterParam;
|
|
|
import com.jzg.commons.entity.po.SysPoster;
|
|
import com.jzg.commons.entity.po.SysPoster;
|
|
|
|
|
+import com.jzg.commons.entity.po.SysUploadFiles;
|
|
|
|
|
+import com.jzg.commons.entity.vo.SysPosterVo;
|
|
|
|
|
+import com.jzg.commons.util.MinioUtils;
|
|
|
import com.jzg.commons.util.StringUtils;
|
|
import com.jzg.commons.util.StringUtils;
|
|
|
import com.jzg.organization.mapper.PosterMapper;
|
|
import com.jzg.organization.mapper.PosterMapper;
|
|
|
import com.jzg.organization.service.PosterService;
|
|
import com.jzg.organization.service.PosterService;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
+
|
|
|
@Service
|
|
@Service
|
|
|
public class PosterServiceImpl extends ServiceImpl<PosterMapper, SysPoster> implements PosterService {
|
|
public class PosterServiceImpl extends ServiceImpl<PosterMapper, SysPoster> implements PosterService {
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public HttpResult queryPage(PosterParam posterParam) {
|
|
public HttpResult queryPage(PosterParam posterParam) {
|
|
|
-
|
|
|
|
|
- LambdaQueryWrapper<SysPoster> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
- lambdaQueryWrapper.like(StringUtils.isNotEmpty(posterParam.getTitle()), SysPoster::getTitle, posterParam.getTitle());
|
|
|
|
|
- lambdaQueryWrapper.like(StringUtils.isNotEmpty(posterParam.getOrgName()), SysPoster::getOrgName, posterParam.getOrgName());
|
|
|
|
|
- Page page = baseMapper.queryPage(posterParam.getPage(), lambdaQueryWrapper);
|
|
|
|
|
|
|
+ QueryWrapper<SysPoster> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
+ queryWrapper.like(StringUtils.isNotEmpty(posterParam.getTitle()), "p.title", posterParam.getTitle());
|
|
|
|
|
+ queryWrapper.like(StringUtils.isNotEmpty(posterParam.getOrgName()), "orgName", posterParam.getOrgName());
|
|
|
|
|
+ queryWrapper.eq("p.is_delete", 0);
|
|
|
|
|
+ queryWrapper.orderByDesc("p.create_time");
|
|
|
|
|
+ Page<SysPosterVo> page = baseMapper.queryPage(posterParam.getPage(), queryWrapper);
|
|
|
|
|
+ page.getRecords().forEach(sysPosterVo -> {
|
|
|
|
|
+ sysPosterVo.setPreviewUrl(getPosterUrl(sysPosterVo.getUploadFiles()));
|
|
|
|
|
+ });
|
|
|
return HttpResult.ok(page);
|
|
return HttpResult.ok(page);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public HttpResult queryById(String id) {
|
|
|
|
|
+ SysPosterVo sysPosterVo = baseMapper.queryById(id);
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(sysPosterVo)) {
|
|
|
|
|
+ sysPosterVo.setPreviewUrl(getPosterUrl(sysPosterVo.getUploadFiles()));
|
|
|
|
|
+ return HttpResult.ok(sysPosterVo);
|
|
|
|
|
+ }
|
|
|
|
|
+ return HttpResult.ok();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ public String getPosterUrl(SysUploadFiles uploadFiles){
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(uploadFiles)) {
|
|
|
|
|
+ if (StringUtils.isNotEmpty(uploadFiles.getBucketName()) && StringUtils.isNotEmpty(uploadFiles.getFileName())){
|
|
|
|
|
+ return MinioUtils.getPresignedObjectUrl(uploadFiles.getBucketName(), uploadFiles.getFileName());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
}
|
|
}
|