package com.yingpaipay.setting.service.impl;

import com.yingpaipay.setting.domain.TextinSetting;
import com.yingpaipay.setting.domain.bo.TextinSettingBo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.common.core.constant.CacheNames;
import org.dromara.common.core.utils.MapstructUtils;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import com.yingpaipay.setting.domain.vo.TextinSettingVo;
import com.yingpaipay.setting.mapper.TextinSettingMapper;
import com.yingpaipay.setting.service.ITextinSettingService;


/**
 * TextInService业务层处理
 *
 * @author Huanyi
 * @date 2026-01-07
 */
@Slf4j
@RequiredArgsConstructor
@Service
public class TextinSettingServiceImpl implements ITextinSettingService {

    private final TextinSettingMapper baseMapper;

    @Cacheable(cacheNames = CacheNames.SETTING, key = "'textin'")
    @Override
    public TextinSettingVo query() {
        return baseMapper.selectVoById(1L);
    }

    @CachePut(cacheNames = CacheNames.SETTING, key = "'textin'")
    @Override
    public boolean update(TextinSettingBo bo) {
        TextinSetting entity = MapstructUtils.convert(bo, TextinSetting.class);
        return baseMapper.updateById(entity) > 0;
    }
}
