package com.sooka.system.medicine.platform.service.impl;


import com.sooka.common.core.text.Convert;
import com.sooka.common.utils.DateUtils;
import com.sooka.framework.util.ShiroUtils;
import com.sooka.system.medicine.platform.domain.TGuijiMedicinePlatform;
import com.sooka.system.medicine.platform.mapper.TGuijiMedicinePlatformMapper;
import com.sooka.system.medicine.platform.service.ITGuijiMedicinePlatformService;
import com.sooka.system.service.impl.Guiji_Base_Service;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 平台采集Service业务层处理
 *
 * @author lei
 * @date 2022-08-22
 */
@Service
public class TGuijiMedicinePlatformServiceImpl extends Guiji_Base_Service implements ITGuijiMedicinePlatformService
{
    @Resource
    private TGuijiMedicinePlatformMapper tGuijiMedicinePlatformMapper;

    /**
     * 查询平台采集
     *
     * @param id 平台采集ID
     * @return 平台采集
     */
    @Override
    public TGuijiMedicinePlatform selectTGuijiMedicinePlatformById(String id)
    {
        return tGuijiMedicinePlatformMapper.selectTGuijiMedicinePlatformById(id);
    }

    /**
     * 查询平台采集列表
     *
     * @param tGuijiMedicinePlatform 平台采集
     * @return 平台采集
     */
    @Override
    public List<TGuijiMedicinePlatform> selectTGuijiMedicinePlatformList(TGuijiMedicinePlatform tGuijiMedicinePlatform)
    {
        List<TGuijiMedicinePlatform> list = tGuijiMedicinePlatformMapper.selectTGuijiMedicinePlatformList(tGuijiMedicinePlatform);
        tGuijiMedicinePlatform.setOperationStatus(1L);
        tGuijiMedicinePlatform.setParam(tGuijiMedicinePlatform.toString());
        tGuijiMedicinePlatform.setInterfacetype("platform_interfacetype_1");//1 共享 2归集
        tGuijiMedicinePlatform.setInterfaceinfoId("47c9db8e-f7e1-4d25-a8bd-ff4706afdab9");
        tGuijiMedicinePlatform.setInterfaceinfoName("共享（市）-市医药-平台采集");
        Long deptId = ShiroUtils.getSysUser().getDept().getDeptId();
        String deptName = ShiroUtils.getSysUser().getDept().getDeptName();
        tGuijiMedicinePlatform.setDeptId(deptId);
        tGuijiMedicinePlatform.setDeptName(deptName);
        add_log(tGuijiMedicinePlatform);
        return list;
    }

    /**
     * 新增平台采集
     *
     * @param tGuijiMedicinePlatform 平台采集
     * @return 结果
     */
    @Override
    public int insertTGuijiMedicinePlatform(TGuijiMedicinePlatform tGuijiMedicinePlatform)
    {
        tGuijiMedicinePlatform.setCreateTime(DateUtils.getNowDate());
        return tGuijiMedicinePlatformMapper.insertTGuijiMedicinePlatform(tGuijiMedicinePlatform);
    }

    /**
     * 修改平台采集
     *
     * @param tGuijiMedicinePlatform 平台采集
     * @return 结果
     */
    @Override
    public int updateTGuijiMedicinePlatform(TGuijiMedicinePlatform tGuijiMedicinePlatform)
    {
        return tGuijiMedicinePlatformMapper.updateTGuijiMedicinePlatform(tGuijiMedicinePlatform);
    }

    /**
     * 删除平台采集对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteTGuijiMedicinePlatformByIds(String ids)
    {
        return tGuijiMedicinePlatformMapper.deleteTGuijiMedicinePlatformByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除平台采集信息
     *
     * @param id 平台采集ID
     * @return 结果
     */
    @Override
    public int deleteTGuijiMedicinePlatformById(String id)
    {
        return tGuijiMedicinePlatformMapper.deleteTGuijiMedicinePlatformById(id);
    }
}
