package com.bonus.material.reply.service.impl;

import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.material.reply.entity.BmReply;
import com.bonus.material.reply.mapper.ReplyMapper;
import com.bonus.material.reply.service.ReplyService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author：liang.chao
 * @Date：2024/12/16 - 11:30
 */
@Service
public class ReplyServiceImpl implements ReplyService {

    @Resource
    private ReplyMapper replyMapper;

    @Override
    public List<BmReply> list(BmReply bmReply) {
        bmReply.setReplyCom(SecurityUtils.getLoginUser().getSysUser().getCompanyId().intValue());
        return replyMapper.list(bmReply);
    }

    @Override
    public Integer add(BmReply bmReply) {
        bmReply.setCreater(SecurityUtils.getLoginUser().getUserid().intValue());
        bmReply.setReplyCom(SecurityUtils.getLoginUser().getSysUser().getCompanyId().intValue());
        return replyMapper.add(bmReply);
    }

    @Override
    public Integer edit(BmReply bmReply) {
        bmReply.setUpdater(SecurityUtils.getLoginUser().getUserid().intValue());
        bmReply.setReplyCom(SecurityUtils.getLoginUser().getSysUser().getCompanyId().intValue());
        return replyMapper.edit(bmReply);
    }

    @Override
    public Integer del(BmReply bmReply) {
        return replyMapper.del(bmReply);
    }
}
