ReportLogService.java 948 Bytes
Newer Older
1 2
package com.tanpu.community.service;

张辰's avatar
张辰 committed
3
import com.tanpu.biz.common.enums.community.ReportTypeEnum;
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
import com.tanpu.community.dao.entity.community.ReportLogEntity;
import com.tanpu.community.dao.mapper.community.ReportLogMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.LocalDateTime;

@Service
@Slf4j
public class ReportLogService {

    @Resource
    private ReportLogMapper reportLogMapper;

张辰's avatar
张辰 committed
19
    public void insert(ReportTypeEnum type, String userId, String themeId, String authorId, String reason){
20 21 22 23 24 25 26 27 28 29
        ReportLogEntity entity = ReportLogEntity.builder().userId(userId)
                .reportType(type.getCode())
                .targetId(themeId)
                .targetUserId(authorId)
                .reportReason(reason)
                .reportTime(LocalDateTime.now())
                .build();
        reportLogMapper.insert(entity);
    }
}