提交 66d26a6b authored 作者: renjiancai's avatar renjiancai

--no commit message

上级 048aa35f
package com.zrqx.resource.bg.controller.label;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.Arrays;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
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.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.zrqx.core.constant.resource.ResourceRequestPath;
import com.zrqx.core.exception.BusinessValidateException;
import com.zrqx.core.form.resource.bg.label.SaveUpdateLabelContentForm;
import com.zrqx.core.form.resource.bg.label.SaveUpdateLabelForm;
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.label.LabelAndContentByDataTypeVO;
import com.zrqx.core.vo.resource.label.LabelContentDiyTypeVO;
import com.zrqx.core.vo.resource.label.LabelListVO;
import com.zrqx.core.vo.resource.label.LabelOneVO;
import com.zrqx.resource.bg.service.label.LabelContentDiyTypeService;
import com.zrqx.resource.bg.service.label.LabelDataTypeService;
import com.zrqx.resource.bg.service.label.LabelService;
/**
* 标签库Controller
*/
@RestController
@RequestMapping(ResourceRequestPath.BG + ResourceRequestPath.LABEL)
@Api(description = "资源管理-标签库")
public class LabelController {
@Autowired
private LabelService service;
@Autowired
private LabelDataTypeService adrService;
@Autowired
private LabelContentDiyTypeService labelContentDiyTypeService;
@ApiOperation(value = "查询标签", notes = "根据ID查询")
@GetMapping(value = ResourceRequestPath.GET_OID)
public CallBack<LabelOneVO> getById(@PathVariable Integer oid) {
return CallBack.success(service.selectOne(oid));
}
@ApiOperation(value = "分页查询标签" , notes ="分页查询标签")
@GetMapping(value = ResourceRequestPath.PAGE)
public CallBack<PageInfo<LabelListVO>> page(Integer nationsType, PageParam pageParam){
if (null != pageParam && StringUtils.isBlank(pageParam.getOrderBy())) {
pageParam.setOrderBy("createTime desc");
}
return CallBack.success(service.page(nationsType, pageParam));
}
@ApiOperation(value = "根据数据类型查询标签", notes = "根据数据类型查询标签")
@GetMapping(value = ResourceRequestPath.LIST + ResourceRequestPath.DATATYPE)
public CallBack<PageInfo<LabelAndContentByDataTypeVO>> queryLabelByDataType(@RequestParam String dataType) {
return CallBack.success(adrService.queryLabelAndContentByDataType(dataType));
}
@ApiOperation(value = "新增标签", notes = "新增标签")
@PostMapping(value = ResourceRequestPath.SAVE)
public CallBack<Boolean> save(@RequestBody SaveUpdateLabelForm form) {
if (!service.saveOrUpdate(form)) {
throw new BusinessValidateException("操作失败");
}
return CallBack.success();
}
@ApiOperation(value = "更新标签", notes = "根据ID更新")
@PostMapping(value = ResourceRequestPath.UPDATE)
public CallBack<Boolean> update(@RequestBody SaveUpdateLabelForm form) {
if (!service.saveOrUpdate(form)) {
throw new BusinessValidateException("操作失败");
}
return CallBack.success();
}
@ApiOperation(value = "删除标签", notes = "删除标签")
@PostMapping(value = ResourceRequestPath.DELETE_OID)
public CallBack<Boolean> delete(@PathVariable Integer oid) {
return CallBack.success(service.batchDelete(Arrays.asList(oid)));
}
@ApiOperation(value = "批量删除标签", notes = "批量删除标签")
@PostMapping(value = ResourceRequestPath.BATCH + ResourceRequestPath.DELETE)
public CallBack<Boolean> deleteByIds(@RequestBody List<Integer> ids) {
return CallBack.success(service.batchDelete(ids));
}
@ApiOperation(value = "查询标签内容", notes = "根据标签id查询列表")
@GetMapping(value = ResourceRequestPath.CONTENT + ResourceRequestPath.OID)
public CallBack<PageInfo<LabelContentDiyTypeVO>> list(@PathVariable Integer oid) {
return CallBack.success(labelContentDiyTypeService.list(oid));
}
@ApiOperation(value = "新增标签内容", notes = "0:成功;1:id必须为空;2:标签id不能为空;3:父类id不能为空;4:标签内容不能为空;5:同级已存在该标签内容")
@PostMapping(value = ResourceRequestPath.CONTENT + ResourceRequestPath.SAVE)
public CallBack<Boolean> save(@RequestBody SaveUpdateLabelContentForm entity) {
if (!labelContentDiyTypeService.save(entity)) {
throw new BusinessValidateException("操作失败");
}
return CallBack.success();
}
@ApiOperation(value = "更新标签内容", notes = "0:成功;1:id不能为空;2:标签id不能为空;3:父类id不能为空;4:标签内容不能为空;5:同级已存在该标签内容")
@PostMapping(value = ResourceRequestPath.CONTENT + ResourceRequestPath.UPDATE)
public CallBack<Boolean> update(@RequestBody SaveUpdateLabelContentForm entity) {
if (!labelContentDiyTypeService.update(entity)) {
throw new BusinessValidateException("操作失败");
}
return CallBack.success(true);
}
@ApiOperation(value = "批量删除标签内容", notes = "批量删除")
@PostMapping(value = ResourceRequestPath.CONTENT + ResourceRequestPath.DELETE)
public CallBack<Boolean> delete(@RequestBody List<Integer> ids) {
return CallBack.success(labelContentDiyTypeService.batchDelete(ids));
}
}
......@@ -33,9 +33,7 @@ import com.zrqx.core.vo.resource.fg.recommend.RecommendResourcePageVo;
import com.zrqx.core.vo.resource.fg.videolibrary.FgVideoLibraryListVO;
import com.zrqx.resource.fg.service.articlelibrary.FgArticleLibraryService;
import com.zrqx.resource.fg.service.audiolibrary.FgAudioLibraryService;
import com.zrqx.resource.fg.service.authorlibrary.FgAuthorLibraryService;
import com.zrqx.resource.fg.service.ebook.FgEbookService;
import com.zrqx.resource.fg.service.marketing.FgPromotionService;
import com.zrqx.resource.fg.service.recommend.FgRecommendResourceService;
import com.zrqx.resource.fg.service.recommend.FgRecommendService;
import com.zrqx.resource.fg.service.videolibrary.FgVideoLibraryService;
......
......@@ -160,31 +160,11 @@ public class FgResourceLibraryController {
if(StringUtils.isBlank(form.getContent())){
throw new ParameterValidateException(1, "内容不能为空");
}
/*PageHelper.startPage(1, 20);*/
PageParam pageParam = new PageParam();
pageParam.setPageNum(1);
pageParam.setPageSize(10);
List<String> result = solrList(form);
return CallBack.success(result);
/*//医家
if(resourceType == AllResourceTypeEnum.YIJIA.getCode()){
Example example = authorLibraryService.createExample();
example.createCriteria().andLike("name", name+"%").andEqualTo("status", LibraryStatusEnum.STATUS_1.getCode());
List<AuthorLibrary> authorList = authorLibraryService.selectByExample(example);
list = authorList.stream().map(AuthorLibrary :: getName).collect(Collectors.toList());
}
//医著
if(resourceType == AllResourceTypeEnum.YIZHU.getCode()){
list = ebookService.searchList(name);
}
//文章类型
if(ArticleTypeEnum.getName(resourceType.toString()) != null){
Example example = articleLibraryService.createExample();
example.createCriteria().andLike("title", name+"%").andEqualTo("status", LibraryStatusEnum.STATUS_1.getCode());
List<ArticleLibrary> articleList = articleLibraryService.selectByExample(example);
list = articleList.stream().map(ArticleLibrary :: getTitle).collect(Collectors.toList());
}*/
//return CallBack.success(list);
};
@ApiOperation(value = "分页条件查询资源列表", notes = "分页条件查询资源列表")
......
package com.zrqx.resource.fg.mapper.label;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.model.resource.label.LabelContentDiyType;
/**
* 标签内容
*/
public interface FgLabelContentDiyTypeMapper extends BaseMapper<LabelContentDiyType> {
}
package com.zrqx.resource.fg.mapper.label;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import com.zrqx.core.form.resource.fg.label.FgQueryLabelListForm;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.model.resource.label.Label;
import com.zrqx.core.vo.resource.fg.label.FgLabelInfoVO;
public interface FgLabelMapper extends BaseMapper<Label>{
/**
* 根据民族类型、资源类型进行查询
* @param form
* @return
* @author ycw
* @date: 2019年1月11日 上午9:17:35
*/
@Select("<script>"
+ "select distinct l.id labelId,l.name,l.englishName,l.nationsType "
+ " from res_label l "
+ " left join res_label_data_type ld "
+ " on l.id = ld.labelId "
+ " where 1=1 "
+ "<if test='form.nationsType != null '>"
+ " and l.nationsType = #{form.nationsType} "
+ "</if>"
+ "<if test='" + NOTBLANK + "(form.resType)'>"
+ " and ld.dataType = #{form.resType} "
+ "</if>"
+ "</script>")
List<FgLabelInfoVO> queryLabelList(@Param("form")FgQueryLabelListForm form);
/**
* 查询通用标签
* @return
* @author ycw
* @date: 2019年3月27日 下午3:00:38
*/
@Select("<script>"
+ "select distinct l.id labelId,l.name,l.englishName "
+ " from res_label l "
+ " where l.id in (SELECT labelId FROM res_label_data_type GROUP BY labelId HAVING COUNT(*) =5 ) "
+ "</script>")
List<FgLabelInfoVO> queryPublicLabelList();
}
......@@ -32,7 +32,6 @@ import com.zrqx.resource.fg.client.organ.OrganClient;
import com.zrqx.resource.fg.manage.memberconllection.FgMemberConllectionManage;
import com.zrqx.resource.fg.mapper.annexlibrary.FgAnnexLibraryDiyTypeMapper;
import com.zrqx.resource.fg.mapper.annexlibrary.FgAnnexLibraryMapper;
import com.zrqx.resource.fg.mapper.record.FgRecordMapper;
import com.zrqx.resource.fg.service.ebook.FgEbookServiceImpl;
/**
......@@ -45,10 +44,6 @@ public class FgAnnexLibrarySerivceImpl extends
@Autowired
private FgAnnexLibraryMapper mapper;
@Autowired
private FgRecordMapper recordMapper;
@Autowired
private Redis redis;
......
......@@ -13,7 +13,6 @@ import com.zrqx.core.model.resource.articlelibrary.ArticleLibraryLabelContentDiy
import com.zrqx.core.model.resource.label.LabelContentDiyType;
import com.zrqx.core.service.BaseServiceImpl;
import com.zrqx.core.util.bean.BeanUtils;
import com.zrqx.core.util.bean.Copy;
import com.zrqx.core.vo.resource.fg.label.FgLabelContentDiyTypeVO;
import com.zrqx.core.vo.resource.fg.label.FgLabelInfoVO;
import com.zrqx.resource.fg.mapper.articlelibrary.FgArticleLibraryLabelContentDiyTypeMapper;
......
package com.zrqx.resource.fg.service.articlelibrary;
import java.util.List;
import java.util.Map;
import org.apache.solr.common.SolrDocument;
import com.zrqx.core.form.resource.fg.articlelibrary.FgCountArticleNumForm;
import com.zrqx.core.form.resource.fg.articlelibrary.FgQueryArticleLibraryForm;
import com.zrqx.core.form.resource.fg.articlelibrary.FgQueryRecommedArticleForm;
import com.zrqx.core.form.resource.fg.articlelibrary.FgQueryRelatedArticleForm;
......@@ -16,7 +14,6 @@ import com.zrqx.core.util.page.PageInfo;
import com.zrqx.core.util.page.PageParam;
import com.zrqx.core.vo.resource.fg.articlelibrary.FgArticleLibraryListVO;
import com.zrqx.core.vo.resource.fg.articlelibrary.FgArticleLibraryOneVO;
import com.zrqx.core.vo.resource.fg.recommend.FgTypeToResourceListVo;
/**
* 文章库
*/
......
......@@ -13,7 +13,6 @@ import com.zrqx.core.model.resource.audiolibrary.AudioLibraryLabelContentDiyType
import com.zrqx.core.model.resource.label.LabelContentDiyType;
import com.zrqx.core.service.BaseServiceImpl;
import com.zrqx.core.util.bean.BeanUtils;
import com.zrqx.core.util.bean.Copy;
import com.zrqx.core.vo.resource.fg.label.FgLabelContentDiyTypeVO;
import com.zrqx.core.vo.resource.fg.label.FgLabelInfoVO;
import com.zrqx.resource.fg.mapper.audiolibrary.FgAudioLibraryLabelContentDiyTypeMapper;
......
......@@ -13,7 +13,6 @@ import com.zrqx.core.model.resource.authorLibrary.AuthorLibraryLabelContentDiyTy
import com.zrqx.core.model.resource.label.LabelContentDiyType;
import com.zrqx.core.service.BaseServiceImpl;
import com.zrqx.core.util.bean.BeanUtils;
import com.zrqx.core.util.bean.Copy;
import com.zrqx.core.vo.resource.fg.label.FgLabelContentDiyTypeVO;
import com.zrqx.core.vo.resource.fg.label.FgLabelInfoVO;
import com.zrqx.resource.fg.mapper.authorlibrary.FgAuthorLabelContentDiyTypeMapper;
......
......@@ -3,7 +3,6 @@ package com.zrqx.resource.fg.service.authorlibrary;
import java.util.List;
import com.zrqx.core.form.resource.fg.authorLibrary.FgQueryAuthorLibraryForm;
import com.zrqx.core.form.resource.fg.authorLibrary.FgQueryOtherAuthorForm;
import com.zrqx.core.form.resource.fg.authorLibrary.FgQueryRecommedAuthorForm;
import com.zrqx.core.model.resource.authorLibrary.AuthorLibrary;
import com.zrqx.core.service.BaseService;
......
......@@ -31,7 +31,6 @@ import com.zrqx.core.vo.resource.fg.authorlibrary.FgAuthorLibraryOneVO;
import com.zrqx.resource.commons.Redis;
import com.zrqx.resource.fg.manage.memberconllection.FgMemberConllectionManage;
import com.zrqx.resource.fg.mapper.articlelibrary.FgArticleLibraryMapper;
import com.zrqx.resource.fg.mapper.articlelibrary.FgAuthorResourceMapper;
import com.zrqx.resource.fg.mapper.authorlibrary.FgAuthorLibraryMapper;
import com.zrqx.resource.fg.mapper.ebook.FgBookMapper;
import com.zrqx.resource.fg.mapper.ebook.FgEbookMapper;
......@@ -44,8 +43,6 @@ public class FgAuthorLibraryServiceImpl extends BaseServiceImpl<AuthorLibrary, S
@Autowired
private FgMemberConllectionManage fgMemberConllectionManage;
@Autowired
private FgAuthorResourceMapper fgAuthorResourceMapper;
@Autowired
private FgBookMapper booksMapper;
@Autowired
private FgEbookMapper ebookMapper;
......
......@@ -13,7 +13,6 @@ import com.zrqx.core.model.resource.ebook.EbookLabelContentDiyType;
import com.zrqx.core.model.resource.label.LabelContentDiyType;
import com.zrqx.core.service.BaseServiceImpl;
import com.zrqx.core.util.bean.BeanUtils;
import com.zrqx.core.util.bean.Copy;
import com.zrqx.core.vo.resource.fg.label.FgLabelContentDiyTypeVO;
import com.zrqx.core.vo.resource.fg.label.FgLabelInfoVO;
import com.zrqx.resource.fg.mapper.ebook.FgEbookLabelContentDiyTypeMapper;
......
......@@ -30,7 +30,6 @@ import com.zrqx.resource.fg.client.organ.OrganClient;
import com.zrqx.resource.fg.manage.memberconllection.FgMemberConllectionManage;
import com.zrqx.resource.fg.mapper.imagelibrary.FgImageLibraryDiyTypeRelationMapper;
import com.zrqx.resource.fg.mapper.imagelibrary.FgImageLibraryMapper;
import com.zrqx.resource.fg.mapper.record.FgRecordMapper;
import com.zrqx.resource.fg.service.ebook.FgEbookServiceImpl;
/**
......@@ -45,9 +44,6 @@ public class FgImageLibrarySerivceImpl extends
private FgImageLibraryMapper mapper;
@Autowired
private FgRecordMapper recordMapper;
@Autowired
private Redis redis;
@Autowired
......
package com.zrqx.resource.fg.service.label;
import java.util.List;
import com.zrqx.core.form.resource.fg.label.FgQueryLabelListForm;
import com.zrqx.core.model.resource.label.Label;
import com.zrqx.core.service.BaseService;
import com.zrqx.core.vo.resource.fg.label.FgLabelInfoVO;
public interface FgLabelService extends BaseService<Label, Integer> {
List<FgLabelInfoVO> queryLabelList(FgQueryLabelListForm form);
}
package com.zrqx.resource.fg.service.label;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.zrqx.core.enums.BooleanStatusEnum;
import com.zrqx.core.form.resource.fg.label.FgQueryLabelListForm;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.model.resource.label.Label;
import com.zrqx.core.model.resource.label.LabelContentDiyType;
import com.zrqx.core.service.BaseServiceImpl;
import com.zrqx.core.util.bean.Copy;
import com.zrqx.core.vo.resource.fg.label.FgLabelContentDiyTypeVO;
import com.zrqx.core.vo.resource.fg.label.FgLabelInfoVO;
import com.zrqx.resource.fg.mapper.label.FgLabelContentDiyTypeMapper;
import com.zrqx.resource.fg.mapper.label.FgLabelMapper;
@Service
public class FgLabelServiceImpl extends BaseServiceImpl<Label, Integer> implements FgLabelService {
@Autowired
private FgLabelMapper mapper;
@Autowired
private FgLabelContentDiyTypeMapper labelContentDiyTypeMapper;
@Override
public BaseMapper<Label> getMapper() {
return mapper;
}
@Override
public List<FgLabelInfoVO> queryLabelList(FgQueryLabelListForm form){
List<FgLabelInfoVO> vo = mapper.queryLabelList(form);
vo.forEach(v -> {
PageHelper.orderBy("sort");
LabelContentDiyType dt = new LabelContentDiyType();
dt.setLabelId(v.getLabelId());
dt.setStatus(Integer.parseInt(BooleanStatusEnum.YES.getCode()));
List<LabelContentDiyType> list = labelContentDiyTypeMapper.select(dt);
List<FgLabelContentDiyTypeVO> voList = Copy.copyList(list, FgLabelContentDiyTypeVO.class, obj -> obj.getParentId().intValue() == 0 && obj.getLabelId() == v.getLabelId());
//tree(list,voList);
v.setLabelContent(voList);
});
return vo;
}
/*public List<FgLabelContentDiyTypeVO> tree(List<LabelContentDiyType> list,List<FgLabelContentDiyTypeVO> voList){
voList.forEach(entity ->{
//第一次设置 一级分类的子类 后续递归设置 子类的子类
entity.setList(Copy.copyList(list, FgLabelContentDiyTypeVO.class, obj -> obj.getParentId().intValue() == entity.getId().intValue()));
//当前分类存在子类 开始递归子类
if(entity.getList().size() > 0){
tree(list, entity.getList());
}
});
return voList;
}*/
}
......@@ -7,10 +7,7 @@ import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.model.resource.marketing.Promotion;
import com.zrqx.core.service.BaseServiceImpl;
import com.zrqx.core.vo.resource.fg.marketing.FgPromotionInfoOneVO;
import com.zrqx.resource.bg.mapper.articlelibrary.ArticleLibraryMapper;
import com.zrqx.resource.bg.mapper.ebook.EbookMapper;
import com.zrqx.resource.fg.manage.marketing.FgPromotionManage;
import com.zrqx.resource.fg.mapper.marketing.FgPromotionContentMapper;
import com.zrqx.resource.fg.mapper.marketing.FgPromotionMapper;
......@@ -18,16 +15,9 @@ import com.zrqx.resource.fg.mapper.marketing.FgPromotionMapper;
@Service
public class FgPromotionServiceImpl extends BaseServiceImpl<Promotion, Integer> implements FgPromotionService {
@Autowired
private FgPromotionMapper mapper;
@Autowired
private FgPromotionContentMapper pcMapper;
@Autowired
private EbookMapper ebookMapper;
@Autowired
private ArticleLibraryMapper articleLibraryMapper;
@Autowired
private FgPromotionManage fgPromotionManage;
......
......@@ -6,7 +6,6 @@ import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.model.resource.searchHistory.SearchHistory;
import com.zrqx.core.service.BaseServiceImpl;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论