Commit e7285e0d authored by 罗林杰's avatar 罗林杰

增加字段阅读量

parent cca5d5e5
...@@ -203,4 +203,19 @@ public class CmsNewsController extends CyPaginationController<CmsNews> { ...@@ -203,4 +203,19 @@ public class CmsNewsController extends CyPaginationController<CmsNews> {
CyMessCons.MESSAGE_ALERT_ERROR, CyMessCons.MESSAGE_ALERT_ERROR,
cmsNewsServiceImpl.listByClassification(getPaginationUtility(), cmsNews)); cmsNewsServiceImpl.listByClassification(getPaginationUtility(), cmsNews));
} }
/**
* 增加阅读量
*/
@ApiOperation(value = "增加阅读量", notes = "增加阅读量")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar")})
@PutMapping("/miniProgram/read/{businessId:\\w+}")
public CyResult read(@PathVariable int businessId, @Valid CmsNews cmsNews, BindingResult bindingResult) {
cmsNews.setBusinessId(businessId);
CyPersistModel data = cmsNewsServiceImpl.read(cmsNews);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
cmsNews);
}
} }
...@@ -53,5 +53,7 @@ public interface CmsNewsRepository extends CyBaseMapper<CmsNews> { ...@@ -53,5 +53,7 @@ public interface CmsNewsRepository extends CyBaseMapper<CmsNews> {
IPage<CmsNews> listByClassificationAdmin(CyPageInfo<CmsNews> paginationUtility, @Param("entity") CmsNews cmsNews); IPage<CmsNews> listByClassificationAdmin(CyPageInfo<CmsNews> paginationUtility, @Param("entity") CmsNews cmsNews);
IPage<CmsNews> listByClassificationMerchants(CyPageInfo<CmsNews> paginationUtility, @Param("entity") CmsNews cmsNews); IPage<CmsNews> listByClassificationMerchants(CyPageInfo<CmsNews> paginationUtility, @Param("entity") CmsNews cmsNews);
int readById(@Param("entity") CmsNews cmsNews);
} }
...@@ -117,6 +117,13 @@ public class CmsNews extends CyIdIncreEntity<CmsNews> { ...@@ -117,6 +117,13 @@ public class CmsNews extends CyIdIncreEntity<CmsNews> {
@Excel(name = "房客id", orderNum = "10", width = 20) @Excel(name = "房客id", orderNum = "10", width = 20)
private Integer tenant; private Integer tenant;
/**
* @desc 阅读数
* @column read_count
* @default
*/
private Integer readCount;
/** /**
* 开始时间 * 开始时间
*/ */
......
...@@ -99,4 +99,6 @@ public interface CmsNewsService { ...@@ -99,4 +99,6 @@ public interface CmsNewsService {
String getNewsByTitleByTitle(String title); String getNewsByTitleByTitle(String title);
IPage<CmsVideo> listByTopVideo(CyPageInfo<CmsNews> paginationUtility, CmsVideo cmsVideo); IPage<CmsVideo> listByTopVideo(CyPageInfo<CmsNews> paginationUtility, CmsVideo cmsVideo);
CyPersistModel read(CmsNews cmsNews);
} }
...@@ -525,5 +525,12 @@ public class CmsNewsServiceImpl extends ServiceImpl<CmsNewsRepository, CmsNews> ...@@ -525,5 +525,12 @@ public class CmsNewsServiceImpl extends ServiceImpl<CmsNewsRepository, CmsNews>
return cmsVideoIPage; return cmsVideoIPage;
} }
@Override
public CyPersistModel read(CmsNews cmsNews) {
int line = baseMapper.readById(cmsNews);
return new CyPersistModel(line);
}
} }
...@@ -6,6 +6,7 @@ package org.rcisoft.business.cmsvideo.controller; ...@@ -6,6 +6,7 @@ package org.rcisoft.business.cmsvideo.controller;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.rcisoft.business.cmsnews.entity.CmsNews;
import org.rcisoft.business.cmsvideo.entity.CmsVideo; import org.rcisoft.business.cmsvideo.entity.CmsVideo;
import org.rcisoft.business.cmsvideo.service.CmsVideoService; import org.rcisoft.business.cmsvideo.service.CmsVideoService;
import org.rcisoft.core.anno.CyOpeLogAnno; import org.rcisoft.core.anno.CyOpeLogAnno;
...@@ -168,4 +169,20 @@ public class CmsVideoController extends CyPaginationController<CmsVideo> { ...@@ -168,4 +169,20 @@ public class CmsVideoController extends CyPaginationController<CmsVideo> {
CyMessCons.MESSAGE_ALERT_ERROR, CyMessCons.MESSAGE_ALERT_ERROR,
cmsVideoServiceImpl.listByClassification(getPaginationUtility(), cmsVideo)); cmsVideoServiceImpl.listByClassification(getPaginationUtility(), cmsVideo));
} }
/**
* 增加阅读量
*/
@ApiOperation(value = "增加阅读量", notes = "增加阅读量")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar")})
@PutMapping("/miniProgram/read/{businessId:\\w+}")
public CyResult read(@PathVariable int businessId, @Valid CmsVideo cmsVideo, BindingResult bindingResult) {
cmsVideo.setBusinessId(businessId);
CyPersistModel data = cmsVideoServiceImpl.read(cmsVideo);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
cmsVideo);
}
} }
...@@ -33,5 +33,7 @@ public interface CmsVideoRepository extends CyBaseMapper<CmsVideo> { ...@@ -33,5 +33,7 @@ public interface CmsVideoRepository extends CyBaseMapper<CmsVideo> {
IPage<CmsVideo> listByClassificationAdmin(CyPageInfo<CmsVideo> paginationUtility, @Param("entity") CmsVideo cmsVideo); IPage<CmsVideo> listByClassificationAdmin(CyPageInfo<CmsVideo> paginationUtility, @Param("entity") CmsVideo cmsVideo);
IPage<CmsVideo> listByClassificationMerchants(CyPageInfo<CmsVideo> paginationUtility, @Param("entity") CmsVideo cmsVideo); IPage<CmsVideo> listByClassificationMerchants(CyPageInfo<CmsVideo> paginationUtility, @Param("entity") CmsVideo cmsVideo);
int readById(@Param("entity") CmsVideo cmsVideo);
} }
...@@ -86,6 +86,13 @@ public class CmsVideo extends CyIdIncreEntity<CmsVideo> { ...@@ -86,6 +86,13 @@ public class CmsVideo extends CyIdIncreEntity<CmsVideo> {
@Excel(name = "房客id", orderNum = "6", width = 20) @Excel(name = "房客id", orderNum = "6", width = 20)
private Integer tenant; private Integer tenant;
/**
* @desc 阅读数
* @column read_count
* @default
*/
private Integer readCount;
/** /**
* 开始时间 * 开始时间
*/ */
......
...@@ -82,4 +82,6 @@ public interface CmsVideoService { ...@@ -82,4 +82,6 @@ public interface CmsVideoService {
CmsVideo getVideoUrl(CmsVideo cmsVideo); CmsVideo getVideoUrl(CmsVideo cmsVideo);
IPage<CmsVideo> listByClassification(CyPageInfo<CmsVideo> paginationUtility, CmsVideo cmsVideo); IPage<CmsVideo> listByClassification(CyPageInfo<CmsVideo> paginationUtility, CmsVideo cmsVideo);
CyPersistModel read(CmsVideo cmsVideo);
} }
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.rcisoft.business.cmsnews.entity.CmsNews;
import org.rcisoft.business.cmspriceclick.dao.CmsPriceClickRepository; import org.rcisoft.business.cmspriceclick.dao.CmsPriceClickRepository;
import org.rcisoft.business.cmsunitnewvideo.dao.CmsUnitNewVideoRepository; import org.rcisoft.business.cmsunitnewvideo.dao.CmsUnitNewVideoRepository;
import org.rcisoft.business.cmsunitnewvideo.entity.CmsUnitNewVideo; import org.rcisoft.business.cmsunitnewvideo.entity.CmsUnitNewVideo;
...@@ -310,4 +311,11 @@ public class CmsVideoServiceImpl extends ServiceImpl<CmsVideoRepository, CmsVide ...@@ -310,4 +311,11 @@ public class CmsVideoServiceImpl extends ServiceImpl<CmsVideoRepository, CmsVide
return page; return page;
} }
@Override
public CyPersistModel read(CmsVideo cmsVideo) {
int line = baseMapper.readById(cmsVideo);
return new CyPersistModel(line);
}
} }
...@@ -480,4 +480,9 @@ ...@@ -480,4 +480,9 @@
DESC, cn.update_date DESC) cn DESC, cn.update_date DESC) cn
GROUP BY cn.business_id GROUP BY cn.business_id
</select> </select>
<update id="readById" parameterType="org.rcisoft.business.cmsnews.entity.CmsNews">
UPDATE cms_news
SET read_count = read_count + 1
WHERE business_id = #{entity.businessId}
</update>
</mapper> </mapper>
...@@ -239,4 +239,9 @@ ...@@ -239,4 +239,9 @@
order by cv.flag DESC, cv.update_date DESC) cv order by cv.flag DESC, cv.update_date DESC) cv
GROUP BY cv.business_id GROUP BY cv.business_id
</select> </select>
<update id="readById" parameterType="org.rcisoft.business.cmsvideo.entity.CmsVideo">
UPDATE cms_video
SET read_count = read_count + 1
WHERE business_id = #{entity.businessId}
</update>
</mapper> </mapper>
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