zoukankan      html  css  js  c++  java
  • springboot jpa使用

    package com.jxd.Boot.dao;

    import java.util.List;

    import org.springframework.data.jpa.repository.JpaRepository;
    import org.springframework.data.jpa.repository.Query;

    import com.jxd.Boot.po.Student;

    /**
    * @author jinxudong
    *
    */
    public interface StudentDao extends JpaRepository<Student, Long> {
    Student findByName(String studentName);

    @Query(value = "sql", nativeQuery = true)
    Student findByUid(String uid);

    /**
    * @Description (原生态sql)
    * @return
    */
    @Query(value = "select s.* from student s where 1=1 ", nativeQuery = true)
    List<Student> selectStudent();

    /**
    * @Description (多条件查询)
    * @param name
    * @param age
    * @return
    */
    List<Student> findByNameAndAge(String name, Integer age);

    List<Student> findByNameLike(String name);

    /**
    * @Description (模糊搜索按字段排序)
    * @param name
    * @return
    */
    List<Student> findByNameLikeOrderByAge(String name);

    /**
    * @Description (按字段排序)
    * @return
    */
    List<Student> findByOrderByAgeDesc();

    /**
    * @Description (按字段统计)
    * @param name
    * @return
    */
    long countByName(String name);


    }

  • 相关阅读:
    Istio安装配置及使用
    Istio介绍
    Rancher管理k8s集群
    EFK部署
    常见日志收集方案及相关组件
    Prometheus Pushgateway
    Prometheus监控拓展
    Prometheus PromQL语法
    开始新工作了
    SpringBlade 新系统 运行
  • 原文地址:https://www.cnblogs.com/coderdxj/p/9117335.html
Copyright © 2011-2022 走看看