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.TGuijiNaturalresourcesBdcdjxxMapper;
import com.sooka.system.domain.TGuijiNaturalresourcesBdcdjxx;
import com.sooka.system.service.ITGuijiNaturalresourcesBdcdjxxService;

/**
 * 不动产登记信息Service业务层处理
 *
 * @author lei
 * @date 2021-10-29
 */
@Service
public class TGuijiNaturalresourcesBdcdjxxServiceImpl extends Guiji_Base_Service implements ITGuijiNaturalresourcesBdcdjxxService {
    @Autowired
    private TGuijiNaturalresourcesBdcdjxxMapper tGuijiNaturalresourcesBdcdjxxMapper;

    /**
     * 查询不动产登记信息
     *
     * @param id 不动产登记信息ID
     * @return 不动产登记信息
     */
    @Override
    public TGuijiNaturalresourcesBdcdjxx selectTGuijiNaturalresourcesBdcdjxxById(String id) {
        return tGuijiNaturalresourcesBdcdjxxMapper.selectTGuijiNaturalresourcesBdcdjxxById(id);
    }

    /**
     * 查询不动产登记信息列表
     *
     * @param tGuijiNaturalresourcesBdcdjxx 不动产登记信息
     * @return 不动产登记信息
     */
    @Override
    public List<TGuijiNaturalresourcesBdcdjxx> selectTGuijiNaturalresourcesBdcdjxxList(TGuijiNaturalresourcesBdcdjxx tGuijiNaturalresourcesBdcdjxx) {

        List ls = tGuijiNaturalresourcesBdcdjxxMapper.selectTGuijiNaturalresourcesBdcdjxxList(tGuijiNaturalresourcesBdcdjxx);
        if(tGuijiNaturalresourcesBdcdjxx.getGhyt().equals("住宅")){
            tGuijiNaturalresourcesBdcdjxx.setInterfaceinfoId("6832606d-cd4b-4a85-bcaa-e2c4b1e6a428");
            tGuijiNaturalresourcesBdcdjxx.setInterfaceinfoName("共享-不动产-住宅信息");
        }else if(tGuijiNaturalresourcesBdcdjxx.getGhyt().equals("办公")){
            tGuijiNaturalresourcesBdcdjxx.setInterfaceinfoId("60b5e8bf-1191-4b30-bebb-b3adef4a0da2");
            tGuijiNaturalresourcesBdcdjxx.setInterfaceinfoName("共享-不动产-办公信息");
        }else if(tGuijiNaturalresourcesBdcdjxx.getGhyt().equals("商业服务")){
            tGuijiNaturalresourcesBdcdjxx.setInterfaceinfoId("f190c491-f71d-486d-b50d-870e526dbab6");
            tGuijiNaturalresourcesBdcdjxx.setInterfaceinfoName("共享-不动产-商业服务");
        }
        Long deptId = ShiroUtils.getSysUser().getDept().getDeptId();
        String deptName = ShiroUtils.getSysUser().getDept().getDeptName();
        tGuijiNaturalresourcesBdcdjxx.setDeptId(deptId);
        tGuijiNaturalresourcesBdcdjxx.setDeptName(deptName);
        add_log(tGuijiNaturalresourcesBdcdjxx);
        return ls;
    }

    @Override
    public List<TGuijiNaturalresourcesBdcdjxx> selectTGuijiNaturalresourcesBdcdjxxQtList(TGuijiNaturalresourcesBdcdjxx tGuijiNaturalresourcesBdcdjxx) {
        List ls =tGuijiNaturalresourcesBdcdjxxMapper.selectTGuijiNaturalresourcesBdcdjxxQtList(tGuijiNaturalresourcesBdcdjxx);

        tGuijiNaturalresourcesBdcdjxx.setInterfaceinfoId("e7e57001-4a54-40a8-bad1-711a1eb6b46e");
        tGuijiNaturalresourcesBdcdjxx.setInterfaceinfoName("共享-不动产-其他信息");
        Long deptId = ShiroUtils.getSysUser().getDept().getDeptId();
        String deptName = ShiroUtils.getSysUser().getDept().getDeptName();
        tGuijiNaturalresourcesBdcdjxx.setDeptId(deptId);
        tGuijiNaturalresourcesBdcdjxx.setDeptName(deptName);
        add_log(tGuijiNaturalresourcesBdcdjxx);
        return ls;
    }

    /**
     * 新增不动产登记信息
     *
     * @param tGuijiNaturalresourcesBdcdjxx 不动产登记信息
     * @return 结果
     */
    @Override
    public int insertTGuijiNaturalresourcesBdcdjxx(TGuijiNaturalresourcesBdcdjxx tGuijiNaturalresourcesBdcdjxx) {
        tGuijiNaturalresourcesBdcdjxx.setCreateTime(DateUtils.getNowDate());
        return tGuijiNaturalresourcesBdcdjxxMapper.insertTGuijiNaturalresourcesBdcdjxx(tGuijiNaturalresourcesBdcdjxx);
    }

    /**
     * 修改不动产登记信息
     *
     * @param tGuijiNaturalresourcesBdcdjxx 不动产登记信息
     * @return 结果
     */
    @Override
    public int updateTGuijiNaturalresourcesBdcdjxx(TGuijiNaturalresourcesBdcdjxx tGuijiNaturalresourcesBdcdjxx) {
        return tGuijiNaturalresourcesBdcdjxxMapper.updateTGuijiNaturalresourcesBdcdjxx(tGuijiNaturalresourcesBdcdjxx);
    }

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

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