package com.saye.hospitalgd.service.system.impl;

import com.saye.hospitalgd.mapper.system.FinanceUserMapper;
import com.saye.hospitalgd.model.FinanceUser;
import com.saye.hospitalgd.service.system.FinanceUserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;

/**
 * @author thuang
 * @version 1.0
 * @description: 财务人员服务实现类
 * @date 2024/12/19 18:00
 */
@Service
@Transactional
public class FinanceUserServiceImpl implements FinanceUserService {

    private static final Logger log = LoggerFactory.getLogger(FinanceUserServiceImpl.class);

    @Autowired
    private FinanceUserMapper financeUserMapper;

    @Override
    public List<FinanceUser> findFinanceUserPageList(HashMap<Object, Object> map) throws Exception {
        try {
            return financeUserMapper.findFinanceUserPageList(map);
        } catch (Exception e) {
            log.error("查询财务人员列表失败", e);
            throw e;
        }
    }

    @Override
    public void addFinanceUser(FinanceUser financeUser) throws Exception {
        try {
            financeUserMapper.addFinanceUser(financeUser);
        } catch (Exception e) {
            log.error("添加财务人员失败", e);
            throw e;
        }
    }

    @Override
    public void updateFinanceUser(FinanceUser financeUser) throws Exception {
        try {
            financeUserMapper.updateFinanceUser(financeUser);
        } catch (Exception e) {
            log.error("修改财务人员失败", e);
            throw e;
        }
    }

    @Override
    public void deleteFinanceUser(String id) throws Exception {
        try {
            financeUserMapper.deleteFinanceUser(id);
        } catch (Exception e) {
            log.error("删除财务人员失败", e);
            throw e;
        }
    }

    @Override
    public FinanceUser findFinanceUserById(String id) throws Exception {
        try {
            return financeUserMapper.findFinanceUserById(id);
        } catch (Exception e) {
            log.error("根据ID查询财务人员失败", e);
            throw e;
        }
    }

    @Override
    public List<FinanceUser> findActiveFinanceUsers() throws Exception {
        try {
            return financeUserMapper.findActiveFinanceUsers();
        } catch (Exception e) {
            log.error("查询启用的财务人员失败", e);
            throw e;
        }
    }
}





















