| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- package com.uas.sso.dao;
- import com.uas.sso.entity.Userspace;
- import org.springframework.data.domain.Page;
- import org.springframework.data.domain.Pageable;
- import org.springframework.data.jpa.repository.JpaRepository;
- import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
- import org.springframework.data.jpa.repository.Query;
- import org.springframework.data.jpa.repository.QueryHints;
- import org.springframework.data.repository.query.Param;
- import javax.persistence.QueryHint;
- import java.util.List;
- import java.util.Set;
- /**
- * 企业信息dao,Userspace实体中spaceUU为主键
- *
- * @author wangmh
- * @date 2018/1/5
- */
- public interface UserspaceDao extends JpaRepository<Userspace, Long>, JpaSpecificationExecutor<Userspace> {
- /**
- * 根据企业名称查找企业信息
- *
- * @param spaceName 企业名称
- * @return 企业信息
- */
- Userspace findBySpaceName(String spaceName);
- /**
- * 根据企业营业执照号查找企业信息
- *
- * @param businessCode 企业营业执照号
- * @return
- */
- Userspace findByBusinessCode(String businessCode);
- /**
- * 找到企业最大的uu号
- * @return 最大的uu号
- */
- @Query("select max(us.spaceUU) from Userspace us")
- Long findMaxUU();
- /**
- * 根据域名查找企业
- *
- * @param domain 域名
- * @return
- */
- Userspace findByDomain(String domain);
- /**
- * 根据企业名查询认证状态的企业
- * @param spaceName 企业名
- * @param validCode 认证状态
- * @return 企业信息
- */
- Userspace findBySpaceNameAndValidCode(String spaceName, Short validCode);
- /**
- * 根据企业营业执照号查询认证状态的企业
- * @param businessCode 企业营业执照号
- * @param validCode 认证状态
- * @return 企业信息
- */
- Userspace findByBusinessCodeAndValidCode(String businessCode, short validCode);
- /**
- * 根据关键词搜索相关的企业名
- * @param keyword 关键词
- * @param pageable 页面属性
- * @return
- */
- @QueryHints({ @QueryHint(name = "org.hibernate.cacheable", value = "true") })
- @Query(value = "select t.spaceName from Userspace t where UPPER(t.spaceName) like CONCAT('%',UPPER(:keyword),'%')",
- countQuery = "select count(t) from Userspace t where UPPER(t.spaceName) like CONCAT('%',UPPER(:keyword),'%')")
- Page<String> findByPageInfo(@Param("keyword") String keyword, Pageable pageable);
- }
|