添加浏览记录文件
This commit is contained in:
parent
e9aeeeca17
commit
ef6aa587e8
|
@ -0,0 +1,14 @@
|
||||||
|
package net.mingsoft.cms.biz;
|
||||||
|
|
||||||
|
import net.mingsoft.base.biz.IBaseBiz;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文章浏览记录业务
|
||||||
|
* @author 铭飞开发团队
|
||||||
|
* 创建日期:2019-12-23 9:24:03<br/>
|
||||||
|
* 历史修订:<br/>
|
||||||
|
*/
|
||||||
|
public interface IHistoryLogBiz extends IBaseBiz {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
/**
|
||||||
|
The MIT License (MIT) * Copyright (c) 2019 铭飞科技
|
||||||
|
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
* this software and associated documentation files (the "Software"), to deal in
|
||||||
|
* the Software without restriction, including without limitation the rights to
|
||||||
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
* subject to the following conditions:
|
||||||
|
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.mingsoft.cms.biz.impl;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import net.mingsoft.base.biz.impl.BaseBizImpl;
|
||||||
|
import net.mingsoft.base.dao.IBaseDao;
|
||||||
|
import java.util.*;
|
||||||
|
import net.mingsoft.cms.entity.HistoryLogEntity;
|
||||||
|
import net.mingsoft.cms.biz.IHistoryLogBiz;
|
||||||
|
import net.mingsoft.cms.dao.IHistoryLogDao;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文章浏览记录管理持久化层
|
||||||
|
* @author 铭飞开发团队
|
||||||
|
* 创建日期:2019-12-23 9:24:03<br/>
|
||||||
|
* 历史修订:<br/>
|
||||||
|
*/
|
||||||
|
@Service("cmshistoryLogBizImpl")
|
||||||
|
public class HistoryLogBizImpl extends BaseBizImpl implements IHistoryLogBiz {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IHistoryLogDao historyLogDao;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected IBaseDao getDao() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return historyLogDao;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package net.mingsoft.cms.dao;
|
||||||
|
|
||||||
|
import net.mingsoft.base.dao.IBaseDao;
|
||||||
|
import java.util.*;
|
||||||
|
import net.mingsoft.cms.entity.HistoryLogEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文章浏览记录持久层
|
||||||
|
* @author 铭飞开发团队
|
||||||
|
* 创建日期:2019-12-23 9:24:03<br/>
|
||||||
|
* 历史修订:<br/>
|
||||||
|
*/
|
||||||
|
public interface IHistoryLogDao extends IBaseDao {
|
||||||
|
}
|
|
@ -0,0 +1,121 @@
|
||||||
|
<?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="net.mingsoft.cms.dao.IHistoryLogDao">
|
||||||
|
|
||||||
|
<resultMap id="resultMap" type="net.mingsoft.cms.entity.HistoryLogEntity">
|
||||||
|
<id column="id" property="id" /><!--编号 -->
|
||||||
|
<result column="content_id" property="contentId" /><!--文章编号 -->
|
||||||
|
<result column="hl_ip" property="hlIp" /><!--浏览ip -->
|
||||||
|
<result column="hl_people_id" property="hlPeopleId" /><!--用户id -->
|
||||||
|
<result column="hl_is_mobile" property="hlIsMobile" /><!--是否为移动端 -->
|
||||||
|
<result column="create_by" property="createBy" /><!--创建人 -->
|
||||||
|
<result column="create_date" property="createDate" /><!--创建时间 -->
|
||||||
|
<result column="update_by" property="updateBy" /><!--修改人 -->
|
||||||
|
<result column="update_date" property="updateDate" /><!--修改时间 -->
|
||||||
|
<result column="del" property="del" /><!--删除标记 -->
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<!--保存-->
|
||||||
|
<insert id="saveEntity" useGeneratedKeys="true" keyProperty="id"
|
||||||
|
parameterType="net.mingsoft.cms.entity.HistoryLogEntity" >
|
||||||
|
insert into cms_history_log
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="contentId != null and contentId != ''">content_id,</if>
|
||||||
|
<if test="hlIp != null and hlIp != ''">hl_ip,</if>
|
||||||
|
<if test="hlPeopleId != null and hlPeopleId != ''">hl_people_id,</if>
|
||||||
|
<if test="hlIsMobile != null">hl_is_mobile,</if>
|
||||||
|
<if test="createBy > 0">create_by,</if>
|
||||||
|
<if test="createDate != null">create_date,</if>
|
||||||
|
<if test="updateBy > 0">update_by,</if>
|
||||||
|
<if test="updateDate != null">update_date,</if>
|
||||||
|
<if test="del != null">del,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="contentId != null and contentId != ''">#{contentId},</if>
|
||||||
|
<if test="hlIp != null and hlIp != ''">#{hlIp},</if>
|
||||||
|
<if test="hlPeopleId != null and hlPeopleId != ''">#{hlPeopleId},</if>
|
||||||
|
<if test="hlIsMobile != null">#{hlIsMobile},</if>
|
||||||
|
<if test="createBy > 0">#{createBy},</if>
|
||||||
|
<if test="createDate != null">#{createDate},</if>
|
||||||
|
<if test="updateBy > 0">#{updateBy},</if>
|
||||||
|
<if test="updateDate != null">#{updateDate},</if>
|
||||||
|
<if test="del != null">#{del},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<!--更新-->
|
||||||
|
<update id="updateEntity" parameterType="net.mingsoft.cms.entity.HistoryLogEntity">
|
||||||
|
update cms_history_log
|
||||||
|
<set>
|
||||||
|
<if test="contentId != null and contentId != ''">content_id=#{contentId},</if>
|
||||||
|
<if test="hlIp != null and hlIp != ''">hl_ip=#{hlIp},</if>
|
||||||
|
<if test="hlPeopleId != null and hlPeopleId != ''">hl_people_id=#{hlPeopleId},</if>
|
||||||
|
<if test="hlIsMobile != null">hl_is_mobile=#{hlIsMobile},</if>
|
||||||
|
<if test="createBy > 0">create_by=#{createBy},</if>
|
||||||
|
<if test="createDate != null">create_date=#{createDate},</if>
|
||||||
|
<if test="updateBy > 0">update_by=#{updateBy},</if>
|
||||||
|
<if test="updateDate != null">update_date=#{updateDate},</if>
|
||||||
|
<if test="del != null">del=#{del},</if>
|
||||||
|
</set>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<!--根据id获取-->
|
||||||
|
<select id="getEntity" resultMap="resultMap" parameterType="int">
|
||||||
|
select * from cms_history_log where id=#{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!--根据实体获取-->
|
||||||
|
<select id="getByEntity" resultMap="resultMap" parameterType="net.mingsoft.cms.entity.HistoryLogEntity">
|
||||||
|
select * from cms_history_log
|
||||||
|
<where>
|
||||||
|
<if test="contentId != null and contentId != ''">and content_id=#{contentId}</if>
|
||||||
|
<if test="hlIp != null and hlIp != ''">and hl_ip=#{hlIp}</if>
|
||||||
|
<if test="hlPeopleId != null and hlPeopleId != ''">and hl_people_id=#{hlPeopleId}</if>
|
||||||
|
<if test="hlIsMobile != null"> and hl_is_mobile=#{hlIsMobile} </if>
|
||||||
|
<if test="createBy > 0"> and create_by=#{createBy} </if>
|
||||||
|
<if test="createDate != null"> and create_date=#{createDate} </if>
|
||||||
|
<if test="updateBy > 0"> and update_by=#{updateBy} </if>
|
||||||
|
<if test="updateDate != null"> and update_date=#{updateDate} </if>
|
||||||
|
<if test="del != null"> and del=#{del} </if>
|
||||||
|
</where>
|
||||||
|
limit 0,1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<!--删除-->
|
||||||
|
<delete id="deleteEntity" parameterType="int">
|
||||||
|
delete from cms_history_log where id=#{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<!--批量删除-->
|
||||||
|
<delete id="delete" >
|
||||||
|
delete from cms_history_log
|
||||||
|
<where>
|
||||||
|
id in <foreach collection="ids" item="item" index="index"
|
||||||
|
open="(" separator="," close=")">#{item}</foreach>
|
||||||
|
</where>
|
||||||
|
</delete>
|
||||||
|
<!--查询全部-->
|
||||||
|
<select id="queryAll" resultMap="resultMap">
|
||||||
|
select * from cms_history_log order by id desc
|
||||||
|
</select>
|
||||||
|
<!--条件查询-->
|
||||||
|
<select id="query" resultMap="resultMap">
|
||||||
|
select * from cms_history_log
|
||||||
|
<where>
|
||||||
|
<if test="contentId != null and contentId != ''"> and content_id=#{contentId}</if>
|
||||||
|
<if test="hlIp != null and hlIp != ''"> and hl_ip=#{hlIp}</if>
|
||||||
|
<if test="hlPeopleId != null and hlPeopleId != ''"> and hl_people_id=#{hlPeopleId}</if>
|
||||||
|
<if test="hlIsMobile != null"> and hl_is_mobile=#{hlIsMobile} </if>
|
||||||
|
<if test="createBy > 0"> and create_by=#{createBy} </if>
|
||||||
|
<if test="createDate != null"> and create_date=#{createDate} </if>
|
||||||
|
<if test="updateBy > 0"> and update_by=#{updateBy} </if>
|
||||||
|
<if test="updateDate != null"> and update_date=#{updateDate} </if>
|
||||||
|
<if test="del != null"> and del=#{del} </if>
|
||||||
|
<include refid="net.mingsoft.base.dao.IBaseDao.sqlWhere"></include>
|
||||||
|
</where>
|
||||||
|
order by id desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,88 @@
|
||||||
|
package net.mingsoft.cms.entity;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import net.mingsoft.base.entity.BaseEntity;
|
||||||
|
import java.util.Date;
|
||||||
|
/**
|
||||||
|
* 文章浏览记录实体
|
||||||
|
* @author 铭飞开发团队
|
||||||
|
* 创建日期:2019-12-23 9:24:03<br/>
|
||||||
|
* 历史修订:<br/>
|
||||||
|
*/
|
||||||
|
public class HistoryLogEntity extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1577064243576L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文章编号
|
||||||
|
*/
|
||||||
|
private String contentId;
|
||||||
|
/**
|
||||||
|
* 浏览ip
|
||||||
|
*/
|
||||||
|
private String hlIp;
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
private String hlPeopleId;
|
||||||
|
/**
|
||||||
|
* 是否为移动端
|
||||||
|
*/
|
||||||
|
private Boolean hlIsMobile;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置文章编号
|
||||||
|
*/
|
||||||
|
public void setContentId(String contentId) {
|
||||||
|
this.contentId = contentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取文章编号
|
||||||
|
*/
|
||||||
|
public String getContentId() {
|
||||||
|
return this.contentId;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 设置浏览ip
|
||||||
|
*/
|
||||||
|
public void setHlIp(String hlIp) {
|
||||||
|
this.hlIp = hlIp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取浏览ip
|
||||||
|
*/
|
||||||
|
public String getHlIp() {
|
||||||
|
return this.hlIp;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 设置用户id
|
||||||
|
*/
|
||||||
|
public void setHlPeopleId(String hlPeopleId) {
|
||||||
|
this.hlPeopleId = hlPeopleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户id
|
||||||
|
*/
|
||||||
|
public String getHlPeopleId() {
|
||||||
|
return this.hlPeopleId;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 设置是否为移动端
|
||||||
|
*/
|
||||||
|
public void setHlIsMobile(Boolean hlIsMobile) {
|
||||||
|
this.hlIsMobile = hlIsMobile;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取是否为移动端
|
||||||
|
*/
|
||||||
|
public Boolean getHlIsMobile() {
|
||||||
|
return this.hlIsMobile;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
#
|
||||||
|
#Mon Dec 23 09:24:03 CST 2019
|
||||||
|
content.id=\u6587\u7AE0\u7F16\u53F7
|
||||||
|
hl.ip=\u6D4F\u89C8ip
|
||||||
|
hl.people.id=\u7528\u6237id
|
||||||
|
hl.is.mobile=\u662F\u5426\u4E3A\u79FB\u52A8\u7AEF
|
||||||
|
id=\u7F16\u53F7
|
Loading…
Reference in New Issue