提交 1ff7c7f8 authored 作者: renjianyu's avatar renjianyu

--no commit message

上级 75749eab
...@@ -19,7 +19,7 @@ import com.zrqx.core.form.resource.bg.projectlibrary.QueryProjectLibraryForm; ...@@ -19,7 +19,7 @@ import com.zrqx.core.form.resource.bg.projectlibrary.QueryProjectLibraryForm;
import com.zrqx.core.form.resource.bg.projectlibrary.SaveUpdateProjectLibraryForm; import com.zrqx.core.form.resource.bg.projectlibrary.SaveUpdateProjectLibraryForm;
import com.zrqx.core.form.resource.bg.projectlibrary.UpdateTopForm; import com.zrqx.core.form.resource.bg.projectlibrary.UpdateTopForm;
import com.zrqx.core.form.resource.bg.recommend.UpdateRecommendResourceForm; import com.zrqx.core.form.resource.bg.recommend.UpdateRecommendResourceForm;
import com.zrqx.core.model.resource.rojectLibrary.ProjectLibrary; import com.zrqx.core.model.resource.projectLibrary.ProjectLibrary;
import com.zrqx.core.util.page.PageInfo; import com.zrqx.core.util.page.PageInfo;
import com.zrqx.core.util.page.PageParam; import com.zrqx.core.util.page.PageParam;
import com.zrqx.core.util.response.CallBack; import com.zrqx.core.util.response.CallBack;
...@@ -89,13 +89,29 @@ public class ProjectLibraryController { ...@@ -89,13 +89,29 @@ public class ProjectLibraryController {
return CallBack.success(); return CallBack.success();
} }
@ApiOperation(value = "批量 置顶/推荐 " , notes ="批量 启用/禁用") @ApiOperation(value = "推荐 " , notes ="推荐")
@PostMapping(value = "/batch/update/topStatus") @PostMapping(value = "/update/topStatus")
public CallBack<Boolean> updateTopStatus(@RequestBody UpdateTopForm form){ public CallBack<Boolean> updateTopStatus(@RequestBody UpdateTopForm form){
Example example = service.createExample(); Example example = service.createExample();
example.createCriteria().andEqualTo("id", form.getId()); example.createCriteria().andEqualTo("id", form.getId());
ProjectLibrary entity = new ProjectLibrary(); ProjectLibrary entity = new ProjectLibrary();
entity.setTopStatus(form.getTopStatus()); entity.setTopStatus(form.getStatus());
entity.setUpdateTime(new Date());
if(!service.UpdateByExampleSelective(entity,example)){
throw new BaseException("操作失败");
}
//更新推荐位资源的状态
//recommendResourceManage.updateStatus(form.getIds(), 8, form.getStatus());
return CallBack.success();
}
@ApiOperation(value = "推荐 " , notes ="推荐")
@PostMapping(value = "/update/recommendStatus")
public CallBack<Boolean> updateRecommendStatus(@RequestBody UpdateTopForm form){
Example example = service.createExample();
example.createCriteria().andEqualTo("id", form.getId());
ProjectLibrary entity = new ProjectLibrary();
entity.setRecommendStatus(form.getStatus());
entity.setUpdateTime(new Date()); entity.setUpdateTime(new Date());
if(!service.UpdateByExampleSelective(entity,example)){ if(!service.UpdateByExampleSelective(entity,example)){
throw new BaseException("操作失败"); throw new BaseException("操作失败");
......
...@@ -8,6 +8,7 @@ import java.util.List; ...@@ -8,6 +8,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
...@@ -28,8 +29,10 @@ import com.zrqx.core.form.resource.bg.SaveResourceRelationForm; ...@@ -28,8 +29,10 @@ import com.zrqx.core.form.resource.bg.SaveResourceRelationForm;
import com.zrqx.core.form.resource.bg.ebook.UpdateEbookRelationForm; import com.zrqx.core.form.resource.bg.ebook.UpdateEbookRelationForm;
import com.zrqx.core.model.resource.articlelibrary.ArticleLibraryDiyType; import com.zrqx.core.model.resource.articlelibrary.ArticleLibraryDiyType;
import com.zrqx.core.model.resource.audiolibrary.AudioLibrary; import com.zrqx.core.model.resource.audiolibrary.AudioLibrary;
import com.zrqx.core.model.resource.projectLibrary.ProjectLibrary;
import com.zrqx.core.model.resource.resourcerelation.ResourceRelation; import com.zrqx.core.model.resource.resourcerelation.ResourceRelation;
import com.zrqx.core.model.resource.rojectLibrary.ProjectLibrary; import com.zrqx.core.util.bean.BeanUtils;
import com.zrqx.core.util.datatype.ArrayUtils;
import com.zrqx.core.util.page.PageInfo; import com.zrqx.core.util.page.PageInfo;
import com.zrqx.core.util.page.PageParam; import com.zrqx.core.util.page.PageParam;
import com.zrqx.core.util.response.CallBack; import com.zrqx.core.util.response.CallBack;
...@@ -133,19 +136,65 @@ public class ResourceLibraryController { ...@@ -133,19 +136,65 @@ public class ResourceLibraryController {
@ApiOperation(value = "选择弹窗中的列表", notes = "查询选择弹窗中的列表") @ApiOperation(value = "选择弹窗中的列表", notes = "查询选择弹窗中的列表")
@GetMapping(value = ResourceRequestPath.RELATION_RESOURCE + ResourceRequestPath.POPPAGE) @GetMapping(value = ResourceRequestPath.RELATION_RESOURCE + ResourceRequestPath.POPPAGE)
public CallBack<PageInfo<ResourceRelationListVo>> page(QueryResourceForPoPForm form, PageParam pageParam) { public CallBack<PageInfo<ResourceRelationListVo>> page(QueryResourceForPoPForm form, PageParam pageParam) {
if(StringUtils.isBlank(form.getId()) ){
throw new BaseException();
}
List<String> allList = new ArrayList<>();
//查询当前资源已关联的资源
List<QueryResourceForPoPForm> ls = null;
//关联资源查询
ResourceRelation er = new ResourceRelation();
er.setObjectId(form.getId());
List<ResourceRelation> list = resourceRelationService.select(er);
er.setResourceId(form.getId());
if(form.getResourceType() != 0) {
er.setResourceType(form.getResourceType());
}
list.add(er);
ls = BeanUtils.copyList(list, QueryResourceForPoPForm.class);
if(ArrayUtils.isNotEmpty(ls)){
Map<Integer, List<String>> resultMap = ls.stream()
.collect(Collectors.groupingBy(QueryResourceForPoPForm :: getResourceType,
Collectors.mapping(QueryResourceForPoPForm :: getResourceId, Collectors.toList())));
if(resultMap.get(AllResourceTypeEnum.BOOK.getCode()) != null) {
allList.addAll(resultMap.get(AllResourceTypeEnum.BOOK.getCode()));
}
if(resultMap.get(AllResourceTypeEnum.ARTICLE.getCode()) != null) {
allList.addAll(resultMap.get(AllResourceTypeEnum.ARTICLE.getCode()));
}
if(resultMap.get(AllResourceTypeEnum.VIDEO.getCode()) != null) {
allList.addAll(resultMap.get(AllResourceTypeEnum.VIDEO.getCode()));
}
if(resultMap.get(AllResourceTypeEnum.AUDIO.getCode()) != null) {
allList.addAll(resultMap.get(AllResourceTypeEnum.AUDIO.getCode()));
}
//projectIdList = resultMap.get(AllResourceTypeEnum.PROJECT.getCode());
}
QueryResourceForPoPForm f = new QueryResourceForPoPForm();
BeanUtils.copyProperties(form, f);
if (form.getResourceType().equals(1)) { if (form.getResourceType().equals(1)) {
return CallBack.success(bookservice.pageByTitleAndDiyType(form, pageParam)); f.setIds(allList);
return CallBack.success(bookservice.pageByTitleAndDiyType(f, pageParam));
}else if(form.getResourceType().equals(2)){ }else if(form.getResourceType().equals(2)){
return CallBack.success(articleLibraryService.pageByTitleAndDiyType(form, pageParam)); f.setIds(allList);
return CallBack.success(articleLibraryService.pageByTitleAndDiyType(f, pageParam));
}else if (form.getResourceType().equals(3)) { }else if (form.getResourceType().equals(3)) {
return CallBack.success(pdfLibraryService.pageByTitleAndDiyType(form, pageParam)); f.setIds(allList);
return CallBack.success(pdfLibraryService.pageByTitleAndDiyType(f, pageParam));
}else if (form.getResourceType().equals(5)) { }else if (form.getResourceType().equals(5)) {
return CallBack.success(audioLibraryService.pageByTitleAndDiyType(form, pageParam)); f.setIds(allList);
return CallBack.success(videoLibraryService.pageByTitleAndDiyType(f, pageParam));
}else if (form.getResourceType().equals(6)) { }else if (form.getResourceType().equals(6)) {
return CallBack.success(videoLibraryService.pageByTitleAndDiyType(form, pageParam)); f.setIds(allList);
return CallBack.success(audioLibraryService.pageByTitleAndDiyType(f, pageParam));
}else if(form.getResourceType().equals(0)){ }else if(form.getResourceType().equals(0)){
f.setIds(allList);
//全部写 //全部写
return CallBack.success(videoLibraryService.allpageByTitleAndDiyType(form, pageParam)); return CallBack.success(videoLibraryService.allpageByTitleAndDiyType(f, pageParam));
} }
return CallBack.success(); return CallBack.success();
} }
......
...@@ -64,6 +64,12 @@ public interface ArticleLibraryMapper extends BaseMapper<ArticleLibrary> { ...@@ -64,6 +64,12 @@ public interface ArticleLibraryMapper extends BaseMapper<ArticleLibrary> {
+ "<if test = '" + NOTBLANK + "(form.diyTypeCode)'>" + "<if test = '" + NOTBLANK + "(form.diyTypeCode)'>"
+ "and ad.code like concat(#{form.diyTypeCode},'%') " + "and ad.code like concat(#{form.diyTypeCode},'%') "
+ "</if>" + "</if>"
+ "<if test='form.ids != null and form.ids.size > 0'>"
+ "and a.id not in "
+ " <foreach collection=\"form.ids\" index=\"index\" item=\"id\" open=\"(\" separator=\",\" close=\")\">"
+ "#{id}"
+ "</foreach>"
+ "</if>"
+ "</script>") + "</script>")
List<ResourceRelationListVo> queryByTileAndDiyType(@Param("form")QueryResourceForPoPForm entity); List<ResourceRelationListVo> queryByTileAndDiyType(@Param("form")QueryResourceForPoPForm entity);
/** /**
......
...@@ -59,12 +59,12 @@ public interface AudioLibraryMapper extends BaseMapper<AudioLibrary> { ...@@ -59,12 +59,12 @@ public interface AudioLibraryMapper extends BaseMapper<AudioLibrary> {
+ "</if>" + "</if>"
// + "<if test='form.ids != null and form.ids.size > 0'>" + "<if test='form.ids != null and form.ids.size > 0'>"
// + "and a.id not in " + "and a.id not in "
// + " <foreach collection=\"form.ids\" index=\"index\" item=\"id\" open=\"(\" separator=\",\" close=\")\">" + " <foreach collection=\"form.ids\" index=\"index\" item=\"id\" open=\"(\" separator=\",\" close=\")\">"
// + "#{id}" + "#{id}"
// + "</foreach>" + "</foreach>"
// + "</if>" + "</if>"
+ "</script>") + "</script>")
List<ResourceRelationListVo> queryByTileAndDiyType(@Param("form")QueryResourceForPoPForm entity); List<ResourceRelationListVo> queryByTileAndDiyType(@Param("form")QueryResourceForPoPForm entity);
} }
...@@ -9,7 +9,7 @@ import org.apache.ibatis.annotations.Select; ...@@ -9,7 +9,7 @@ import org.apache.ibatis.annotations.Select;
import com.zrqx.core.form.resource.bg.QueryResourceForPoPForm; import com.zrqx.core.form.resource.bg.QueryResourceForPoPForm;
import com.zrqx.core.form.resource.bg.projectlibrary.QueryProjectLibraryForm; import com.zrqx.core.form.resource.bg.projectlibrary.QueryProjectLibraryForm;
import com.zrqx.core.mapper.BaseMapper; import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.model.resource.rojectLibrary.ProjectLibrary; import com.zrqx.core.model.resource.projectLibrary.ProjectLibrary;
import com.zrqx.core.vo.resource.projectlibrary.ProjectLibraryListVO; import com.zrqx.core.vo.resource.projectlibrary.ProjectLibraryListVO;
/** /**
* 视频库 * 视频库
...@@ -17,7 +17,7 @@ import com.zrqx.core.vo.resource.projectlibrary.ProjectLibraryListVO; ...@@ -17,7 +17,7 @@ import com.zrqx.core.vo.resource.projectlibrary.ProjectLibraryListVO;
public interface ProjectLibraryMapper extends BaseMapper<ProjectLibrary> { public interface ProjectLibraryMapper extends BaseMapper<ProjectLibrary> {
@Select("<script>" @Select("<script>"
+ "select a.id,a.name,a.uploadTime,a.updateTime,a.status,a.sceneStatus,a.topStatus,a.author,a.cover,a.cover1 " + "select a.id,a.name,recommendStatus,a.uploadTime,a.updateTime,a.status,a.sceneStatus,a.topStatus,a.author,a.cover,a.cover1 "
+ "from res_Project_Library a " + "from res_Project_Library a "
+ "where 1=1 " + "where 1=1 "
+ "<if test='"+ NOTBLANK +"(form.nai)'>" + "<if test='"+ NOTBLANK +"(form.nai)'>"
......
...@@ -49,7 +49,7 @@ public interface VideoLibraryMapper extends BaseMapper<VideoLibrary> { ...@@ -49,7 +49,7 @@ public interface VideoLibraryMapper extends BaseMapper<VideoLibrary> {
+ "select DISTINCT a.id,a.name,a.author,a.realprice,a.timeLength,a.size,a.uploadTime,a.status,a.img,a.defaultImg " + "select DISTINCT a.id,a.name,a.author,a.realprice,a.timeLength,a.size,a.uploadTime,a.status,a.img,a.defaultImg "
+ "from res_Video_Library a left join res_Video_Library_Diy_Type ad " + "from res_Video_Library a left join res_Video_Library_Diy_Type ad "
+ "on a.id = ad.vlid " + "on a.id = ad.vlid "
+ "where 1=1 and a.status = 1 and salesType = 1 " + "where 1=1 and a.status = 1 "
+ "<if test = '" + NOTBLANK + "(form.diyTypeCode)'>" + "<if test = '" + NOTBLANK + "(form.diyTypeCode)'>"
+ " and ad.code like concat(#{form.diyTypeCode},'%') " + " and ad.code like concat(#{form.diyTypeCode},'%') "
+ "</if>" + "</if>"
...@@ -58,12 +58,12 @@ public interface VideoLibraryMapper extends BaseMapper<VideoLibrary> { ...@@ -58,12 +58,12 @@ public interface VideoLibraryMapper extends BaseMapper<VideoLibrary> {
+ "</if>" + "</if>"
// + "<if test='form.ids != null and form.ids.size > 0'>" + "<if test='form.ids != null and form.ids.size > 0'>"
// + "and a.id not in " + "and a.id not in "
// + " <foreach collection=\"form.ids\" index=\"index\" item=\"id\" open=\"(\" separator=\",\" close=\")\">" + " <foreach collection=\"form.ids\" index=\"index\" item=\"id\" open=\"(\" separator=\",\" close=\")\">"
// + "#{id}" + "#{id}"
// + "</foreach>" + "</foreach>"
// + "</if>" + "</if>"
+ "</script>") + "</script>")
List<ResourceRelationListVo> queryByTileAndDiyType(@Param("form")QueryResourceForPoPForm entity); List<ResourceRelationListVo> queryByTileAndDiyType(@Param("form")QueryResourceForPoPForm entity);
...@@ -73,7 +73,7 @@ public interface VideoLibraryMapper extends BaseMapper<VideoLibrary> { ...@@ -73,7 +73,7 @@ public interface VideoLibraryMapper extends BaseMapper<VideoLibrary> {
+ "select DISTINCT a.id,a.name,a.author,a.resourceType,a.uploadTime,a.status " + "select DISTINCT a.id,a.name,a.author,a.resourceType,a.uploadTime,a.status "
+ "from res_Video_Library a left join res_Video_Library_Diy_Type ad " + "from res_Video_Library a left join res_Video_Library_Diy_Type ad "
+ "on a.id = ad.vlid " + "on a.id = ad.vlid "
+ "where 1=1 and a.status = 1 and salesType = 1 " + "where 1=1 and a.status = 1 "
+ "<if test = '" + NOTBLANK + "(form.diyTypeCode)'>" + "<if test = '" + NOTBLANK + "(form.diyTypeCode)'>"
+ " and ad.code like concat(#{form.diyTypeCode},'%') " + " and ad.code like concat(#{form.diyTypeCode},'%') "
...@@ -81,6 +81,12 @@ public interface VideoLibraryMapper extends BaseMapper<VideoLibrary> { ...@@ -81,6 +81,12 @@ public interface VideoLibraryMapper extends BaseMapper<VideoLibrary> {
+ "<if test = '" + NOTBLANK + "(form.name)'>" + "<if test = '" + NOTBLANK + "(form.name)'>"
+ " and a.name like concat('%',#{form.name},'%') " + " and a.name like concat('%',#{form.name},'%') "
+ "</if>" + "</if>"
+ "<if test='form.ids != null and form.ids.size > 0'>"
+ "and a.id not in "
+ " <foreach collection=\"form.ids\" index=\"index\" item=\"id\" open=\"(\" separator=\",\" close=\")\">"
+ "#{id}"
+ "</foreach>"
+ "</if>"
+ " union " + " union "
+ "select DISTINCT a.id,a.name,a.author,a.resourceType,a.uploadTime,a.status" + "select DISTINCT a.id,a.name,a.author,a.resourceType,a.uploadTime,a.status"
...@@ -94,6 +100,12 @@ public interface VideoLibraryMapper extends BaseMapper<VideoLibrary> { ...@@ -94,6 +100,12 @@ public interface VideoLibraryMapper extends BaseMapper<VideoLibrary> {
+ "<if test = '" + NOTBLANK + "(form.name)'>" + "<if test = '" + NOTBLANK + "(form.name)'>"
+ " and a.title like concat('%',#{form.name},'%') " + " and a.title like concat('%',#{form.name},'%') "
+ "</if>" + "</if>"
+ "<if test='form.ids != null and form.ids.size > 0'>"
+ "and a.id not in "
+ " <foreach collection=\"form.ids\" index=\"index\" item=\"id\" open=\"(\" separator=\",\" close=\")\">"
+ "#{id}"
+ "</foreach>"
+ "</if>"
+ " union " + " union "
+ "select DISTINCT a.id,a.name,a.author,a.resourceType,DATE_FORMAT(a.uploadTime,'%Y-%m-%d') uploadTime,a.status " + "select DISTINCT a.id,a.name,a.author,a.resourceType,DATE_FORMAT(a.uploadTime,'%Y-%m-%d') uploadTime,a.status "
...@@ -102,12 +114,15 @@ public interface VideoLibraryMapper extends BaseMapper<VideoLibrary> { ...@@ -102,12 +114,15 @@ public interface VideoLibraryMapper extends BaseMapper<VideoLibrary> {
+ "<if test = '" + NOTBLANK + "(form.name)'>" + "<if test = '" + NOTBLANK + "(form.name)'>"
+ "and a.name like concat('%',#{form.name},'%') " + "and a.name like concat('%',#{form.name},'%') "
+ "</if>" + "</if>"
+ "<if test='form.resourceType != null' >"
+ "and a.resourceType = #{form.resourceType} "
+ "</if>"
+ "<if test = '" + NOTBLANK + "(form.diyTypeCode)'>" + "<if test = '" + NOTBLANK + "(form.diyTypeCode)'>"
+ "and ad.code like concat(#{form.diyTypeCode},'%') " + "and ad.code like concat(#{form.diyTypeCode},'%') "
+ "</if>" + "</if>"
+ "<if test='form.ids != null and form.ids.size > 0'>"
+ "and a.id not in "
+ " <foreach collection=\"form.ids\" index=\"index\" item=\"id\" open=\"(\" separator=\",\" close=\")\">"
+ "#{id}"
+ "</foreach>"
+ "</if>"
+ "</script>") + "</script>")
List<ResourceRelationListVo> allQueryByTileAndDiyType(@Param("form")QueryResourceForPoPForm entity); List<ResourceRelationListVo> allQueryByTileAndDiyType(@Param("form")QueryResourceForPoPForm entity);
......
...@@ -13,8 +13,8 @@ import com.zrqx.core.form.resource.bg.QueryResourceForPoPForm; ...@@ -13,8 +13,8 @@ import com.zrqx.core.form.resource.bg.QueryResourceForPoPForm;
import com.zrqx.core.form.resource.bg.projectlibrary.QueryProjectLibraryForm; import com.zrqx.core.form.resource.bg.projectlibrary.QueryProjectLibraryForm;
import com.zrqx.core.form.resource.bg.projectlibrary.SaveUpdateProjectLibraryForm; import com.zrqx.core.form.resource.bg.projectlibrary.SaveUpdateProjectLibraryForm;
import com.zrqx.core.mapper.BaseMapper; import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.model.resource.projectLibrary.ProjectLibrary;
import com.zrqx.core.model.resource.resourcerelation.ResourceRelation; import com.zrqx.core.model.resource.resourcerelation.ResourceRelation;
import com.zrqx.core.model.resource.rojectLibrary.ProjectLibrary;
import com.zrqx.core.service.BaseServiceImpl; import com.zrqx.core.service.BaseServiceImpl;
import com.zrqx.core.util.bean.BeanUtils; import com.zrqx.core.util.bean.BeanUtils;
import com.zrqx.core.util.page.PageInfo; import com.zrqx.core.util.page.PageInfo;
...@@ -55,6 +55,7 @@ public class ProjectLibrarySerivceImpl extends BaseServiceImpl<ProjectLibrary,St ...@@ -55,6 +55,7 @@ public class ProjectLibrarySerivceImpl extends BaseServiceImpl<ProjectLibrary,St
//entity.setStatus(ProjectStatusEnum.STATUS_0.getCode()); //entity.setStatus(ProjectStatusEnum.STATUS_0.getCode());
entity.setStatus(1); entity.setStatus(1);
entity.setTopStatus(0); entity.setTopStatus(0);
entity.setRecommendStatus(0);
entity.setUploadTime(new Date()); entity.setUploadTime(new Date());
entity.setResourceType(AllResourceTypeEnum.PROJECT.getCode()); entity.setResourceType(AllResourceTypeEnum.PROJECT.getCode());
entity.setBrowseNum(50); entity.setBrowseNum(50);
......
...@@ -5,7 +5,7 @@ import java.util.List; ...@@ -5,7 +5,7 @@ import java.util.List;
import com.zrqx.core.form.resource.bg.QueryResourceForPoPForm; import com.zrqx.core.form.resource.bg.QueryResourceForPoPForm;
import com.zrqx.core.form.resource.bg.projectlibrary.QueryProjectLibraryForm; import com.zrqx.core.form.resource.bg.projectlibrary.QueryProjectLibraryForm;
import com.zrqx.core.form.resource.bg.projectlibrary.SaveUpdateProjectLibraryForm; import com.zrqx.core.form.resource.bg.projectlibrary.SaveUpdateProjectLibraryForm;
import com.zrqx.core.model.resource.rojectLibrary.ProjectLibrary; import com.zrqx.core.model.resource.projectLibrary.ProjectLibrary;
import com.zrqx.core.service.BaseService; import com.zrqx.core.service.BaseService;
import com.zrqx.core.util.page.PageInfo; import com.zrqx.core.util.page.PageInfo;
import com.zrqx.core.util.page.PageParam; import com.zrqx.core.util.page.PageParam;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论