package com.example.repository;

import java.util.List;

import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository;
import org.springframework.data.repository.query.Param; import com.example.domain.Customers; //注意:sql里的表名必须和对象名完全一致,包括大小写
//注意这里出现的都是对象名和对象中的属性名
public interface CustomersRepository extends Repository<Customers, Long>{
@Query(value = "from Customers o where id=(select max(id) from Customers p)")
public Customers getCustomersByMaxId(); @Query(value = "from Customers o where o.name=?1 and o.phone=?2")
public List<Customers> queryParams1(String name, Integer phone); @Query(value = "from Customers o where o.name=:name and o.phone=:phone")
public List<Customers> queryParams2(@Param("name")String name, @Param("phone")Integer phone); @Query(value = "from Customers o where o.name like %?1%")
public List<Customers> queryLike1(String name); @Query(value = "from Customers o where o.name like %:name%")
public List<Customers> queryLike2(@Param("name")String name); @Query(nativeQuery = true, value = "select count(1) from Customers o")
public long getCount(); @Modifying
@Query(value = "update SystemConfigurationManagement o set o.configurationItemName=:configurationItemName, o.configurationItemValue=:configurationItemValue where o.id=:id ")
void renameSystemConfigurationManagement(@Param("id") Long id, @Param("configurationItemName") String configurationItemName, @Param("configurationItemValue") String configurationItemValue); @Modifying
@Query(value = "delete SystemConfigurationManagement o where o.id=:id ")
void deleteSystemConfigurationManagementById(@Param("id")Long id); @Modifying
@Query(value = "delete SystemConfigurationManagement o where o.id in (:idsList)")
void deleteSystemConfigurationManagementByIds(@Param("idsList")List<Long> idsList); }

最新文章

  1. 微信小程序定时器组件(输入时间字符串即可倒计时)
  2. 关于学习angularJS 的 心里路程(二)
  3. 某app客户端数字签名分析
  4. :last-child
  5. [课程设计]Scrum 2.6 多鱼点餐系统开发进度(下单一览页面-菜式添加功能实现)
  6. SourceTree 免登录跳过初始设置
  7. C#中值类型和引用类型
  8. BZOJ 3224 TYVJ 1728 普通平衡树 [Treap树模板]
  9. Servlet编程-步步为营
  10. iOS维码的生成和扫描
  11. Linux与Windows中动态链接库的分析与对比
  12. [转] sql数据类型 varchar与nvarchar的区别
  13. hadoop 2.2.0 集群部署 坑
  14. initWithFrame和initWithCoder区别
  15. Arcgis for javascript map操作addLayer具体解释
  16. lucene 从2.4.0—3.6.0—4.3.1版本升级
  17. Mysql group by语句的优化
  18. ProtocolBuffer for Objective-C 运行环境配置及使用
  19. 比Python、Java更快的 Go 语言,能否称霸江湖?
  20. 2-物联网开发标配方案(51单片机程序介绍+WIFI程序介绍)

热门文章

  1. Qt 线程基础
  2. mysql基础运维
  3. jQuery实现鼠标划过展示大图的方法
  4. bzoj2442
  5. Cache应用/任务Mutex,用于高并发任务处理经过多个项目使用
  6. J2EE课程设计——企业人力资源管理系统
  7. oracle创建定时器详解|interval属性
  8. mysql数据添加时如果这条数据存在进行修改
  9. HTML save data to CSV or excel
  10. (译)KVO的内部实现