Commit 41cba0d0 authored by 张辰's avatar 张辰

修复visitlog查到多条的bug

parent a08ee369
......@@ -21,8 +21,8 @@ import java.util.List;
* @since 2021-07-28
*/
public interface VisitLogMapper extends BaseMapper<VisitLogEntity> {
@Select("select * from visit_log where ident=#{ident} and ref_id=#{refId}")
VisitLogEntity selectByIdentAndRefId(@Param("ident") String ident, @Param("refId") String refId);
@Select("select * from visit_log where ident=#{ident} and ref_id=#{refId} and ref_type=#{refType}")
VisitLogEntity selectByIdentAndRefId(@Param("ident") String ident, @Param("refId") String refId, @Param("refType") String refType);
@Update("update visit_log set duration=duration+#{duration} where ident=#{ident}")
void updateDurByIdent(@Param("duration") Integer dur, @Param("ident") String ident);
......
......@@ -58,7 +58,7 @@ public class VisitLogService {
@Transactional
public void insertOrUpdateDur(VisitLogEntity vs) {
if (visitLogMapper.selectByIdentAndRefId(vs.getIdent(), vs.getRefId()) == null) {
if (visitLogMapper.selectByIdentAndRefId(vs.getIdent(), vs.getRefType(), vs.getRefId()) == null) {
visitLogMapper.insert(vs);
} else {
visitLogMapper.updateDurByIdent(vs.getDuration(), vs.getIdent());
......
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