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


}

优质内容筛选与推荐>>
1、log4j写入数据库
2、Linux的vim和vi编辑器
3、搭建ElasticSearch+MongoDB检索系统
4、Python学习路线
5、pivot与unpivot数据旋转


长按二维码向我转账

受苹果公司新规定影响,微信 iOS 版的赞赏功能被关闭,可通过二维码转账支持公众号。

    阅读
    好看
    已推荐到看一看
    你的朋友可以在“发现”-“看一看”看到你认为好看的文章。
    已取消,“好看”想法已同步删除
    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送

    已发送

    朋友将在看一看看到

    确定
    分享你的想法...
    取消

    分享想法到看一看

    确定
    最多200字,当前共

    发送中

    网络异常,请稍后重试

    微信扫一扫
    关注该公众号