package com.ruoyi.gen.service.impl;

import com.mybatisflex.solon.service.impl.ServiceImpl;
import com.ruoyi.common.enums.DictEnum;
import com.ruoyi.gen.domain.GenTableColumn;
import com.ruoyi.gen.mapper.GenTableColumnMapper;
import com.ruoyi.gen.service.IGenTableColumnService;
import org.noear.solon.annotation.Component;
import org.noear.solon.annotation.Inject;

import java.util.List;

/**
 * 业务表字段 服务层实现
 * @author ruoyi
 */
@Component
public class GenTableColumnServiceImpl extends ServiceImpl<GenTableColumnMapper, GenTableColumn> implements IGenTableColumnService {

    @Inject
    GenTableColumnMapper genTableColumnMapper;

    /**
     * 查询业务字段列表
     * @param tableId
     * @return
     */
    @Override
    public List<GenTableColumn> selectTableColumnListByTableId(Long tableId) {
        return genTableColumnMapper.selectTableColumnListByTableId(tableId, DictEnum.DEL_FLAG.OK.getValue());
    }

    /**
     * 根据表名查询表字段
     * @param tableName
     * @return
     */
    @Override
    public List<GenTableColumn> selectTableColumnsByName(String tableName) {
        return genTableColumnMapper.selectTableColumnsByName(tableName);
    }

    /**
     * 批量删除业务字段
     * @param tableIds
     * @return
     */
    @Override
    public int deleteGenTableColumnByIds(Long[] tableIds) {
        return genTableColumnMapper.deleteGenTableColumnByIds(tableIds);
    }

    /**
     * 删除业务字段
     * @param genTableColumns 列数据
     * @return
     */
    @Override
    public int deleteGenTableColumns(List<GenTableColumn> genTableColumns) {
        return genTableColumnMapper.deleteGenTableColumns(genTableColumns);
    }

}
