package com.upsfj.sfjprojectbackend.service.impl;

import com.upsfj.sfjprojectbackend.entity.Field;
import com.upsfj.sfjprojectbackend.mapper.FieldMapper;
import com.upsfj.sfjprojectbackend.service.FieldService;
import jakarta.annotation.Resource;
import jakarta.transaction.Transactional;
import org.springframework.stereotype.Service;

@Service
public class FieldServiceImpl implements FieldService {
    @Resource
    FieldMapper fieldMapper;



    @Override
    public void addField(String fieldName) {
        fieldMapper.AddField(fieldName);

    }

    @Override
    public void updateField(Field field) {
        fieldMapper.UpdateField(field);
    }

    @Override
    @Transactional
    public void deleteField(Field field) {
        fieldMapper.DeleteAlgorithmForField(field);
        fieldMapper.DeleteField(field);
    }
}
