Commit 7f5087b3 by ext.shengxiyong1

修复海报分页bug

1 parent 060f105a
......@@ -7,6 +7,7 @@ import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.common.enums.MediaType;
import com.linkwechat.wecom.domain.WeMaterial;
import com.linkwechat.wecom.domain.WePoster;
import com.linkwechat.wecom.domain.dto.ResetCategoryDto;
import com.linkwechat.wecom.domain.dto.TemporaryMaterialDto;
import com.linkwechat.wecom.domain.dto.WeMediaDto;
......@@ -22,6 +23,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
......@@ -50,24 +52,11 @@ public class WeMaterialController extends BaseController {
public TableDataInfo list(@RequestParam(value = "categoryId", required = false) String categoryId
, @RequestParam(value = "search", required = false) String search,@RequestParam(value = "mediaType") String mediaType) {
startPage();
List<WeMaterial> list;
if(StringUtils.isNotBlank(mediaType) && mediaType.equals(MediaType.POSTER.getType())){
list = wePosterService.list(StringUtils.isBlank(categoryId)?null:Long.valueOf(categoryId),search).stream().map(wePoster -> {
WeMaterial weMaterial = new WeMaterial();
weMaterial.setMaterialName(wePoster.getTitle());
weMaterial.setMaterialUrl(wePoster.getSampleImgPath());
weMaterial.setCategoryId(wePoster.getCategoryId());
weMaterial.setId(wePoster.getId());
return weMaterial;
}).collect(Collectors.toList());
}else {
list = materialService.findWeMaterials(categoryId, search,mediaType);
}
return getDataTable(list);
return getDataTable(
StringUtils.isNotBlank(mediaType) && mediaType.equals(MediaType.POSTER.getType())?
wePosterService.findWePosterToWeMaterial(categoryId,search):
materialService.findWeMaterials(categoryId, search,mediaType)
);
}
......
......@@ -37,4 +37,7 @@ public class WeCustomerList {
private String endTime;
//查询标签id
private String tagIds;
//0正常;1:删除;
private Integer delFlag=new Integer(0);
}
package com.linkwechat.wecom.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeMaterial;
import com.linkwechat.wecom.domain.WePoster;
import com.linkwechat.wecom.domain.WePosterFont;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 海报
* @author ws
*/
public interface WePosterMapper extends BaseMapper<WePoster> {
List<WeMaterial> findWePosterToWeMaterial(@Param("categoryId") String categoryId,@Param("name") String name);
}
......@@ -2,6 +2,7 @@ package com.linkwechat.wecom.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.wecom.domain.WeMaterial;
import com.linkwechat.wecom.domain.WePoster;
import java.util.List;
......@@ -35,4 +36,7 @@ public interface IWePosterService extends IService<WePoster> {
*/
public String generateSimpleImg(WePoster poster);
List<WeMaterial> findWePosterToWeMaterial(String categoryId,String name);
}
......@@ -7,6 +7,7 @@ import com.linkwechat.common.config.ServerConfig;
import com.linkwechat.common.utils.file.FileUploadUtils;
import com.linkwechat.common.utils.img.ImageUtils;
import com.linkwechat.common.utils.img.NetFileUtils;
import com.linkwechat.wecom.domain.WeMaterial;
import com.linkwechat.wecom.domain.WePoster;
import com.linkwechat.wecom.domain.WePosterFont;
import com.linkwechat.wecom.domain.WePosterSubassembly;
......@@ -16,6 +17,7 @@ import com.linkwechat.wecom.service.IWePosterFontService;
import com.linkwechat.wecom.service.IWePosterService;
import com.linkwechat.wecom.service.IWePosterSubassemblyService;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
......@@ -104,7 +106,6 @@ public class WePosterServiceImpl extends ServiceImpl<WePosterMapper, WePoster> i
@Override
public List<WePoster> list(Long categoryId, String name) {
List<WePoster> fontList = this.lambdaQuery()
.eq(WePoster::getDelFlag, 0)
.eq(categoryId != null, WePoster::getCategoryId, categoryId)
.like(com.linkwechat.common.utils.StringUtils.isNotBlank(name), WePoster::getTitle, name)
.orderByDesc(WePoster::getCreateTime)
......@@ -225,4 +226,9 @@ public class WePosterServiceImpl extends ServiceImpl<WePosterMapper, WePoster> i
throw new RuntimeException("图片生成错误");
}
}
@Override
public List<WeMaterial> findWePosterToWeMaterial(String categoryId,String name) {
return this.baseMapper.findWePosterToWeMaterial(categoryId, name);
}
}
......@@ -300,7 +300,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN we_user wu ON wc.first_user_id=wu.user_id
LEFT JOIN we_flower_customer_tag_rel wfctr ON wfctr.external_userid=wc.external_userid AND wfctr.user_id=wc.first_user_id
LEFT JOIN we_tag wt ON wt.tag_id=wfctr.tag_id
where wc.del_flag=0
<where>
<if test="delFlag != null">
wc.del_flag = #{delFlag}
</if>
<if test="name != null and name !=''">
AND wc.`name` like concat('%',#{name,jdbcType=VARCHAR},'%')
</if>
......@@ -319,6 +322,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="beginTime !=null and beginTime != '' and endTime !='' and endTime != null">
AND date_format(wc.first_add_time,'%Y-%m-%d') BETWEEN #{beginTime} AND #{endTime}
</if>
</where>
GROUP BY wc.external_userid
ORDER BY wc.first_add_time desc
</select>
......
......@@ -2,4 +2,25 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.linkwechat.wecom.mapper.WePosterMapper">
<select id="findWePosterToWeMaterial" resultType="com.linkwechat.wecom.domain.WeMaterial">
SELECT
title AS materialName,
sample_img_path AS materialUrl,
category_id,
id
FROM
we_poster
where
del_flag=0
<if test="categoryId !=null and categoryId !=''">
AND category_id = #{categoryId}
</if>
<if test="name !=null and name !=''">
AND title like concat('%',#{name,jdbcType=VARCHAR},'%')
</if>
ORDER BY create_time DESC
</select>
</mapper>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!