|
|
@@ -0,0 +1,87 @@
|
|
|
+package com.fdkankan.manage.service.impl;
|
|
|
+
|
|
|
+import cn.dev33.satoken.stp.StpUtil;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.fdkankan.common.constant.ErrorCode;
|
|
|
+import com.fdkankan.common.exception.BusinessException;
|
|
|
+import com.fdkankan.common.response.PageInfo;
|
|
|
+import com.fdkankan.common.util.DateUtil;
|
|
|
+import com.fdkankan.manage.entity.LookSpace;
|
|
|
+import com.fdkankan.manage.mapper.ILookSpaceMapper;
|
|
|
+import com.fdkankan.manage.service.ILookSpaceService;
|
|
|
+import com.fdkankan.manage.vo.request.LookSpaceParam;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.Date;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 服务实现类
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author
|
|
|
+ * @since 2022-06-30
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class LookSpaceServiceImpl extends ServiceImpl<ILookSpaceMapper, LookSpace> implements ILookSpaceService {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public PageInfo pageList(LookSpaceParam param) {
|
|
|
+ LambdaQueryWrapper<LookSpace> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ if(StringUtils.isNotBlank(param.getVideoTitle())){
|
|
|
+ wrapper.like(LookSpace::getVideoTitle,param.getVideoTitle());
|
|
|
+ }
|
|
|
+ wrapper.orderByDesc(LookSpace::getSort);
|
|
|
+ wrapper.orderByDesc(LookSpace::getCreateTime);
|
|
|
+ Page<LookSpace> page = new Page<>(param.getPageNum(),param.getPageSize());
|
|
|
+ return PageInfo.PageInfo(this.page(page,wrapper));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void add(LookSpaceParam param) {
|
|
|
+ if(StringUtils.isEmpty(param.getVideoTitle()) || StringUtils.isEmpty(param.getVideoFile())){
|
|
|
+ throw new BusinessException(ErrorCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
+ }
|
|
|
+ Long loginId = (Long) StpUtil.getLoginId();
|
|
|
+ LookSpace lookSpace = new LookSpace();
|
|
|
+ lookSpace.setVideoFile(param.getVideoFile());
|
|
|
+ lookSpace.setVideoTitle(param.getVideoTitle());
|
|
|
+ lookSpace.setCreateUserId(loginId);
|
|
|
+ lookSpace.setUpdateTime(DateUtil.date2String(new Date(),DateUtil.DEFAULT_DATE_FORMAT));
|
|
|
+ this.save(lookSpace);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void updateByParam(LookSpaceParam param) {
|
|
|
+ if(param.getId() == null){
|
|
|
+ throw new BusinessException(ErrorCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
+ }
|
|
|
+ LambdaUpdateWrapper<LookSpace> wrapper = new LambdaUpdateWrapper<>();
|
|
|
+ if(StringUtils.isNotBlank(param.getVideoFile())){
|
|
|
+ wrapper.set(LookSpace::getVideoFile,param.getVideoFile());
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(param.getVideoTitle())){
|
|
|
+ wrapper.set(LookSpace::getVideoTitle,param.getVideoTitle());
|
|
|
+ }
|
|
|
+ if(param.getIsShow()!=null){
|
|
|
+ wrapper.set(LookSpace::getIsShow,param.getIsShow());
|
|
|
+ }
|
|
|
+ if(param.getSort() !=null){
|
|
|
+ wrapper.set(LookSpace::getSort,param.getSort());
|
|
|
+ }
|
|
|
+ wrapper.eq(LookSpace::getId,param.getId());
|
|
|
+ this.update(wrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void isPush(Integer isPush,Long id) {
|
|
|
+ LambdaUpdateWrapper<LookSpace> wrapper = new LambdaUpdateWrapper<>();
|
|
|
+ wrapper.set(LookSpace::getIsPush,isPush);
|
|
|
+ wrapper.eq(LookSpace::getId,id);
|
|
|
+ this.update(wrapper);
|
|
|
+ }
|
|
|
+}
|