package com.sooka.system.real_estate.pre_order_cancel_mortgage.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.real_estate.pre_order_cancel_mortgage.domain.TGuijiRealEstatePreOrderCancelMortgage;
import com.sooka.system.real_estate.pre_order_cancel_mortgage.mapper.TGuijiRealEstatePreOrderCancelMortgageMapper;
import com.sooka.system.real_estate.pre_order_cancel_mortgage.service.ITGuijiRealEstatePreOrderCancelMortgageService;
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 TGuijiRealEstatePreOrderCancelMortgageServiceImpl extends Guiji_Base_Service implements ITGuijiRealEstatePreOrderCancelMortgageService
{
    @Resource
    private TGuijiRealEstatePreOrderCancelMortgageMapper mapper;

    /**
     * 查询市房地产-预购商品房抵押权注销信息
     *
     * @param id 市房地产-预购商品房抵押权注销信息ID
     * @return 市房地产-预购商品房抵押权注销信息
     */
    @Override
    public TGuijiRealEstatePreOrderCancelMortgage selectById(String id)
    {
        return mapper.selectById(id);
    }

    /**
     * 查询市房地产-预购商品房抵押权注销信息列表
     *
     * @param param 市房地产-预购商品房抵押权注销信息
     * @return 市房地产-预购商品房抵押权注销信息
     */
    @Override
    public List<TGuijiRealEstatePreOrderCancelMortgage> selectList(TGuijiRealEstatePreOrderCancelMortgage param)
    {
        List<TGuijiRealEstatePreOrderCancelMortgage> list = mapper.selectList(param);
        param.setOperationStatus(1L);
        param.setParam(param.toString());
        param.setInterfacetype("platform_interfacetype_1");//1 共享 2归集
        param.setInterfaceinfoId("01ba7a5b-0f6f-4ece-a18e-ce0993f10210");
        param.setInterfaceinfoName("共享（市）-市房地产-预购商品房抵押权注销信息");
        Long deptId = ShiroUtils.getSysUser().getDept().getDeptId();
        String deptName = ShiroUtils.getSysUser().getDept().getDeptName();
        param.setDeptId(deptId);
        param.setDeptName(deptName);
        add_log(param);
        return list;
    }

    /**
     * 新增市房地产-预购商品房抵押权注销信息
     *
     * @param param 市房地产-预购商品房抵押权注销信息
     * @return 结果
     */
    @Override
    public int insert(TGuijiRealEstatePreOrderCancelMortgage param)
    {
        param.setCreateTime(DateUtils.getNowDate());
        return mapper.insert(param);
    }

    /**
     * 修改市房地产-预购商品房抵押权注销信息
     *
     * @param param 市房地产-预购商品房抵押权注销信息
     * @return 结果
     */
    @Override
    public int update(TGuijiRealEstatePreOrderCancelMortgage param)
    {
        return mapper.update(param);
    }

    /**
     * 删除市房地产-预购商品房抵押权注销信息对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteByIds(String ids)
    {
        return mapper.deleteByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除市房地产-预购商品房抵押权注销信息信息
     *
     * @param id 市房地产-预购商品房抵押权注销信息ID
     * @return 结果
     */
    @Override
    public int deleteById(String id)
    {
        return mapper.deleteById(id);
    }
}
