提交 1b304b90 authored 作者: renjiancai's avatar renjiancai

--no commit message

上级 21d117f8
package com.zrqx.resource.bg.controller.imagelibrary;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -18,29 +16,21 @@ import org.springframework.web.bind.annotation.RestController;
import com.zrqx.core.constant.resource.ResourceRequestPath;
import com.zrqx.core.enums.ResponseCodeEnum;
import com.zrqx.core.enums.resource.LibraryStatusEnum;
import com.zrqx.core.exception.BaseException;
import com.zrqx.core.exception.BusinessValidateException;
import com.zrqx.core.exception.ParameterValidateException;
import com.zrqx.core.form.resource.bg.QueryResourceForPoPForm;
import com.zrqx.core.form.resource.bg.QueryResourceRelationForm;
import com.zrqx.core.form.resource.bg.SaveResourceRelationForm;
import com.zrqx.core.form.resource.bg.ebook.UpdateEbookRelationForm;
import com.zrqx.core.form.resource.bg.imagelibrary.BatchUpdateImageLibraryForm;
import com.zrqx.core.form.resource.bg.imagelibrary.QueryImageLibraryForm;
import com.zrqx.core.form.resource.bg.imagelibrary.SaveImageLibraryForm;
import com.zrqx.core.form.resource.bg.imagelibrary.SaveUpdateImageLibraryForm;
import com.zrqx.core.model.resource.imagelibrary.ImageLibrary;
import com.zrqx.core.model.resource.imagelibrary.ImageLibraryDiyType;
import com.zrqx.core.model.resource.imagelibrary.ImageResource;
import com.zrqx.core.util.page.PageInfo;
import com.zrqx.core.util.page.PageParam;
import com.zrqx.core.util.response.CallBack;
import com.zrqx.core.vo.resource.ResourceRelationVo;
import com.zrqx.core.vo.resource.imagelibrary.ImageLibraryListVO;
import com.zrqx.core.vo.resource.imagelibrary.ImageLibraryOneVO;
import com.zrqx.resource.bg.service.ResourceRelationService;
import com.zrqx.resource.bg.service.imagelibrary.ImageLibraryDiyTypeRelationService;
import com.zrqx.resource.bg.service.imagelibrary.ImageLibraryDiyTypeService;
import com.zrqx.resource.bg.service.imagelibrary.ImageLibraryService;
import com.zrqx.resource.bg.service.imagelibrary.ImageResourceService;
......@@ -128,9 +118,6 @@ public class ImageLibraryController {
example.createCriteria().andIn("id", ids);
List<ImageLibrary> list = service.selectByExample(example);
for (ImageLibrary entity : list) {
if(entity.getBookId() != null){
throw new BusinessValidateException("图书内拆分出来的图片不支持单独上、下架、删除操作");
}
if (entity.getStatus() == LibraryStatusEnum.STATUS_1.getCode()) {
throw new BusinessValidateException("不能删除已上架的资源");
}
......@@ -157,9 +144,9 @@ public class ImageLibraryController {
if (form.getId() == null) {
throw new ParameterValidateException("分类不能为空");
}
ImageResource resource = resourceService.selectByPrimaryKey(form.getId());
resource.setSort(form.getSort());
resourceService.updateByPrimaryKeySelective(resource);
ImageLibrary entity = service.selectByPrimaryKey(form.getId());
entity.setSort(form.getSort());
service.updateByPrimaryKeySelective(entity);
return CallBack.success();
}
......
......@@ -15,41 +15,16 @@ import com.zrqx.core.vo.resource.imagelibrary.ImageLibraryListVO;
*/
public interface ImageLibraryMapper extends BaseMapper<ImageLibrary> {
@Select("<script>"
+ "select distinct a.id,a.name,a.bookName,a.source,a.realprice,a.image,DATE_FORMAT(a.uploadTime,'%Y-%m-%d') uploadTime,a.status "
+ "from res_Image_Library a left join res_Image_Library_Diy_Type ad "
+ "on a.id = ad.ilid "
+ "select distinct a.id,a.name,a.source,a.sort,a.image,DATE_FORMAT(a.uploadTime,'%Y-%m-%d') uploadTime,a.status "
+ "from res_Image_Library a "
+ "where 1=1 "
+ "<if test='form.nationsType != null '>"
+ "and a.nationsType = #{form.nationsType} "
+ "</if>"
+ "<if test = '" + NOTBLANK + "(form.diyTypeCode)'>"
+ "and ad.code like concat(#{form.diyTypeCode},'%') "
+ "</if>"
/*+ "<if test='form.diyTypeId != null and form.diyTypeId.size > 0'>"
+ "and ad.dtid in "
+ " <foreach collection=\"form.diyTypeId\" index=\"index\" item=\"id\" open=\"(\" separator=\",\" close=\")\">"
+ "#{id}"
+ "</foreach>"
+ "</if>" */
+ "<if test = '" + NOTBLANK + "(form.name)'>"
+ " and a.name like concat('%',#{form.name},'%') "
+ "</if>"
+ "<if test = '" + NOTBLANK + "(form.source)'>"
+ " and (a.source like concat('%',#{form.source},'%') or a.bookName like concat('%',#{form.source},'%') ) "
+ "</if>"
+ "<if test = '" + NOTBLANK + "(form.bookName)'>"
+ "and a.bookName like concat('%',#{form.bookName},'%') "
+ "</if>"
+ "<if test='form.status != null'>"
+ "and a.status = #{form.status}"
+ "</if>"
+ "<if test = '" + NOTBLANK + "(form.beginTime)'>"
+ "and a.uploadTime &gt;= concat(#{form.beginTime}, ' 00:00:00' )"
+ "</if>"
+ "<if test = '" + NOTBLANK + "(form.endTime)'>"
+ "and a.uploadTime &lt;= concat(#{form.endTime}, ' 23:59:59')"
+ "</if>"
+ " order by a.uploadTime desc"
+ " order by a.sort,a.uploadTime desc"
+ "</script>")
List<ImageLibraryListVO> query(@Param("form")QueryImageLibraryForm form);
@Select("<script>"
......
......@@ -165,7 +165,6 @@ public class ImageLibrarySerivceImpl extends BaseServiceImpl<ImageLibrary,String
public PageInfo<ImageLibraryListVO> page(QueryImageLibraryForm form, PageParam pageParam) {
startPage(pageParam);
//暂不用自定义分类id 做in查询
form.setDiyTypeId(null);
List<ImageLibraryListVO> list = mapper.query(form);
return new PageInfo<ImageLibraryListVO>(list);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论