Commit aae54a19 authored by 盖献康's avatar 盖献康

Merge remote-tracking branch 'origin/master'

parents 0fe877ca f527ef0b
...@@ -137,4 +137,5 @@ public class CmsNewsController extends CyPaginationController<CmsNews> { ...@@ -137,4 +137,5 @@ public class CmsNewsController extends CyPaginationController<CmsNews> {
List<CmsNews> cmsNewsList = cmsNewsServiceImpl.export(cmsNews); List<CmsNews> cmsNewsList = cmsNewsServiceImpl.export(cmsNews);
CyEpExcelUtil.exportExcel(cmsNewsList, "文章表信息", "文章表信息", CmsNews.class, excelName, response); CyEpExcelUtil.exportExcel(cmsNewsList, "文章表信息", "文章表信息", CmsNews.class, excelName, response);
} }
} }
...@@ -25,5 +25,7 @@ public interface CmsNewsRepository extends CyBaseMapper<CmsNews> { ...@@ -25,5 +25,7 @@ public interface CmsNewsRepository extends CyBaseMapper<CmsNews> {
* *
*/ */
IPage<CmsNews> queryCmsNewssPaged(CyPageInfo cyPageInfo,@Param("entity") CmsNews cmsNews); IPage<CmsNews> queryCmsNewssPaged(CyPageInfo cyPageInfo,@Param("entity") CmsNews cmsNews);
CmsNews checkWeight(Integer weight);
} }
...@@ -25,7 +25,7 @@ public class CmsNews extends CyIdIncreEntity<CmsNews> { ...@@ -25,7 +25,7 @@ public class CmsNews extends CyIdIncreEntity<CmsNews> {
/** /**
* @desc 发布日期 * @desc 发布日期
* @column release_date * @column release_date
* @default * @default
*/ */
@JsonFormat( @JsonFormat(
pattern = "yyyy-MM-dd" pattern = "yyyy-MM-dd"
...@@ -37,7 +37,7 @@ public class CmsNews extends CyIdIncreEntity<CmsNews> { ...@@ -37,7 +37,7 @@ public class CmsNews extends CyIdIncreEntity<CmsNews> {
/** /**
* @desc 板块 * @desc 板块
* @column plate * @column plate
* @default * @default
*/ */
@Excel(name = "板块", orderNum = "1", width = 20) @Excel(name = "板块", orderNum = "1", width = 20)
private String plate; private String plate;
...@@ -45,7 +45,7 @@ public class CmsNews extends CyIdIncreEntity<CmsNews> { ...@@ -45,7 +45,7 @@ public class CmsNews extends CyIdIncreEntity<CmsNews> {
/** /**
* @desc 标题 * @desc 标题
* @column title * @column title
* @default * @default
*/ */
@Excel(name = "标题", orderNum = "2", width = 20) @Excel(name = "标题", orderNum = "2", width = 20)
private String title; private String title;
...@@ -53,7 +53,7 @@ public class CmsNews extends CyIdIncreEntity<CmsNews> { ...@@ -53,7 +53,7 @@ public class CmsNews extends CyIdIncreEntity<CmsNews> {
/** /**
* @desc 内容 * @desc 内容
* @column details * @column details
* @default * @default
*/ */
@Excel(name = "内容", orderNum = "3", width = 20) @Excel(name = "内容", orderNum = "3", width = 20)
private String details; private String details;
...@@ -61,7 +61,7 @@ public class CmsNews extends CyIdIncreEntity<CmsNews> { ...@@ -61,7 +61,7 @@ public class CmsNews extends CyIdIncreEntity<CmsNews> {
/** /**
* @desc 排序 * @desc 排序
* @column weight * @column weight
* @default * @default
*/ */
@Excel(name = "排序", orderNum = "4", width = 20) @Excel(name = "排序", orderNum = "4", width = 20)
private Integer weight; private Integer weight;
...@@ -69,7 +69,7 @@ public class CmsNews extends CyIdIncreEntity<CmsNews> { ...@@ -69,7 +69,7 @@ public class CmsNews extends CyIdIncreEntity<CmsNews> {
/** /**
* @desc 封面 * @desc 封面
* @column picture_id * @column picture_id
* @default * @default
*/ */
@Excel(name = "封面", orderNum = "5", width = 20) @Excel(name = "封面", orderNum = "5", width = 20)
private String pictureId; private String pictureId;
...@@ -77,7 +77,7 @@ public class CmsNews extends CyIdIncreEntity<CmsNews> { ...@@ -77,7 +77,7 @@ public class CmsNews extends CyIdIncreEntity<CmsNews> {
/** /**
* @desc 是否为头条 * @desc 是否为头条
* @column is_fornt_page * @column is_fornt_page
* @default * @default
*/ */
@Excel(name = "是否为头条", orderNum = "6", width = 20) @Excel(name = "是否为头条", orderNum = "6", width = 20)
private Integer isForntPage; private Integer isForntPage;
...@@ -85,7 +85,7 @@ public class CmsNews extends CyIdIncreEntity<CmsNews> { ...@@ -85,7 +85,7 @@ public class CmsNews extends CyIdIncreEntity<CmsNews> {
/** /**
* @desc 是否为推荐 * @desc 是否为推荐
* @column is_recommended * @column is_recommended
* @default * @default
*/ */
@Excel(name = "是否为推荐", orderNum = "7", width = 20) @Excel(name = "是否为推荐", orderNum = "7", width = 20)
private Integer isRecommended; private Integer isRecommended;
...@@ -93,23 +93,23 @@ public class CmsNews extends CyIdIncreEntity<CmsNews> { ...@@ -93,23 +93,23 @@ public class CmsNews extends CyIdIncreEntity<CmsNews> {
/** /**
* @desc 是否为置顶 * @desc 是否为置顶
* @column is_top * @column is_top
* @default * @default
*/ */
@Excel(name = "是否为置顶", orderNum = "8", width = 20) @Excel(name = "是否为置顶", orderNum = "8", width = 20)
private Integer isTop; private Integer isTop;
/** /**
* @desc 文章来源(0:爬虫 1:超管自建 2:单位管理员自建) * @desc 文章来源(0:爬虫 1:自建)
* @column news_type * @column news_type
* @default * @default
*/ */
@Excel(name = "文章来源(0:爬虫 1:超管自建 2:单位管理员自建)", orderNum = "9", width = 20) @Excel(name = "文章来源(0:爬虫 1:自建)", orderNum = "9", width = 20)
private String newsType; private String newsType;
/** /**
* @desc 房客id * @desc 房客id
* @column tenant * @column tenant
* @default * @default
*/ */
@Excel(name = "房客id", orderNum = "10", width = 20) @Excel(name = "房客id", orderNum = "10", width = 20)
private Integer tenant; private Integer tenant;
...@@ -128,5 +128,20 @@ public class CmsNews extends CyIdIncreEntity<CmsNews> { ...@@ -128,5 +128,20 @@ public class CmsNews extends CyIdIncreEntity<CmsNews> {
@TableField(exist = false) @TableField(exist = false)
private String endTime; private String endTime;
/**
* 封面路径
*/
private transient String path;
/**
* 阅读量
*/
private transient Integer readNum;
/**
* 所属商家
*/
private transient String unitId;
} }
package org.rcisoft.business.cmsnews.service; package org.rcisoft.business.cmsnews.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.rcisoft.business.cmsnews.entity.CmsNews; import org.rcisoft.business.cmsnews.entity.CmsNews;
import org.rcisoft.core.model.CyPersistModel; import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.aop.CyPageUtilAsp;
import org.rcisoft.core.model.CyPageInfo; import org.rcisoft.core.model.CyPageInfo;
import java.util.List; import java.util.List;
...@@ -71,5 +69,4 @@ public interface CmsNewsService { ...@@ -71,5 +69,4 @@ public interface CmsNewsService {
* @return * @return
*/ */
List<CmsNews> export(CmsNews cmsNews); List<CmsNews> export(CmsNews cmsNews);
} }
package org.rcisoft.business.cmsnews.service.impl; package org.rcisoft.business.cmsnews.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.rcisoft.business.cmsunitnewvideo.dao.CmsUnitNewVideoRepository;
import org.rcisoft.business.cmsunitnewvideo.entity.CmsUnitNewVideo;
import org.rcisoft.common.component.Global;
import org.rcisoft.core.exception.CyServiceException;
import org.rcisoft.core.util.CyUserUtil; import org.rcisoft.core.util.CyUserUtil;
import org.rcisoft.core.aop.CyPageUtilAsp; import org.rcisoft.core.aop.CyPageUtilAsp;
import org.rcisoft.core.model.CyPersistModel; import org.rcisoft.core.model.CyPersistModel;
...@@ -22,6 +28,10 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -22,6 +28,10 @@ import org.springframework.transaction.annotation.Transactional;
import org.rcisoft.core.model.CyPageInfo; import org.rcisoft.core.model.CyPageInfo;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
/** /**
...@@ -32,6 +42,11 @@ import lombok.extern.slf4j.Slf4j; ...@@ -32,6 +42,11 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j @Slf4j
public class CmsNewsServiceImpl extends ServiceImpl<CmsNewsRepository,CmsNews> implements CmsNewsService { public class CmsNewsServiceImpl extends ServiceImpl<CmsNewsRepository,CmsNews> implements CmsNewsService {
@Autowired
private Global global;
@Autowired
private CmsUnitNewVideoRepository cmsUnitNewVideoRepository;
/** /**
* 保存 文章表 * 保存 文章表
...@@ -42,10 +57,19 @@ public class CmsNewsServiceImpl extends ServiceImpl<CmsNewsRepository,CmsNews> ...@@ -42,10 +57,19 @@ public class CmsNewsServiceImpl extends ServiceImpl<CmsNewsRepository,CmsNews>
@Override @Override
public CyPersistModel persist(CmsNews cmsNews){ public CyPersistModel persist(CmsNews cmsNews){
//增加操作 //增加操作
int line = baseMapper.insert(cmsNews); //当图片字段没有时增加默认1
log.debug(CyUserUtil.getAuthenUsername()+"新增了ID为"+ if (ObjectUtil.isNull(cmsNews.getPictureId())) {
cmsNews.getBusinessId()+"的文章表信息"); cmsNews.setPictureId(global.getDEFAULT_NEWS_LOCATION());
return new CyPersistModel(line); }
CmsNews check = baseMapper.checkWeight(cmsNews.getWeight());
if (ObjectUtil.isNotNull(check)) {
throw new CyServiceException(500, "权重已存在");
} else {
int line = baseMapper.insert(cmsNews);
log.debug(CyUserUtil.getAuthenUsername()+"新增了ID为"+
cmsNews.getBusinessId()+"的文章表信息");
return new CyPersistModel(line);
}
} }
/** /**
...@@ -85,9 +109,17 @@ public class CmsNewsServiceImpl extends ServiceImpl<CmsNewsRepository,CmsNews> ...@@ -85,9 +109,17 @@ public class CmsNewsServiceImpl extends ServiceImpl<CmsNewsRepository,CmsNews>
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT) @Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override @Override
public CyPersistModel merge(CmsNews cmsNews){ public CyPersistModel merge(CmsNews cmsNews){
int line = baseMapper.updateById(cmsNews); //修改文本中的#image
log.debug(CyUserUtil.getAuthenUsername()+"修改了ID为"+ cmsNews.getBusinessId()+"的文章表信息"); String details = cmsNews.getDetails().replace("#image", "data:image");
return new CyPersistModel(line); cmsNews.setDetails(details);
CmsNews check = baseMapper.checkWeight(cmsNews.getWeight());
if (ObjectUtil.isNotNull(check) && !check.getBusinessId().equals(cmsNews.getBusinessId())) {
throw new CyServiceException(500, "权重已存在");
} else {
int line = baseMapper.updateById(cmsNews);
log.debug(CyUserUtil.getAuthenUsername()+"修改了ID为"+ cmsNews.getBusinessId()+"的文章表信息");
return new CyPersistModel(line);
}
} }
/** /**
...@@ -97,7 +129,11 @@ public class CmsNewsServiceImpl extends ServiceImpl<CmsNewsRepository,CmsNews> ...@@ -97,7 +129,11 @@ public class CmsNewsServiceImpl extends ServiceImpl<CmsNewsRepository,CmsNews>
*/ */
@Override @Override
public CmsNews findById(int id){ public CmsNews findById(int id){
return baseMapper.selectById(id); CmsNews cmsNews = baseMapper.selectById(id);
if (cmsNews.getPath() != null) {
cmsNews.setPath(global.getBase_Discovery() + cmsNews.getPath());
}
return cmsNews;
} }
/** /**
...@@ -108,8 +144,25 @@ public class CmsNewsServiceImpl extends ServiceImpl<CmsNewsRepository,CmsNews> ...@@ -108,8 +144,25 @@ public class CmsNewsServiceImpl extends ServiceImpl<CmsNewsRepository,CmsNews>
@Override @Override
public IPage<CmsNews> findAllByPagination(CyPageInfo<CmsNews> paginationUtility, public IPage<CmsNews> findAllByPagination(CyPageInfo<CmsNews> paginationUtility,
CmsNews cmsNews){ CmsNews cmsNews){
return baseMapper.queryCmsNewssPaged(paginationUtility,cmsNews); IPage<CmsNews> cmsNewsIPage = baseMapper.queryCmsNewssPaged(paginationUtility, cmsNews);
List<CmsNews> records = cmsNewsIPage.getRecords();
//查询文章所属商家信息
LambdaQueryWrapper<CmsUnitNewVideo> qw = new LambdaQueryWrapper<>();
qw.eq(CmsUnitNewVideo::getType, "0");
List<CmsUnitNewVideo> cmsUnitNewVideos = cmsUnitNewVideoRepository.selectList(qw);
//根据文章id查询商家信息
Map<Integer, List<CmsUnitNewVideo>> map = cmsUnitNewVideos.stream().collect(Collectors.groupingBy(CmsUnitNewVideo::getNewsVideoId));
for (CmsNews cmsNews1 : records) {
if (map.containsKey(cmsNews1.getBusinessId()) && map.get(cmsNews1.getBusinessId()) != null){
List<CmsUnitNewVideo> cmsUnitNewVideos1 = map.get(cmsNews1.getBusinessId());
List<String> deptIds = cmsUnitNewVideos1.stream().map(CmsUnitNewVideo::getUnitId).collect(Collectors.toList());
cmsNews1.setUnitId(deptIds.toString());
}
if (cmsNews1.getPath() != null) {
cmsNews1.setPath(global.getBase_Discovery() + cmsNews1.getPath());
}
}
return cmsNewsIPage;
} }
/** /**
......
...@@ -21,7 +21,7 @@ public class CmsPriceClick extends CyIdIncreEntity<CmsPriceClick> { ...@@ -21,7 +21,7 @@ public class CmsPriceClick extends CyIdIncreEntity<CmsPriceClick> {
/** /**
* @desc 单位id * @desc 单位id
* @column unit_id * @column unit_id
* @default * @default
*/ */
@Excel(name = "单位id", orderNum = "0", width = 20) @Excel(name = "单位id", orderNum = "0", width = 20)
private Integer unitId; private Integer unitId;
...@@ -29,7 +29,7 @@ public class CmsPriceClick extends CyIdIncreEntity<CmsPriceClick> { ...@@ -29,7 +29,7 @@ public class CmsPriceClick extends CyIdIncreEntity<CmsPriceClick> {
/** /**
* @desc 用户id * @desc 用户id
* @column user_id * @column user_id
* @default * @default
*/ */
@Excel(name = "用户id", orderNum = "1", width = 20) @Excel(name = "用户id", orderNum = "1", width = 20)
private Integer userId; private Integer userId;
...@@ -37,23 +37,23 @@ public class CmsPriceClick extends CyIdIncreEntity<CmsPriceClick> { ...@@ -37,23 +37,23 @@ public class CmsPriceClick extends CyIdIncreEntity<CmsPriceClick> {
/** /**
* @desc 文章/视频id * @desc 文章/视频id
* @column news_video_id * @column news_video_id
* @default * @default
*/ */
@Excel(name = "文章/视频id", orderNum = "2", width = 20) @Excel(name = "文章/视频id", orderNum = "2", width = 20)
private Integer newsVideoId; private Integer newsVideoId;
/** /**
* @desc 来源(0:新闻 : 1 :视频) * @desc 来源(0:新闻 : 1 :视频)
* @column source * @column source
* @default * @default
*/ */
@Excel(name = "来源(0:新闻 : 1 :视频) ", orderNum = "3", width = 20) @Excel(name = "类型(0:新闻 : 1 :视频) ", orderNum = "3", width = 20)
private String source; private String type;
/** /**
* @desc 价格 * @desc 价格
* @column price * @column price
* @default * @default
*/ */
@Excel(name = "价格", orderNum = "4", width = 20) @Excel(name = "价格", orderNum = "4", width = 20)
private BigDecimal price; private BigDecimal price;
...@@ -61,7 +61,7 @@ public class CmsPriceClick extends CyIdIncreEntity<CmsPriceClick> { ...@@ -61,7 +61,7 @@ public class CmsPriceClick extends CyIdIncreEntity<CmsPriceClick> {
/** /**
* @desc 点击率 * @desc 点击率
* @column click_through_rate * @column click_through_rate
* @default * @default
*/ */
@Excel(name = "点击率", orderNum = "5", width = 20) @Excel(name = "点击率", orderNum = "5", width = 20)
private Integer clickThroughRate; private Integer clickThroughRate;
......
package org.rcisoft.business.cmsunitnewvideo.controller;
/*固定导入*/
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.rcisoft.core.anno.CyOpeLogAnno;
import org.rcisoft.core.operlog.enums.CyLogTypeEnum;
import org.rcisoft.core.util.CyEpExcelUtil;
import org.springframework.validation.BindingResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.rcisoft.core.result.CyResult;
import org.rcisoft.core.util.CyResultGenUtil;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.constant.CyMessCons;
import org.rcisoft.core.controller.CyPaginationController;
import org.rcisoft.core.util.CyUserUtil;
import org.rcisoft.core.model.CyGridModel;
import org.rcisoft.core.exception.CyServiceException;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import org.rcisoft.business.cmsunitnewvideo.entity.CmsUnitNewVideo;
import org.rcisoft.business.cmsunitnewvideo.service.CmsUnitNewVideoService;
import java.util.List;
/**
* Created by cy on 2024年6月6日 上午10:17:38.
*/
@RestController
@RequestMapping("/cmsunitnewvideo")
public class CmsUnitNewVideoController extends CyPaginationController<CmsUnitNewVideo> {
@Autowired
private CmsUnitNewVideoService cmsUnitNewVideoServiceImpl;
//@PreAuthorize("@cyPerm.hasPerm('sys:unitNewVideo:add')")
@CyOpeLogAnno(title = "system-文章视频分配中间表管理-新增文章视频分配中间表", businessType = CyLogTypeEnum.INSERT)
@ApiOperation(value="添加文章视频分配中间表", notes="添加文章视频分配中间表")
@PostMapping(value = "/addOrUpdate")
public CyResult addOrUpdate(@Valid CmsUnitNewVideo cmsUnitNewVideo, BindingResult bindingResult) {
CyPersistModel data = cmsUnitNewVideoServiceImpl.addOrUpdate(cmsUnitNewVideo);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
cmsUnitNewVideo);
}
}
package org.rcisoft.business.cmsunitnewvideo.dao;
import org.rcisoft.core.mapper.CyBaseMapper;
import org.rcisoft.business.cmsunitnewvideo.entity.CmsUnitNewVideo;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import org.rcisoft.core.model.CyPageInfo;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
/**
* Created with cy on 2024年6月6日 上午10:17:38.
*/
public interface CmsUnitNewVideoRepository extends CyBaseMapper<CmsUnitNewVideo> {
List<CmsUnitNewVideo> queryCmsUnitNewVideos(@Param("entity") CmsUnitNewVideo cmsUnitNewVideo);
/**
* 分页查询 cmsUnitNewVideo
*
*/
IPage<CmsUnitNewVideo> queryCmsUnitNewVideosPaged(CyPageInfo cyPageInfo,@Param("entity") CmsUnitNewVideo cmsUnitNewVideo);
}
package org.rcisoft.business.cmsunitnewvideo.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import org.rcisoft.core.entity.CyIdIncreNotDataEntity;
import org.rcisoft.core.entity.CyIdNotDataEntity;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* Created with cy on 2024年6月6日 上午10:17:38.
*/
@Data
@TableName("cms_unit_new_video")
public class CmsUnitNewVideo extends CyIdIncreNotDataEntity<CmsUnitNewVideo> {
/**
* @desc 文章/视频id
* @column news_video_id
* @default
*/
@Excel(name = "文章/视频id", orderNum = "0", width = 20)
private Integer newsVideoId;
/**
* @desc 商家id
* @column unit_id
* @default
*/
@Excel(name = "商家id", orderNum = "1", width = 20)
private String unitId;
/**
* @desc 类型(0:文章 1:视频)
* @column type
* @default
*/
@Excel(name = "类型(0:文章 1:视频)", orderNum = "2", width = 20)
private String type;
}
package org.rcisoft.business.cmsunitnewvideo.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.rcisoft.business.cmsunitnewvideo.entity.CmsUnitNewVideo;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.aop.CyPageUtilAsp;
import org.rcisoft.core.model.CyPageInfo;
import java.util.List;
/**
* Created by cy on 2024年6月6日 上午10:17:38.
*/
public interface CmsUnitNewVideoService {
/**
* 保存 文章视频分配中间表
* @param cmsUnitNewVideo
* @return
*/
CyPersistModel addOrUpdate(CmsUnitNewVideo cmsUnitNewVideo);
}
package org.rcisoft.business.cmsunitnewvideo.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.collections4.CollectionUtils;
import org.rcisoft.core.util.CyUserUtil;
import org.rcisoft.core.aop.CyPageUtilAsp;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.util.CyEpExcelUtil;
import org.rcisoft.business.cmsunitnewvideo.dao.CmsUnitNewVideoRepository;
import org.rcisoft.business.cmsunitnewvideo.entity.CmsUnitNewVideo;
import org.rcisoft.business.cmsunitnewvideo.service.CmsUnitNewVideoService;
import org.rcisoft.core.service.CyBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.rcisoft.core.model.CyPageInfo;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
/**
* Created by cy on 2024年6月6日 上午10:17:38.
*/
@Service
@Transactional(readOnly = true,propagation = Propagation.NOT_SUPPORTED)
@Slf4j
public class CmsUnitNewVideoServiceImpl extends ServiceImpl<CmsUnitNewVideoRepository,CmsUnitNewVideo> implements CmsUnitNewVideoService {
/**
* 保存 文章视频分配中间表
* @param cmsUnitNewVideo
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public CyPersistModel addOrUpdate(CmsUnitNewVideo cmsUnitNewVideo){
//查询数据 是否包含
LambdaQueryWrapper<CmsUnitNewVideo> qw = new LambdaQueryWrapper<>();
qw.eq(CmsUnitNewVideo::getNewsVideoId,cmsUnitNewVideo.getNewsVideoId())
.eq(CmsUnitNewVideo::getType,cmsUnitNewVideo.getType());
List<CmsUnitNewVideo> cmsUnitNewVideos = baseMapper.selectList(qw);
if (CollectionUtils.isNotEmpty(cmsUnitNewVideos)){
//根据id删除信息
baseMapper.deleteBatchIds(cmsUnitNewVideos.stream().map(CmsUnitNewVideo::getBusinessId).toList());
Integer line = addData(cmsUnitNewVideo);
return new CyPersistModel(line);
}else {
Integer line = addData(cmsUnitNewVideo);
return new CyPersistModel(line);
}
}
private Integer addData(CmsUnitNewVideo cmsUnitNewVideo){
int line = 0;
if (cmsUnitNewVideo.getUnitId()!= null && cmsUnitNewVideo.getUnitId().contains(",")){
String[] unitIds = cmsUnitNewVideo.getUnitId().split(",");
for (String unitId : unitIds) {
cmsUnitNewVideo.setUnitId(unitId);
line = baseMapper.insert(cmsUnitNewVideo);
}
}else{
line = baseMapper.insert(cmsUnitNewVideo);
}
return line;
}
}
...@@ -124,7 +124,7 @@ global: ...@@ -124,7 +124,7 @@ global:
path: path:
# base_upload_location: /working/resource/intelServer/ # base_upload_location: /working/resource/intelServer/
base_upload_location: /Users/lyl/Downloads/intel_resource/ base_upload_location: /Users/lyl/Downloads/intel_resource/
base_discovery: 'http://49.232.167.247:20020/intelServer/' base_discovery: 'http://********/intelServer/'
code_generate_location: code code_generate_location: code
video_location: video video_location: video
temp_location: temp temp_location: temp
......
...@@ -72,48 +72,62 @@ ...@@ -72,48 +72,62 @@
</select> </select>
<select id="queryCmsNewssPaged" resultMap="BaseResultMap"> <select id="queryCmsNewssPaged" resultMap="BaseResultMap">
SELECT DISTINCT
cn.*,
SUM(IFNULL(cpc.click_through_rate,0)) AS readNum
FROM
cms_news cn
LEFT JOIN cms_price_click cpc ON cn.business_id = cpc.news_video_id
AND cpc.type = 0
WHERE
1 = 1
AND cn.del_flag = 0
AND cn.flag = 1
<if test="entity.flag !=null and entity.flag != '' ">
and flag = #{entity.flag}
</if>
<if test="entity.beginTime !=null and entity.beginTime != '' ">
and release_date &gt;= #{entity.beginTime}
</if>
<if test="entity.endTime !=null and entity.endTime != '' ">
and release_date &lt;= #{entity.endTime}
</if>
<if test="entity.plate !=null and entity.plate != '' ">
and plate like concat('%',#{entity.plate},'%')
</if>
<if test="entity.title !=null and entity.title != '' ">
and title like concat('%',#{entity.title},'%')
</if>
<if test="entity.details !=null and entity.details != '' ">
and details like concat('%',#{entity.details},'%')
</if>
<if test="entity.weight !=null and entity.weight != '' ">
and weight = #{entity.weight}
</if>
<if test="entity.pictureId !=null and entity.pictureId != '' ">
and picture_id like concat('%',#{entity.pictureId},'%')
</if>
<if test="entity.isForntPage !=null and entity.isForntPage != '' ">
and is_fornt_page = #{entity.isForntPage}
</if>
<if test="entity.isRecommended !=null and entity.isRecommended != '' ">
and is_recommended = #{entity.isRecommended}
</if>
<if test="entity.isTop !=null and entity.isTop != '' ">
and is_top = #{entity.isTop}
</if>
<if test="entity.newsType !=null and entity.newsType != '' ">
and news_type like concat('%',#{entity.newsType},'%')
</if>
<if test="entity.tenant !=null and entity.tenant != '' ">
and tenant = #{entity.tenant}
</if>
ORDER BY business_id DESC
</select>
<select id="checkWeight" resultType="org.rcisoft.business.cmsnews.entity.CmsNews">
select * from cms_news select * from cms_news
where 1=1 where 1=1
and del_flag = '0' and del_flag = '0'
<if test="entity.flag !=null and entity.flag != '' "> and weight = #{weight}
and flag = #{entity.flag}
</if>
<if test="entity.beginTime !=null and entity.beginTime != '' ">
and release_date &gt;= #{entity.beginTime}
</if>
<if test="entity.endTime !=null and entity.endTime != '' ">
and release_date &lt;= #{entity.endTime}
</if>
<if test="entity.plate !=null and entity.plate != '' ">
and plate like concat('%',#{entity.plate},'%')
</if>
<if test="entity.title !=null and entity.title != '' ">
and title like concat('%',#{entity.title},'%')
</if>
<if test="entity.details !=null and entity.details != '' ">
and details like concat('%',#{entity.details},'%')
</if>
<if test="entity.weight !=null and entity.weight != '' ">
and weight = #{entity.weight}
</if>
<if test="entity.pictureId !=null and entity.pictureId != '' ">
and picture_id like concat('%',#{entity.pictureId},'%')
</if>
<if test="entity.isForntPage !=null and entity.isForntPage != '' ">
and is_fornt_page = #{entity.isForntPage}
</if>
<if test="entity.isRecommended !=null and entity.isRecommended != '' ">
and is_recommended = #{entity.isRecommended}
</if>
<if test="entity.isTop !=null and entity.isTop != '' ">
and is_top = #{entity.isTop}
</if>
<if test="entity.newsType !=null and entity.newsType != '' ">
and news_type like concat('%',#{entity.newsType},'%')
</if>
<if test="entity.tenant !=null and entity.tenant != '' ">
and tenant = #{entity.tenant}
</if>
ORDER BY business_id DESC
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<result column="unit_id" jdbcType="INTEGER" property="unitId"/> <result column="unit_id" jdbcType="INTEGER" property="unitId"/>
<result column="user_id" jdbcType="INTEGER" property="userId"/> <result column="user_id" jdbcType="INTEGER" property="userId"/>
<result column="news_video_id" jdbcType="INTEGER" property="newsVideoId"/> <result column="news_video_id" jdbcType="INTEGER" property="newsVideoId"/>
<result column="source" jdbcType="VARCHAR" property="source"/> <result column="type" jdbcType="VARCHAR" property="type"/>
<result column="price" jdbcType="DECIMAL" property="price"/> <result column="price" jdbcType="DECIMAL" property="price"/>
<result column="click_through_rate" jdbcType="INTEGER" property="clickThroughRate"/> <result column="click_through_rate" jdbcType="INTEGER" property="clickThroughRate"/>
<result column="create_by" jdbcType="VARCHAR" property="createBy"/> <result column="create_by" jdbcType="VARCHAR" property="createBy"/>
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
and news_video_id = #{entity.newsVideoId} and news_video_id = #{entity.newsVideoId}
</if> </if>
<if test="entity.source !=null and entity.source != '' "> <if test="entity.source !=null and entity.source != '' ">
and source like concat('%',#{entity.source},'%') and type like concat('%',#{entity.type},'%')
</if> </if>
<if test="entity.price !=null and entity.price != '' "> <if test="entity.price !=null and entity.price != '' ">
and price = #{entity.price} and price = #{entity.price}
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
and news_video_id = #{entity.newsVideoId} and news_video_id = #{entity.newsVideoId}
</if> </if>
<if test="entity.source !=null and entity.source != '' "> <if test="entity.source !=null and entity.source != '' ">
and source like concat('%',#{entity.source},'%') and type like concat('%',#{entity.type},'%')
</if> </if>
<if test="entity.price !=null and entity.price != '' "> <if test="entity.price !=null and entity.price != '' ">
and price = #{entity.price} and price = #{entity.price}
...@@ -75,4 +75,4 @@ ...@@ -75,4 +75,4 @@
</if> </if>
ORDER BY business_id DESC ORDER BY business_id DESC
</select> </select>
</mapper> </mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.rcisoft.business.cmsunitnewvideo.dao.CmsUnitNewVideoRepository">
<resultMap id="BaseResultMap" type="org.rcisoft.business.cmsunitnewvideo.entity.CmsUnitNewVideo">
<id column="business_id" jdbcType="INTEGER" property="businessId"/>
<result column="news_video_id" jdbcType="INTEGER" property="newsVideoId"/>
<result column="unit_id" jdbcType="INTEGER" property="unitId"/>
<result column="type" jdbcType="VARCHAR" property="type"/>
</resultMap>
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
<select id="queryCmsUnitNewVideos" resultMap="BaseResultMap">
select * from cms_unit_new_video
where 1=1
<if test="entity.newsVideoId !=null and entity.newsVideoId != '' ">
and news_video_id = #{entity.newsVideoId}
</if>
<if test="entity.unitId !=null and entity.unitId != '' ">
and unit_id = #{entity.unitId}
</if>
<if test="entity.type !=null and entity.type != '' ">
and type like concat('%',#{entity.type},'%')
</if>
ORDER BY business_id DESC
</select>
<select id="queryCmsUnitNewVideosPaged" resultMap="BaseResultMap">
select * from cms_unit_new_video
where 1=1
<if test="entity.newsVideoId !=null and entity.newsVideoId != '' ">
and news_video_id = #{entity.newsVideoId}
</if>
<if test="entity.unitId !=null and entity.unitId != '' ">
and unit_id = #{entity.unitId}
</if>
<if test="entity.type !=null and entity.type != '' ">
and type like concat('%',#{entity.type},'%')
</if>
ORDER BY business_id DESC
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment