zoukankan      html  css  js  c++  java
  • spring boot DAO @query查询示例01

    package com.guohuai.mmp.investor.bankcard;

    import java.util.List;

    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.Modifying;
    import org.springframework.data.jpa.repository.Query;
    import org.springframework.data.repository.query.Param;


    public interface InvestorBankCardDao extends JpaRepository<InvestorBankCardQueryEntity,String>, JpaSpecificationExecutor<InvestorBankCardQueryEntity> {



    @Query(value ="select * from t_money_investor_instgroup_bankcard where investoroid = :investorOid -- #pageable ",
    countQuery = "SELECT count(*) FROM t_money_investor_instgroup_bankcard WHERE investoroid = ?1 ",
    nativeQuery = true)
    Page<InvestorBankCardQueryEntity> findInvestorBankCardQueryEntityAllStatus(@Param("investorOid")String investorOid,Pageable pageable);

    @Modifying
    @Query(value ="update t_money_investor_instgroup_bankcard set auditStatus = 'auditPass', updateTime = now(),auditAnno = :auditAnno where bankCardNumber = :bankCardNumber ",nativeQuery = true)
    int changeInvestorAuditStatusToAuditPass(@Param("bankCardNumber")String bankCardNumber,@Param("auditAnno") String auditAnno);

    @Modifying
    @Query(value ="update t_money_investor_instgroup_bankcard set auditStatus ='auditRefuse' , updateTime = now() ,auditAnno = :auditAnno where bankCardNumber = :bankCardNumber ",nativeQuery = true)
    int changeInvestorAuditStatusToAuditRefuse(@Param("bankCardNumber")String bankCardNumber,@Param("auditAnno") String auditAnno);

    @Query(value ="select * from t_money_investor_instgroup_bankcard where oid = :oid ",nativeQuery = true)
    InvestorBankCardQueryEntity getInvestorBankCardInfo(@Param("oid")String oid);

    @Query(value ="select auditStatus from t_money_investor_instgroup_bankcard where investorOid = :investorOid and auditStatus = 'toAudit' ",nativeQuery = true)
    String getInvestorBankCardInfoByInvestorOidToAudit(@Param("investorOid")String investorOid);

    @Query(value ="select * from t_money_investor_instgroup_bankcard where investorOid = :investorOid ",nativeQuery = true)
    InvestorBankCardQueryEntity getInvestorBankCardInfoByInvestorOid(@Param("investorOid")String investorOid);


    @Query(value ="select * from t_money_investor_instgroup_bankcard where investorOid = :investorOid order by createTime asc ",nativeQuery = true)
    List<InvestorBankCardQueryEntity> getListInvestorBankCardInfo(@Param("investorOid")String investorOid);

    @Query(value ="select count(1) from t_money_investor_bankorder where investorOid= :investorOid and (frozenStatus='frozened' or frozenStatus='toIceOut');",nativeQuery = true)
    int checkInvestorBinkOrUnlockStatus(@Param("investorOid")String investorOid);

    @Modifying
    @Query(value ="update t_money_investor_instgroup_bankcard set auditStatus ='auditRefuse' , updateTime = now() ,auditAnno = :auditAnno where bankCardNumber = :bankCardNumber ",nativeQuery = true)
    int changeAllInvestorAuditStatusToAuditRefuse(@Param("bankCardNumber")String bankCardNumber,@Param("auditAnno") String auditAnno);

    @Query(value = "select count(1) from t_money_investor_instgroup_bankcard "
    + " where investorOid = ?1 and auditStatus = ?2 ", nativeQuery = true)
    public int findByInvestorOidAndAuditStatus(String investorOid,String auditStatus);

    @Query(value ="select * from t_money_investor_instgroup_bankcard where investorOid = ?1 and auditStatus = ?2",nativeQuery = true)
    public InvestorBankCardQueryEntity findbyInvestorOidAndStatus(String investorOid,String auditStatus);


    @Query(value = "select branchName from t_money_investor_instgroup_bankcard where investorOid = :investorOid and auditStatus = 'auditPass'", nativeQuery = true)
    public String findBranchNameData(@Param("investorOid")String investorOid);

    @Query(value = "select companyName from t_money_investor_instgroup_bankcard where investorOid = :investorOid and auditStatus = 'auditPass' ", nativeQuery = true)
    public String findCompanyNameData(@Param("investorOid")String investorOid);

    @Query(value = "select * from t_money_investor_instgroup_bankcard where investorOid = :investorOid and auditStatus = 'auditPass' ", nativeQuery = true)
    public InvestorBankCardQueryEntity findAuditPassCardData(@Param("investorOid")String investorOid);


    @Query(value = "select * from t_money_investor_instgroup_bankcard where investorOid = :investorOid and auditStatus = 'toAudit' ", nativeQuery = true)
    public InvestorBankCardQueryEntity findToAuditCardData(@Param("investorOid")String investorOid);


    @Query(value ="select * from t_money_investor_instgroup_bankcard where investorOid = :investorOid AND passOrNot = 'pass' LIMIT 1 ",nativeQuery = true)
    List<InvestorBankCardQueryEntity> getListPassInvestorBankCardInfo(@Param("investorOid")String investorOid);

    }

  • 相关阅读:
    [bzoj4241] 历史研究 (分块)
    [tyvj2054] 四叶草魔杖 (最小生成树 状压dp)
    20180710 考试记录
    [luogu2047 NOI2007] 社交网络 (floyed最短路)
    [luogu2081 NOI2012] 迷失游乐园 (树形期望dp 基环树)
    [luogu1600 noip2016] 天天爱跑步 (树上差分)
    [luogu2216 HAOI2007] 理想的正方形 (2dST表 or 单调队列)
    [poj 3539] Elevator (同余类bfs)
    [BZOJ1999] 树网的核 [数据加强版] (树的直径)
    bzoj2301 [HAOI2011]Problem b
  • 原文地址:https://www.cnblogs.com/lize1215/p/8629060.html
Copyright © 2011-2022 走看看