package com.sooka.system.service.impl;

import java.util.List;

import com.sooka.common.core.text.Convert;
import com.sooka.common.utils.DateUtils;
import com.sooka.framework.util.ShiroUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.sooka.system.mapper.TGuijiNaturalresourcesQlrjbxxMapper;
import com.sooka.system.domain.TGuijiNaturalresourcesQlrjbxx;
import com.sooka.system.service.ITGuijiNaturalresourcesQlrjbxxService;

/**
 * 个人基本信息Service业务层处理
 *
 * @author wangjinsheng
 * @date 2021-10-28
 */
@Service
public class TGuijiNaturalresourcesQlrjbxxServiceImpl extends Guiji_Base_Service implements ITGuijiNaturalresourcesQlrjbxxService {
    @Autowired
    private TGuijiNaturalresourcesQlrjbxxMapper tGuijiNaturalresourcesQlrjbxxMapper;

    /**
     * 查询个人基本信息
     *
     * @param id 个人基本信息ID
     * @return 个人基本信息
     */
    @Override
    public TGuijiNaturalresourcesQlrjbxx selectTGuijiNaturalresourcesQlrjbxxById(String id) {
        return tGuijiNaturalresourcesQlrjbxxMapper.selectTGuijiNaturalresourcesQlrjbxxById(id);
    }

    /**
     * 查询个人基本信息列表
     *
     * @param tGuijiNaturalresourcesQlrjbxx 个人基本信息
     * @return 个人基本信息
     */
    @Override
    public List<TGuijiNaturalresourcesQlrjbxx> selectTGuijiNaturalresourcesQlrjbxxList(TGuijiNaturalresourcesQlrjbxx tGuijiNaturalresourcesQlrjbxx) {
        List ls = tGuijiNaturalresourcesQlrjbxxMapper.selectTGuijiNaturalresourcesQlrjbxxList(tGuijiNaturalresourcesQlrjbxx);

        if(tGuijiNaturalresourcesQlrjbxx.getQlrxz().equals("个人")){
            tGuijiNaturalresourcesQlrjbxx.setInterfaceinfoId("27346269-5887-40dc-b1f8-bcaa7dcae22c");
            tGuijiNaturalresourcesQlrjbxx.setInterfaceinfoName("共享-不动产-个人基本信息");
        }else if(tGuijiNaturalresourcesQlrjbxx.getQlrxz().equals("企业")){
            tGuijiNaturalresourcesQlrjbxx.setInterfaceinfoId("aebb12e7-d69b-4fdb-ad22-8cf9f17bdfa0");
            tGuijiNaturalresourcesQlrjbxx.setInterfaceinfoName("共享-不动产-企业基本信息");
        }else if(tGuijiNaturalresourcesQlrjbxx.getQlrxz().equals("")){
            tGuijiNaturalresourcesQlrjbxx.setInterfaceinfoId("1138f726-87af-45f6-b67c-c061d3f514b0");
            tGuijiNaturalresourcesQlrjbxx.setInterfaceinfoName("共享-不动产-其他基本信息");
        }
        Long deptId = ShiroUtils.getSysUser().getDept().getDeptId();
        String deptName = ShiroUtils.getSysUser().getDept().getDeptName();
        tGuijiNaturalresourcesQlrjbxx.setDeptId(deptId);
        tGuijiNaturalresourcesQlrjbxx.setDeptName(deptName);
        add_log(tGuijiNaturalresourcesQlrjbxx);


        return ls;
    }

    /**
     * 新增个人基本信息
     *
     * @param tGuijiNaturalresourcesQlrjbxx 个人基本信息
     * @return 结果
     */
    @Override
    public int insertTGuijiNaturalresourcesQlrjbxx(TGuijiNaturalresourcesQlrjbxx tGuijiNaturalresourcesQlrjbxx) {
        tGuijiNaturalresourcesQlrjbxx.setCreateTime(DateUtils.getNowDate());
        return tGuijiNaturalresourcesQlrjbxxMapper.insertTGuijiNaturalresourcesQlrjbxx(tGuijiNaturalresourcesQlrjbxx);
    }

    /**
     * 修改个人基本信息
     *
     * @param tGuijiNaturalresourcesQlrjbxx 个人基本信息
     * @return 结果
     */
    @Override
    public int updateTGuijiNaturalresourcesQlrjbxx(TGuijiNaturalresourcesQlrjbxx tGuijiNaturalresourcesQlrjbxx) {
        return tGuijiNaturalresourcesQlrjbxxMapper.updateTGuijiNaturalresourcesQlrjbxx(tGuijiNaturalresourcesQlrjbxx);
    }

    /**
     * 删除个人基本信息对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteTGuijiNaturalresourcesQlrjbxxByIds(String ids) {
        return tGuijiNaturalresourcesQlrjbxxMapper.deleteTGuijiNaturalresourcesQlrjbxxByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除个人基本信息信息
     *
     * @param id 个人基本信息ID
     * @return 结果
     */
    @Override
    public int deleteTGuijiNaturalresourcesQlrjbxxById(String id) {
        return tGuijiNaturalresourcesQlrjbxxMapper.deleteTGuijiNaturalresourcesQlrjbxxById(id);
    }
}
