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);


    }

  • 相关阅读:
    Python---面向对象---案例
    Python---面向对象---龟鱼游戏
    man lspci
    Python---面向对象---修学校
    Python---面向对象编程---自定义列表和集合操作类
    Python---面向对象编程
    Python---常用的内置模块
    man hdparm
    man lsof
    linux中文man手册安装
  • 原文地址:https://www.cnblogs.com/coderdxj/p/9117335.html
Copyright © 2011-2022 走看看