添加工艺项目相关类
This commit is contained in:
		
							
								
								
									
										36
									
								
								src/main/java/com/xkrs/dao/CraftItemDao.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								src/main/java/com/xkrs/dao/CraftItemDao.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,36 @@ | ||||
| package com.xkrs.dao; | ||||
|  | ||||
| import com.xkrs.model.entity.CraftItemEntity; | ||||
| 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.stereotype.Component; | ||||
|  | ||||
| import javax.transaction.Transactional; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| import java.util.Optional; | ||||
|  | ||||
| /** | ||||
|  * 工艺项目Dao | ||||
|  */ | ||||
| @Component | ||||
| public interface CraftItemDao extends JpaRepository<CraftItemEntity, Integer>, JpaSpecificationExecutor<CraftItemEntity> { | ||||
|  | ||||
|     Optional<CraftItemEntity> findByNo(String no); | ||||
|  | ||||
|     /** | ||||
|      * 更新工艺项目名称 | ||||
|      */ | ||||
|     @Transactional(rollbackOn = Exception.class) | ||||
|     @Modifying(clearAutomatically = true) | ||||
|     @Query(value = "UPDATE craft_item SET update_time = ?2, name = ?3 WHERE id = ?1", nativeQuery = true) | ||||
|     void updateNameById(Integer id, String updateTime, String name); | ||||
|  | ||||
|     /** | ||||
|      * 查询工艺项目 | ||||
|      */ | ||||
|     @Query(value = "SELECT id, no, name FROM craft_item WHERE no LIKE %?1% AND name LIKE %?2% ORDER BY create_time ASC", nativeQuery = true) | ||||
|     List<Map<String, Object>> queryCraftItem(String no, String name); | ||||
| } | ||||
		Reference in New Issue
	
	Block a user