提交 8afb4d5a authored 作者: renjiancai's avatar renjiancai

--no commit message

上级 b8257174
package com.zrqx.core.form.resource.bg.videolibrary;
import java.util.List;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -12,12 +10,4 @@ public class QueryVideoLibraryForm {
private String name;
@ApiModelProperty("状态:1已上架,0已下架")
private String status;
@ApiModelProperty(value="上传时间-开始")
private String beginTime;
@ApiModelProperty(value="上传时间-结束")
private String endTime;
@ApiModelProperty(value = "自定义分类id")
private List<Integer> diyTypeId;
@ApiModelProperty("自定义分类code")
private String diyTypeCode;
}
......@@ -15,7 +15,7 @@ public class SaveUpdateVideoLibraryForm {
@ApiModelProperty(value = "视频名称")
private String name;
@ApiModelProperty("来源")
private String adSlogan;
private String source;
@ApiModelProperty(value = "分类id")
private List<VideoLibraryDiyType> diyType;
@ApiModelProperty("封面")
......
......@@ -2,12 +2,9 @@ package com.zrqx.core.form.resource.bg.videolibrary;
import java.util.List;
import com.zrqx.core.model.resource.videolibrary.VideoLibraryDiyType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import scala.math.BigDecimal;
@Data
@ApiModel(value="SaveVideoLibraryForm",description="添加视频库")
public class SaveVideoLibraryForm {
......@@ -17,18 +14,12 @@ public class SaveVideoLibraryForm {
private String source;
@ApiModelProperty("关键词")
private String keywords;
@ApiModelProperty("定价")
private BigDecimal price;
@ApiModelProperty("售价")
private BigDecimal realPrice;
@ApiModelProperty("简介")
private String synopsis;
@ApiModelProperty("video")
private List<String> video;
@ApiModelProperty("封面")
private String cover;
@ApiModelProperty(value = "分类id")
private VideoLibraryDiyType diyType;
@ApiModelProperty("格式")
private List<String> formats;
@ApiModelProperty("文件大小")
......@@ -37,6 +28,4 @@ public class SaveVideoLibraryForm {
private List<String> timeLength;
@ApiModelProperty("video名称")
private List<String> videoName;
@ApiModelProperty("来源")
private String adSlogan;
}
......@@ -11,7 +11,7 @@ public class VideoLibraryListVO {
@ApiModelProperty(value = "资源名称")
private String name;
@ApiModelProperty("来源")
private String adSlogan;
private String source;
@ApiModelProperty("上传时间")
private String uploadTime;
@ApiModelProperty("状态:1已上架,2已下架")
......@@ -22,4 +22,6 @@ public class VideoLibraryListVO {
private String timeLength;
@ApiModelProperty("文件大小")
private String size;
@ApiModelProperty("排序")
private Integer sort;
}
......@@ -16,7 +16,7 @@ public class VideoLibraryOneVO {
@ApiModelProperty(value = "视频名称")
private String name;
@ApiModelProperty("来源")
private String adSlogan;
private String source;
@ApiModelProperty(value = "分类id")
private List<VideoLibraryDiyType> diyType;
@ApiModelProperty("封面")
......
package com.zrqx.resource.bg.controller.videoLibrary;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
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;
......@@ -15,30 +11,20 @@ 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 org.springframework.web.multipart.MultipartFile;
import com.zrqx.core.enums.resource.LibraryStatusEnum;
import com.zrqx.core.enums.resource.PriceOptionEnum;
import com.zrqx.core.exception.BaseException;
import com.zrqx.core.form.resource.bg.recommend.UpdateRecommendResourceForm;
import com.zrqx.core.form.resource.bg.videolibrary.BatchUpdateVideoLibraryForm;
import com.zrqx.core.form.resource.bg.videolibrary.QueryVideoLibraryForm;
import com.zrqx.core.form.resource.bg.videolibrary.SaveUpdateVideoLibraryForm;
import com.zrqx.core.form.resource.bg.videolibrary.SaveVideoLibraryForm;
import com.zrqx.core.model.recommend.RecommendResource;
import com.zrqx.core.model.resource.imagelibrary.ImageLibrary;
import com.zrqx.core.model.resource.videolibrary.VideoLibrary;
import com.zrqx.core.model.resource.videolibrary.VideoLibraryDiyType;
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.ImportLabelVo;
import com.zrqx.core.vo.resource.videolibrary.VideoLibraryListVO;
import com.zrqx.core.vo.resource.videolibrary.VideoLibraryOneVO;
import com.zrqx.resource.bg.service.recommend.RecommendResourceService;
import com.zrqx.resource.bg.service.videolibrary.VideoLibraryDiyTypeService;
import com.zrqx.resource.bg.service.videolibrary.VideoLibraryService;
import io.swagger.annotations.Api;
......@@ -54,11 +40,6 @@ import tk.mybatis.mapper.entity.Example;
public class VideoLibraryController {
@Autowired
private VideoLibraryService service;
@Autowired
private VideoLibraryDiyTypeService vdrService;
/** 推荐位内容 */
@Autowired
private RecommendResourceService recommendResourceService;
@ApiOperation(value = "新增/修改 视频资源", notes = "新增/修改 视频资源")
@PostMapping(value = "/save")
......@@ -131,9 +112,10 @@ public class VideoLibraryController {
@ApiOperation(value = "查询", notes = "根据ID查询")
@GetMapping(value = "/get/{oid}")
public CallBack<VideoLibraryOneVO> getById(@PathVariable String oid) {
VideoLibrary entity = service.selectByPrimaryKey(oid);
VideoLibrary entity = service.selectByPrimaryKey(oid);
VideoLibraryOneVO vo = new VideoLibraryOneVO();
BeanUtils.copyProperties(entity, vo);
vo.setSource(entity.getAdSlogan());
return CallBack.success(vo);
}
......
......@@ -17,31 +17,14 @@ import com.zrqx.resource.bg.mapper.MapperConstants;
*/
public interface VideoLibraryMapper extends BaseMapper<VideoLibrary> {
@Select("<script>"
+ "<if test = 'form.diyTypeCode==null'>"
+ "select DISTINCT a.id,a.name,a.adSlogan,a.size,a.timeLength, DATE_FORMAT(a.uploadTime,'%Y-%m-%d %H:%i') uploadTime,a.status "
+ "select DISTINCT a.id,a.name,a.adSlogan source,a.size,a.timeLength, DATE_FORMAT(a.uploadTime,'%Y-%m-%d %H:%i') uploadTime,a.status,a.sort "
+ "from res_Video_Library a "
+ "</if>"
+ "<if test = '" + NOTBLANK + "(form.diyTypeCode)'>"
+ "select DISTINCT a.id,a.name,a.adSlogan,a.size,a.timeLength, DATE_FORMAT(a.uploadTime,'%Y-%m-%d %H:%i') uploadTime,a.status "
+ "from res_Video_Library a left join res_Video_Library_Diy_Type ad "
+ "on a.id = ad.vlid "
+ "</if>"
+ "where 1=1 "
+ "<if test = '" + NOTBLANK + "(form.diyTypeCode)'>"
+ " and ad.code like concat(#{form.diyTypeCode},'%') "
+ "</if>"
+ "<if test = '" + NOTBLANK + "(form.name)'>"
+ " and a.name like concat('%',#{form.name},'%') or a.adSlogan like concat('%',#{form.name},'%') "
+ " and a.name like concat('%',#{form.name},'%')"
+ "</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> "
+ "</script>")
List<VideoLibraryListVO> query(@Param("form")QueryVideoLibraryForm form);
......
......@@ -78,28 +78,16 @@ public class VideoLibrarySerivceImpl extends BaseServiceImpl<VideoLibrary,String
entity.setBrowseNum(0);
entity.setSalesNum(0);
entity.setClickNum(0);
entity.setAdSlogan(form.getSource());
mapper.insert(entity);
}else{
//修改
/* entity = mapper.selectByPrimaryKey(form.getId());
BeanUtils.copyProperties(form, entity);*/
entity.setUpdateTime(new Date());
entity.setAdSlogan(form.getSource());
mapper.updateByPrimaryKeySelective(entity);
//删除当前对象与自定义分类的关系
VideoLibraryDiyType old = new VideoLibraryDiyType();
old.setVlId(entity.getId());
vdrMapper.delete(old);
}
//添加当前对象与自定义分类的关系
if(form.getDiyType() != null && form.getDiyType().size() > 0){
List<VideoLibraryDiyType> list = form.getDiyType();
list.forEach(li -> {
li.setVlId(entity.getId());
li.setCreateTime(new Date());
li.setCreater(redis.getUser().getUserName());
});
vdrMapper.insertUuidList(list);
}
return true;
}
/**
......@@ -132,15 +120,8 @@ public class VideoLibrarySerivceImpl extends BaseServiceImpl<VideoLibrary,String
obj.setRealPrice(new BigDecimal(0.00));
obj.setSalesNum(0);
obj.setVideoName(form.getNames().get(i));
obj.setAdSlogan(form.getAdSlogan());
obj.setAdSlogan(form.getSource());
mapper.insert(obj);
if(form.getDiyType() != null){
VideoLibraryDiyType videoLibraryDiyType = new VideoLibraryDiyType();
videoLibraryDiyType.setCode(form.getDiyType().getCode());
videoLibraryDiyType.setDtId(form.getDiyType().getDtId());
videoLibraryDiyType.setVlId(obj.getId());
vdrMapper.insert(videoLibraryDiyType);
}
}
return true;
......@@ -186,8 +167,6 @@ public class VideoLibrarySerivceImpl extends BaseServiceImpl<VideoLibrary,String
pageParam.setOrderBy(" updateTime desc");
}
startPage(pageParam);
//暂不用自定义分类id 做in查询
form.setDiyTypeId(null);
List<VideoLibraryListVO> list = mapper.query(form);
list.forEach(f -> {
if(f.getStatus() != null) {
......@@ -244,8 +223,6 @@ public class VideoLibrarySerivceImpl extends BaseServiceImpl<VideoLibrary,String
@Override
public PageInfo<VideoLibraryListVO> livePage(QueryVideoLibraryForm form, PageParam pageParam) {
startPage(pageParam);
//暂不用自定义分类id 做in查询
form.setDiyTypeId(null);
List<VideoLibraryListVO> list = mapper.liveQuery(form);
list.forEach(f -> {
if(f.getStatus() != null) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论