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.TGuijiLibraryBorrowMapper;
import com.sooka.system.domain.TGuijiLibraryBorrow;
import com.sooka.system.service.ITGuijiLibraryBorrowService;

import javax.annotation.Resource;


/**
 * 借书Service业务层处理
 *
 * @author lei
 * @date 2021-10-20
 */
@Service
public class TGuijiLibraryBorrowServiceImpl extends Guiji_Base_Service implements ITGuijiLibraryBorrowService
{
    @Resource
    private TGuijiLibraryBorrowMapper tGuijiLibraryBorrowMapper;

    /**
     * 查询借书
     *
     * @param id 借书ID
     * @return 借书
     */
    @Override
    public TGuijiLibraryBorrow selectTGuijiLibraryBorrowById(String id)
    {
        return tGuijiLibraryBorrowMapper.selectTGuijiLibraryBorrowById(id);
    }

    /**
     * 查询借书列表
     *
     * @param tGuijiLibraryBorrow 借书
     * @return 借书
     */
    @Override
    public List<TGuijiLibraryBorrow> selectTGuijiLibraryBorrowList(TGuijiLibraryBorrow tGuijiLibraryBorrow)
    {

        List ls = tGuijiLibraryBorrowMapper.selectTGuijiLibraryBorrowList(tGuijiLibraryBorrow);
        tGuijiLibraryBorrow.setInterfaceinfoId("9c7ffbdf-56e6-40d1-9bf9-6483ca843774");
        tGuijiLibraryBorrow.setInterfaceinfoName("共享-通化市图书馆-借书信息查询");
        tGuijiLibraryBorrow.setInterfacetype("platform_interfacetype_1");
        Long deptId = ShiroUtils.getSysUser().getDept().getDeptId();
        String deptName = ShiroUtils.getSysUser().getDept().getDeptName();
        tGuijiLibraryBorrow.setDeptId(deptId);
        tGuijiLibraryBorrow.setDeptName(deptName);
        add_log(tGuijiLibraryBorrow);

        return ls;
    }

    /**
     * 新增借书
     *
     * @param tGuijiLibraryBorrow 借书
     * @return 结果
     */
    @Override
    public int insertTGuijiLibraryBorrow(TGuijiLibraryBorrow tGuijiLibraryBorrow)
    {
        tGuijiLibraryBorrow.setCreateTime(DateUtils.getNowDate());
        return tGuijiLibraryBorrowMapper.insertTGuijiLibraryBorrow(tGuijiLibraryBorrow);
    }

    /**
     * 修改借书
     *
     * @param tGuijiLibraryBorrow 借书
     * @return 结果
     */
    @Override
    public int updateTGuijiLibraryBorrow(TGuijiLibraryBorrow tGuijiLibraryBorrow)
    {
        return tGuijiLibraryBorrowMapper.updateTGuijiLibraryBorrow(tGuijiLibraryBorrow);
    }

    /**
     * 删除借书对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteTGuijiLibraryBorrowByIds(String ids)
    {
        return tGuijiLibraryBorrowMapper.deleteTGuijiLibraryBorrowByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除借书信息
     *
     * @param id 借书ID
     * @return 结果
     */
    @Override
    public int deleteTGuijiLibraryBorrowById(String id)
    {
        return tGuijiLibraryBorrowMapper.deleteTGuijiLibraryBorrowById(id);
    }
}
