package com.jeesharp.business.modules.mall.service.impl;

import com.jeesharp.business.modules.mall.entity.MallSpec;
import com.jeesharp.business.modules.mall.mapper.MallSpecMapper;
import com.jeesharp.business.modules.mall.service.MallSpecService;
import com.jeesharp.business.modules.common.constants.PlatformTenantConstants;
import com.jeesharp.business.modules.mall.vo.MallSpecQueryVO;
import com.jeesharp.framework.mybatis.core.service.CrudService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 规格名领域服务实现。
 *
 * @author jeesharp
 * @since 2026-05-07
 */
@Service
@Transactional(readOnly = true)
public class MallSpecServiceImpl extends CrudService<MallSpecMapper, MallSpec, MallSpecQueryVO> implements MallSpecService {

    private static final String IDS_SEPARATOR = ",";

    @Override
    @Transactional(readOnly = false)
    public void createSpec(MallSpec entity) {
        save(entity);
    }

    @Override
    @Transactional(readOnly = false)
    public void updateSpec(MallSpec entity) {
        update(entity);
    }

    @Override
    public List<MallSpec> listPlatformEnabledForPublish() {
        return getBaseMapper().selectEnabledByTenantCode(PlatformTenantConstants.PLATFORM_TENANT_CODE);
    }

}
