SDCargoNameRepository.java 1.3 KB
package com.agent.repository.system;

import com.agent.entity.agent.SDCargoNameEntity;
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:39
 */
public interface SDCargoNameRepository extends PagingAndSortingRepository<SDCargoNameEntity, Long>,
        JpaSpecificationExecutor<SDCargoNameEntity> {


    @Query(value = "select * from SD_CARGO_NAME where sd_waybill = ?1", nativeQuery = true)
    List<SDCargoNameEntity>waybillAll(String waybill);

    @Transactional
    @Modifying
    @Query(value = "delete from SD_CARGO_NAME where id = ?1", nativeQuery = true)
    int deleteAlls(Long waybill);

    @Transactional
    @Modifying
    @Query(value = "delete from SD_CARGO_NAME where sd_waybill = ?1", nativeQuery = true)
    int deletes(String waybillnomaster);

    @Query(value = "select distinct SD_CARGO_NAME from SD_CARGO_NAME where SD_CARGO_NAME not in (select CARGO_NAME from SD_TWO_TYPE)", nativeQuery = true)
    List<String> findAlls();

}