package com.bonus.canteen.core.health.service.impl;

import java.util.List;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bonus.canteen.core.health.mapper.HealthPersonBodyRecordMapper;
import com.bonus.canteen.core.health.domain.HealthPersonBodyRecord;
import com.bonus.canteen.core.health.service.IHealthPersonBodyRecordService;

/**
 * 体征数据记录Service业务层处理
 *
 * @author xsheng
 * @date 2025-05-25
 */
@Service
public class HealthPersonBodyRecordServiceImpl implements IHealthPersonBodyRecordService {
    @Autowired
    private HealthPersonBodyRecordMapper healthPersonBodyRecordMapper;

    /**
     * 查询体征数据记录
     *
     * @param id 体征数据记录主键
     * @return 体征数据记录
     */
    @Override
    public HealthPersonBodyRecord selectHealthPersonBodyRecordById(Long id) {
        return healthPersonBodyRecordMapper.selectHealthPersonBodyRecordById(id);
    }

    /**
     * 查询体征数据记录列表
     *
     * @param healthPersonBodyRecord 体征数据记录
     * @return 体征数据记录
     */
    @Override
    public List<HealthPersonBodyRecord> selectHealthPersonBodyRecordList(HealthPersonBodyRecord healthPersonBodyRecord) {
        return healthPersonBodyRecordMapper.selectHealthPersonBodyRecordList(healthPersonBodyRecord);
    }

    /**
     * 新增体征数据记录
     *
     * @param healthPersonBodyRecord 体征数据记录
     * @return 结果
     */
    @Override
    public int insertHealthPersonBodyRecord(HealthPersonBodyRecord healthPersonBodyRecord) {
        healthPersonBodyRecord.setCreateTime(DateUtils.getNowDate());
        try {
            return healthPersonBodyRecordMapper.insertHealthPersonBodyRecord(healthPersonBodyRecord);
        } catch (Exception e) {
            throw new ServiceException(e.getMessage());
        }
    }

    /**
     * 修改体征数据记录
     *
     * @param healthPersonBodyRecord 体征数据记录
     * @return 结果
     */
    @Override
    public int updateHealthPersonBodyRecord(HealthPersonBodyRecord healthPersonBodyRecord) {
        healthPersonBodyRecord.setUpdateTime(DateUtils.getNowDate());
        try {
            return healthPersonBodyRecordMapper.updateHealthPersonBodyRecord(healthPersonBodyRecord);
        } catch (Exception e) {
            throw new ServiceException(e.getMessage());
        }
    }

    /**
     * 批量删除体征数据记录
     *
     * @param ids 需要删除的体征数据记录主键
     * @return 结果
     */
    @Override
    public int deleteHealthPersonBodyRecordByIds(Long[] ids) {
        return healthPersonBodyRecordMapper.deleteHealthPersonBodyRecordByIds(ids);
    }

    /**
     * 删除体征数据记录信息
     *
     * @param id 体征数据记录主键
     * @return 结果
     */
    @Override
    public int deleteHealthPersonBodyRecordById(Long id) {
        return healthPersonBodyRecordMapper.deleteHealthPersonBodyRecordById(id);
    }
}
