package io.renren.modules.admin.dao;

import io.renren.modules.admin.entity.EmployeeEntity;
import io.renren.modules.admin.entity.IndustryEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 
 * 
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2020-02-21 14:56:20
 */
@Mapper
public interface IndustryDao extends BaseMapper<IndustryEntity> {

    /**
     * 根据name 模糊搜索
     *
     * @param name
     * @return
     */
    @Select("select * from industry where name like '%${name}%'")
    List<IndustryEntity> findAllByName(String name);


    /**
     * 查询name是否存在
     * @param name
     * @return
     */
    @Select("select case when EXISTS (select * from industry where name = '${name}') then 1 else 0 end as result")
    int selectIsName(String name);
}