提交 c04aa10f authored 作者: liupengfei's avatar liupengfei

--no commit message

上级 3f6f75b3
package com.zrqx.resource.fg.controller.articlelibrary;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zrqx.core.util.bean.BeanUtils;
import com.zrqx.core.util.response.CallBack;
import com.zrqx.resource.commons.model.articlelibrary.ArticleLibrary;
import com.zrqx.resource.commons.vo.fg.articlelibrary.FgArticleLibraryVO;
import com.zrqx.resource.fg.service.articlelibrary.FgArticleLibraryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* 穴位库Controller
*/
@RestController
@RequestMapping("/fg/article-library")
@Api(description = "前台-文章库")
public class FgArticleLibraryController {
@Autowired
private FgArticleLibraryService service;
@ApiOperation(value = "查询", notes = "根据ID查询")
@GetMapping(value = "/get/{oid}")
public CallBack<FgArticleLibraryVO> getById(@PathVariable String oid) {
ArticleLibrary entity = service.selectByPrimaryKey(oid);
FgArticleLibraryVO vo = new FgArticleLibraryVO();
BeanUtils.copyProperties(entity,vo);
return CallBack.success(vo);
}
}
......@@ -15,10 +15,12 @@ import com.zrqx.core.util.page.PageParam;
import com.zrqx.core.util.response.CallBack;
import com.zrqx.resource.commons.form.fg.membercollection.MemberCollectionForm;
import com.zrqx.resource.commons.model.acupointlibrary.AcupointLibrary;
import com.zrqx.resource.commons.model.articlelibrary.ArticleLibrary;
import com.zrqx.resource.commons.model.meridianlibrary.MeridianLibrary;
import com.zrqx.resource.commons.model.videolibrary.VideoLibrary;
import com.zrqx.resource.commons.vo.fg.membercollection.FgMemberCollectionVo;
import com.zrqx.resource.fg.service.acupointlibrary.FgAcupointLibraryService;
import com.zrqx.resource.fg.service.articlelibrary.FgArticleLibraryService;
import com.zrqx.resource.fg.service.membercollection.FgMemberCollectionService;
import com.zrqx.resource.fg.service.meridianlibrary.FgMeridianLibraryService;
import com.zrqx.resource.fg.service.videolibrary.FgVideoLibraryService;
......@@ -43,6 +45,9 @@ public class FgMemberCollectionController {
@Autowired
private FgMeridianLibraryService fgMeridianLibraryService;
@Autowired
private FgArticleLibraryService fgArticleLibraryService;
@ApiOperation(value = "批量添加收藏",notes="返回成功条数")
@PostMapping(value = "/batch/save")
public CallBack<Integer> batchAddMemberCollection(@RequestBody MemberCollectionForm form) {
......@@ -98,6 +103,18 @@ public class FgMemberCollectionController {
}
}
}
if(ResourceTypeEnum.ARTICLE_LIBRARY.getCode().equals(li.getObjectType())){
if(StringUtils.isNotBlank(li.getName())){
ArticleLibrary articleLibrary = fgArticleLibraryService.selectByPrimaryKey(li.getObjectId());
if(articleLibrary != null){
li.setCover(articleLibrary.getCover());
li.setIntro(removeLabel(articleLibrary.getText()));
li.setName(articleLibrary.getName());
li.setObjectId(articleLibrary.getId());
li.setObjectType(ResourceTypeEnum.VIDEO_LIBRARY.getCode());
}
}
}
});
return CallBack.success(voPage);
}
......
......@@ -30,7 +30,7 @@ public class FgResourceLibraryController {
@Autowired
private FgResourceRelationService resourceRelationService;
@ApiOperation("相关视频")
@ApiOperation("相关资源")
@GetMapping("/relation-resource/page")
public CallBack<List<FgAboutListVo>> queryByRelation(FgQueryRelatedForm form, PageParam pageParam){
if (form == null || StringUtils.isBlank(form.getResourceId()) || form.getType() == null) {
......
......@@ -3,7 +3,6 @@ package com.zrqx.resource.fg.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import com.zrqx.core.mapper.BaseMapper;
......@@ -25,18 +24,31 @@ public interface FgResourceRelationMapper extends BaseMapper<ResourceRelation>
+ "<if test='type != null'> "
+ " and ar.resourceType = #{type} "
+ "</if>"
+ "order by ar.isTop desc,ar.sort asc "
+ "</script>")
List<FgAboutListVo> queryVideoByResourceType(FgQueryRelatedForm form);
/**
*
* @param entity
* @return
*/
@Select("<script>"
+ "select distinct ar.objectId "
+ "select vi.id ,vi.name, vi.resourceType, vi.cover,vi.text as synopsis "
+ "from res_resource_relation ar "
+ "left join res_course_library co on ar.resourceId = co.id "
+ "where 1 = 1 and co.status = 1 "
+ "<if test='"+ NOTBLANK +"(videoId)'> "
+ " and ar.resourceId = #{videoId} "
+ "left join res_article_library vi on ar.resourceId = vi.id "
+ "where 1 = 1 "
+ "<if test='"+ NOTBLANK +"(resourceId)'> "
+ " and ar.objectId = #{resourceId} "
+ "</if>"
+ "<if test='type != null'> "
+ " and ar.resourceType = #{type} "
+ "</if>"
+ "<if test='resourceType != 1'> "
+ " and vi.status = 1 "
+ "</if>"
+ " and ar.resourceType = 5 "
+ "order by ar.isTop desc,ar.sort asc "
+ "</script>")
List<String> queryCourseListByVideoId(@Param("videoId") String videoId);
List<FgAboutListVo> queryArticleByResourceType(FgQueryRelatedForm entity);
}
package com.zrqx.resource.fg.mapper.articlelibrary;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.resource.commons.model.articlelibrary.ArticleLibrary;
/**
* 文章库
*/
public interface FgArticleLibraryMapper extends BaseMapper<ArticleLibrary> {
}
package com.zrqx.resource.fg.service;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zrqx.core.enums.resource.ResourceTypeEnum;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.service.BaseServiceImpl;
import com.zrqx.core.util.page.PageParam;
......@@ -38,11 +39,15 @@ public class FgResourceRelationServiceImpl extends BaseServiceImpl<ResourceRelat
*/
@Override
public List<FgAboutListVo> queryByIdAndResourceType(FgQueryRelatedForm entity, PageParam pageParam) {
if (pageParam != null && StringUtils.isBlank(pageParam.getOrderBy())) {
pageParam.setOrderBy("sort asc");
List<FgAboutListVo> list = new ArrayList<FgAboutListVo>();
if(ResourceTypeEnum.VIDEO_LIBRARY.getCode().equals(entity.getType())) {
startPage(pageParam);
list = mapper.queryVideoByResourceType(entity);
}else if(ResourceTypeEnum.ARTICLE_LIBRARY.getCode().equals(entity.getType())) {
startPage(pageParam);
list = mapper.queryArticleByResourceType(entity);
}
startPage(pageParam);
return mapper.queryVideoByResourceType(entity);
return list;
}
// 关联资源类型
......
package com.zrqx.resource.fg.service.articlelibrary;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.service.BaseServiceImpl;
import com.zrqx.resource.commons.model.articlelibrary.ArticleLibrary;
import com.zrqx.resource.fg.mapper.articlelibrary.FgArticleLibraryMapper;
/**
* 文章库
*/
@Service
public class FgArticleLibrarySerivceImpl extends BaseServiceImpl<ArticleLibrary,String> implements FgArticleLibraryService {
@Autowired
private FgArticleLibraryMapper mapper;
@Override
public BaseMapper<ArticleLibrary> getMapper() {
return mapper;
}
}
package com.zrqx.resource.fg.service.articlelibrary;
import com.zrqx.core.service.BaseService;
import com.zrqx.resource.commons.model.articlelibrary.ArticleLibrary;
/**
* 文章库
*/
public interface FgArticleLibraryService extends BaseService<ArticleLibrary,String>{
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论