Commit e2008d2c authored by libin's avatar libin

用户行为记录

parent 896fdd35
package com.xxfc.platform.user.behavior.dto;
import lombok.Data;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/8/13 17:05
*/
@Data
public class ActivityBehaviorRelationDTO {
/**
* @see com.xxfc.platform.user.behavior.common.BehaviorEnum
* 行为类型
*/
private Integer type;
/**
* 业务id (banner 精彩活动 app弹窗)
*/
private Integer bizId;
/**
* 活动id
*/
private Integer activityId;
}
package com.xxfc.platform.user.behavior.entity;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/8/13 17:05
*/
@Data
@Table(name = "activity_behavior_relation")
public class ActivityBehaviorRelation {
@Id
@GeneratedValue(generator = "JDBC")
private Integer id;
/**
* @see com.xxfc.platform.user.behavior.common.BehaviorEnum
* 行为类型
*/
private Integer type;
/**
* 业务id (banner 精彩活动 app弹窗)
*/
@Column(name = "biz_id")
private Integer bizId;
/**
* 活动id
*/
@Column(name = "activity_id")
private Integer activityId;
}
package com.xxfc.platform.user.behavior.biz;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.xxfc.platform.user.behavior.dto.ActivityBehaviorRelationDTO;
import com.xxfc.platform.user.behavior.entity.ActivityBehaviorRelation;
import com.xxfc.platform.user.behavior.mapper.ActivityBehaviorRelationMapper;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/8/13 17:12
*/
@Service
public class ActivityBehaviorRelationBiz extends BaseBiz<ActivityBehaviorRelationMapper, ActivityBehaviorRelation> {
public List<ActivityBehaviorRelationDTO> findActivityBehaviorRelationsByActivityId(Integer activityId){
return mapper.selectAllByActivityId(activityId);
}
}
package com.xxfc.platform.user.behavior.mapper;
import com.xxfc.platform.user.behavior.dto.ActivityBehaviorRelationDTO;
import com.xxfc.platform.user.behavior.entity.ActivityBehaviorRelation;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/8/13 17:11
*/
public interface ActivityBehaviorRelationMapper extends Mapper<ActivityBehaviorRelation> {
@Select("select * from `activity_behavior_relation` where `activity_id`=#{activityId}")
@Results(value = {
@Result(property = "type",column = "type"),
@Result(property = "bizId",column = "biz_id"),
@Result(property = "activityId",column = "activity_id")
})
List<ActivityBehaviorRelationDTO> selectAllByActivityId(@Param("activityId") Integer activityId);
}
......@@ -18,4 +18,6 @@ public interface CustomerBehaviorNotesMapper extends Mapper<CustomerBehaviorNote
List<CustomerBehaviorNotes> selectByActivityIdAndTime(@Param("activityId") Integer activityId,@Param("startTime") Long startTime,@Param("endTime") Long endTime);
long selectAppVvisitsByType(@Param("code") int code);
List<CustomerBehaviorNotes> selectAllByTypeIdsAndTime(@Param("bizIds") List<Integer> bizIds,@Param("startTime") Long startTime,@Param("endTime") Long endTime);
}
......@@ -30,4 +30,21 @@
<select id="selectAppVvisitsByType" resultType="long">
select count(id) from `customer_behavior_notes` where `type`=#{code}
</select>
<select id="selectAllByTypeIdsAndTime" resultMap="customerBehaviorNotesMap">
select * from `customer_behavior_notes` where `type_id` in
<foreach collection="bizIds" item="bizId" open="(" close=")" separator=",">
#{bizId}
</foreach>
<if test="startTime != null != null and endTime !=null">
and `crt_time` between #{startTime} and #{endTime}
</if>
<if test="startTime != null and endTime == null">
and <![CDATA[`crt_time` >= #{startTime}]]>
</if>
<if test="endTime != null and startTime == null">
and <![CDATA[ `crt_time` <= #{endTime}]]>
</if>
</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