更新代码

This commit is contained in:
xiao-fajia 2024-08-01 21:33:13 +08:00
parent 1b3860a5c7
commit 570c5f785c
7 changed files with 23 additions and 5 deletions

View File

@ -111,4 +111,7 @@ public class CmsContent extends BaseEntity
/** 逻辑删除0未删除1真删除 */
private Integer delFlag;
/** 访问计数 */
private Integer count;
}

View File

@ -61,4 +61,7 @@ public interface CmsContentMapper extends BaseMapper<CmsContent>
* @return 结果
*/
public int deleteCmsContentByIds(Long[] ids);
/** 修改计数 */
public int updateCount(Long id);
}

View File

@ -1,6 +1,5 @@
package com.ruoyi.cms.service.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -8,7 +7,6 @@ import cn.hutool.core.lang.Snowflake;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.cms.mapper.CmsContentMapper;
@ -36,6 +34,7 @@ public class CmsContentServiceImpl extends ServiceImpl<CmsContentMapper, CmsCont
@Override
public CmsContent selectCmsContentById(Long id)
{
baseMapper.updateCount(id);
return baseMapper.selectCmsContentById(id);
}

View File

@ -35,6 +35,7 @@
typeHandler="com.ruoyi.system.handler.MysqlTypeHandler"/>
<result property="linkType" column="link_type" />
<result property="link" column="link" />
<result property="count" column="count" />
</resultMap>
<sql id="selectCmsContentVo">
@ -64,7 +65,8 @@
update_time,
update_by,
link_type,
link
link,
count
from cms_content
</sql>
@ -200,6 +202,10 @@
where id = #{id}
</update>
<update id="updateCount" parameterType="Long">
update cms_content set count = count + 1 where id = #{id}
</update>
<delete id="deleteCmsContentById" parameterType="Long">
delete
from cms_content

View File

@ -35,6 +35,7 @@
typeHandler="com.ruoyi.system.handler.MysqlTypeHandler"/>
<result property="linkType" column="link_type" />
<result property="link" column="link" />
<result property="count" column="count" />
</resultMap>
<sql id="selectCmsContentVo">
@ -64,7 +65,8 @@
update_time,
update_by,
link_type,
link
link,
count
from cms_content
</sql>
@ -200,6 +202,10 @@
where id = #{id}
</update>
<update id="updateCount" parameterType="Long">
update cms_content set count = count + 1 where id = #{id}
</update>
<delete id="deleteCmsContentById" parameterType="Long">
delete
from cms_content

View File

@ -313,6 +313,7 @@ export default {
}
})
}
this.$router.replace('/content/content')
this.$modal.closeLoading();
}
})

View File

@ -153,7 +153,7 @@
<div class="tags">
<div class="p">{{ indexList[2].categoryName }}</div>
<div class="icon"><i class="el-icon-user"></i>
3750
{{ item.count }}
</div>
</div>
<div class="backmo">