package com.github.wxiaoqi.security.admin.mapper;

import com.github.wxiaoqi.security.admin.dto.CompanyApplyFindDTO;
import com.github.wxiaoqi.security.admin.entity.CompanyInfoApply;
import com.github.wxiaoqi.security.admin.vo.CompanyApplyVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.additional.idlist.SelectByIdListMapper;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface CompanyInfoApplyMapper extends Mapper<CompanyInfoApply>, SelectByIdListMapper<CompanyInfoApply,Long> {

    List<CompanyApplyVo> selectList(CompanyApplyFindDTO companyApplyFindDTO);

    @Select("SELECT * FROM  company_info_apply WHERE branch_id=#{branchId} and form_type=2  ORDER BY upd_time DESC LIMIT 1")
    CompanyInfoApply getOneByOrderUpdTime(@Param("branchId")Long branchId);

    @Select("SELECT * FROM company_info_apply WHERE `status`  = 0  AND DATE_SUB(CURDATE(),INTERVAL 7 DAY) >= date(from_unixtime(crt_time/1000))")
    List<CompanyInfoApply> getListByDay();
}