SecurityDeclarationRepository.java 1.5 KB
package com.agent.repository.system;

import com.agent.entity.agent.SecurityDeclarationEntity;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Auther: shenhl
 * @Date: 2019/4/24 16:38
 */
public interface SecurityDeclarationRepository extends PagingAndSortingRepository<SecurityDeclarationEntity, Long>,
        JpaSpecificationExecutor<SecurityDeclarationEntity> {

    @Transactional
    @Modifying
    @Query(value = "update SECURITY_DECLARATION set SD_WAYBILL=?2, SD_CARGO_SHIPPER_NAME=?4, SD_CARGO_AGENT_NAME=?3, SD_IATA_NUMBER=?5, SD_TRANSPORT_CERTIFICATE=?6, SD_TRANSPORTATION_PROVE=?7, USER_ID=?8, OPERATION_TIME=?9, SD_STATIC=?10 where id=?1", nativeQuery = true)
    int update(Long id, String waybill,
               String cargoAgent, String cargoShipper,
               String iata, String tranposrt, String prove, Long userId, String operation, String statics);

    @Query(value = "select count(*) from SECURITY_DECLARATION where SD_WAYBILL = ?1", nativeQuery = true)
    int findWaybill(String waybill);

    @Query(value = "select * from SECURITY_DECLARATION where SD_WAYBILL = ?1", nativeQuery = true)
    List<SecurityDeclarationEntity> waybill(String waybill);

}