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.TGuijiNaturalresourcesBdcdjzxxMapper;
import com.sooka.system.domain.TGuijiNaturalresourcesBdcdjzxx;
import com.sooka.system.service.ITGuijiNaturalresourcesBdcdjzxxService;

/**
 * 不动产登记证信息Service业务层处理
 *
 * @author lei
 * @date 2021-10-29
 */
@Service
public class TGuijiNaturalresourcesBdcdjzxxServiceImpl extends Guiji_Base_Service implements ITGuijiNaturalresourcesBdcdjzxxService {
    @Autowired
    private TGuijiNaturalresourcesBdcdjzxxMapper tGuijiNaturalresourcesBdcdjzxxMapper;

    /**
     * 查询不动产登记证信息
     *
     * @param id 不动产登记证信息ID
     * @return 不动产登记证信息
     */
    @Override
    public TGuijiNaturalresourcesBdcdjzxx selectTGuijiNaturalresourcesBdcdjzxxById(String id) {
        return tGuijiNaturalresourcesBdcdjzxxMapper.selectTGuijiNaturalresourcesBdcdjzxxById(id);
    }

    /**
     * 查询不动产登记证信息列表
     *
     * @param tGuijiNaturalresourcesBdcdjzxx 不动产登记证信息
     * @return 不动产登记证信息
     */
    @Override
    public List<TGuijiNaturalresourcesBdcdjzxx> selectTGuijiNaturalresourcesBdcdjzxxList(TGuijiNaturalresourcesBdcdjzxx tGuijiNaturalresourcesBdcdjzxx) {
        List ls = tGuijiNaturalresourcesBdcdjzxxMapper.selectTGuijiNaturalresourcesBdcdjzxxList(tGuijiNaturalresourcesBdcdjzxx);
        if (tGuijiNaturalresourcesBdcdjzxx.getYt().equals("住宅")) {
            tGuijiNaturalresourcesBdcdjzxx.setInterfaceinfoId("e0e80e65-bdc9-424d-ac86-9aa2759f4c9c");
            tGuijiNaturalresourcesBdcdjzxx.setInterfaceinfoName("共享-不动产-住宅证信息");
        } else if (tGuijiNaturalresourcesBdcdjzxx.getYt().equals("办公")) {
            tGuijiNaturalresourcesBdcdjzxx.setInterfaceinfoId("c8d0df16-db55-48d3-b518-e1e751bc3e56");
            tGuijiNaturalresourcesBdcdjzxx.setInterfaceinfoName("共享-不动产-办公证信息");
        } else if (tGuijiNaturalresourcesBdcdjzxx.getYt().equals("商业服务")) {
            tGuijiNaturalresourcesBdcdjzxx.setInterfaceinfoId("7b0c12dd-550b-4d43-9513-619a55257a89");
            tGuijiNaturalresourcesBdcdjzxx.setInterfaceinfoName("共享-不动产-商业服务证信息");
        }
        Long deptId = ShiroUtils.getSysUser().getDept().getDeptId();
        String deptName = ShiroUtils.getSysUser().getDept().getDeptName();
        tGuijiNaturalresourcesBdcdjzxx.setDeptId(deptId);
        tGuijiNaturalresourcesBdcdjzxx.setDeptName(deptName);
        add_log(tGuijiNaturalresourcesBdcdjzxx);
        return ls;
    }

    @Override
    public List<TGuijiNaturalresourcesBdcdjzxx> selectTGuijiNaturalresourcesBdcdjxxQtList(TGuijiNaturalresourcesBdcdjzxx tGuijiNaturalresourcesBdcdjzxx) {

        List ls = tGuijiNaturalresourcesBdcdjzxxMapper.selectTGuijiNaturalresourcesBdcdjxxQtList(tGuijiNaturalresourcesBdcdjzxx);
        tGuijiNaturalresourcesBdcdjzxx.setInterfaceinfoId("共享-不动产-其他证信息");
        tGuijiNaturalresourcesBdcdjzxx.setInterfaceinfoName("1d2e2b62-105c-4c88-ab88-a9b806a9d34e");
        Long deptId = ShiroUtils.getSysUser().getDept().getDeptId();
        String deptName = ShiroUtils.getSysUser().getDept().getDeptName();
        tGuijiNaturalresourcesBdcdjzxx.setDeptId(deptId);
        tGuijiNaturalresourcesBdcdjzxx.setDeptName(deptName);
        add_log(tGuijiNaturalresourcesBdcdjzxx);
        return ls;
    }

    /**
     * 新增不动产登记证信息
     *
     * @param tGuijiNaturalresourcesBdcdjzxx 不动产登记证信息
     * @return 结果
     */
    @Override
    public int insertTGuijiNaturalresourcesBdcdjzxx(TGuijiNaturalresourcesBdcdjzxx tGuijiNaturalresourcesBdcdjzxx) {
        tGuijiNaturalresourcesBdcdjzxx.setCreateTime(DateUtils.getNowDate());
        return tGuijiNaturalresourcesBdcdjzxxMapper.insertTGuijiNaturalresourcesBdcdjzxx(tGuijiNaturalresourcesBdcdjzxx);
    }

    /**
     * 修改不动产登记证信息
     *
     * @param tGuijiNaturalresourcesBdcdjzxx 不动产登记证信息
     * @return 结果
     */
    @Override
    public int updateTGuijiNaturalresourcesBdcdjzxx(TGuijiNaturalresourcesBdcdjzxx tGuijiNaturalresourcesBdcdjzxx) {
        return tGuijiNaturalresourcesBdcdjzxxMapper.updateTGuijiNaturalresourcesBdcdjzxx(tGuijiNaturalresourcesBdcdjzxx);
    }

    /**
     * 删除不动产登记证信息对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteTGuijiNaturalresourcesBdcdjzxxByIds(String ids) {
        return tGuijiNaturalresourcesBdcdjzxxMapper.deleteTGuijiNaturalresourcesBdcdjzxxByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除不动产登记证信息信息
     *
     * @param id 不动产登记证信息ID
     * @return 结果
     */
    @Override
    public int deleteTGuijiNaturalresourcesBdcdjzxxById(String id) {
        return tGuijiNaturalresourcesBdcdjzxxMapper.deleteTGuijiNaturalresourcesBdcdjzxxById(id);
    }
}
