package com.ruoyi.system.mapper.house;

import com.ruoyi.system.domain.changerecord.annotation.DataChangeLog;
import com.ruoyi.system.domain.changerecord.enums.OperationType;
import com.ruoyi.system.domain.changerecord.enums.SubjectType;
import com.ruoyi.system.domain.fieldchangerecord.annotation.DataFieldChangeLog;
import com.ruoyi.system.domain.fieldchangerecord.enums.FieldCode;
import com.ruoyi.system.domain.house.BusinessEntityInfo;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

public interface BusinessEntityInfoMapper {

    // 插入业务实体信息
    @DataChangeLog(subjectType = SubjectType.BUSINESS_ENTITY_INFO, operation = OperationType.INSERT, idExpr = "id")
    @DataFieldChangeLog(
            subjectType = SubjectType.BUSINESS_ENTITY_INFO,
            operation = OperationType.INSERT,
            idExpr = "id",
            fields = {
                    FieldCode.BE_NAME,
                    FieldCode.BE_PRINCIPAL_TEL,
                    FieldCode.BE_WORKER_NUMBER
            }
    )
    void insertBusinessEntityInfo(BusinessEntityInfo businessEntityInfo);

    // 根据ID查询业务实体信息
    BusinessEntityInfo selectBusinessEntityInfoById(@Param("id") String id);

    // 更新业务实体信息
    @DataChangeLog(subjectType = SubjectType.BUSINESS_ENTITY_INFO, operation = OperationType.UPDATE, idExpr = "id")
    @DataFieldChangeLog(
            subjectType = SubjectType.BUSINESS_ENTITY_INFO,
            operation = OperationType.UPDATE,
            idExpr = "id",
            preLoadMapper = "com.ruoyi.system.mapper.house.BusinessEntityInfoMapper.selectBusinessEntityInfoById",
            fields = {
                    FieldCode.BE_NAME,
                    FieldCode.BE_PRINCIPAL_TEL,
                    FieldCode.BE_WORKER_NUMBER
            }
    )
    void updateBusinessEntityInfo(BusinessEntityInfo businessEntityInfo);

    // 删除业务实体信息
    @DataChangeLog(subjectType = SubjectType.BUSINESS_ENTITY_INFO, operation = OperationType.DELETE, idExpr = "id")
    void deleteBusinessEntityInfoById(@Param("id") String id);

    // 查询所有业务实体信息
    List<BusinessEntityInfo> selectAllBusinessEntityInfos();

    List<BusinessEntityInfo> selectByName(@Param("name") String name);

    List<BusinessEntityInfo> selectByIdList(@Param("idList") List<String> idList);
}
