package com.sooka.system.medicine.project.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.project.domain.TGuijiMedicineProject;
import com.sooka.system.medicine.project.mapper.TGuijiMedicineProjectMapper;
import com.sooka.system.medicine.project.service.ITGuijiMedicineProjectService;
import com.sooka.system.service.impl.Guiji_Base_Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

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

/**
 * 项目采集Service业务层处理
 *
 * @author lei
 * @date 2022-08-22
 */
@Service
public class TGuijiMedicineProjectServiceImpl extends Guiji_Base_Service implements ITGuijiMedicineProjectService
{
    @Resource
    private TGuijiMedicineProjectMapper tGuijiMedicineProjectMapper;

    /**
     * 查询项目采集
     *
     * @param id 项目采集ID
     * @return 项目采集
     */
    @Override
    public TGuijiMedicineProject selectTGuijiMedicineProjectById(String id)
    {
        return tGuijiMedicineProjectMapper.selectTGuijiMedicineProjectById(id);
    }

    /**
     * 查询项目采集列表
     *
     * @param tGuijiMedicineProject 项目采集
     * @return 项目采集
     */
    @Override
    public List<TGuijiMedicineProject> selectTGuijiMedicineProjectList(TGuijiMedicineProject tGuijiMedicineProject)
    {
        List<TGuijiMedicineProject> list = tGuijiMedicineProjectMapper.selectTGuijiMedicineProjectList(tGuijiMedicineProject);
        tGuijiMedicineProject.setOperationStatus(1L);
        tGuijiMedicineProject.setParam(tGuijiMedicineProject.toString());
        tGuijiMedicineProject.setInterfacetype("platform_interfacetype_1");//1 共享 2归集
        tGuijiMedicineProject.setInterfaceinfoId("e2f08d8c-8fe4-4e59-b1c1-20a9700a19c5");
        tGuijiMedicineProject.setInterfaceinfoName("共享（市）-市医药-项目采集");
        Long deptId = ShiroUtils.getSysUser().getDept().getDeptId();
        String deptName = ShiroUtils.getSysUser().getDept().getDeptName();
        tGuijiMedicineProject.setDeptId(deptId);
        tGuijiMedicineProject.setDeptName(deptName);
        add_log(tGuijiMedicineProject);
        return list;
    }

    /**
     * 新增项目采集
     *
     * @param tGuijiMedicineProject 项目采集
     * @return 结果
     */
    @Override
    public int insertTGuijiMedicineProject(TGuijiMedicineProject tGuijiMedicineProject)
    {
        tGuijiMedicineProject.setCreateTime(DateUtils.getNowDate());
        return tGuijiMedicineProjectMapper.insertTGuijiMedicineProject(tGuijiMedicineProject);
    }

    /**
     * 修改项目采集
     *
     * @param tGuijiMedicineProject 项目采集
     * @return 结果
     */
    @Override
    public int updateTGuijiMedicineProject(TGuijiMedicineProject tGuijiMedicineProject)
    {
        return tGuijiMedicineProjectMapper.updateTGuijiMedicineProject(tGuijiMedicineProject);
    }

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

    /**
     * 删除项目采集信息
     *
     * @param id 项目采集ID
     * @return 结果
     */
    @Override
    public int deleteTGuijiMedicineProjectById(String id)
    {
        return tGuijiMedicineProjectMapper.deleteTGuijiMedicineProjectById(id);
    }
}
