czt
2025-05-30 9bc5f4d58da606c6a465e152d05a1c31b0611f74
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package com.fzzy.igds.sys.repository;
 
import com.fzzy.igds.dzhwk.domain.Depot;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
 
import java.util.List;
 
/**
 * @Description
 * @Author CZT
 * @Date 2024/11/22 16:59
 */
@Service("sys.depotRepository")
public interface DepotRepository  extends JpaRepository<Depot, String> {
 
    /**
     * 根据组织编码获取仓库货位信息
     *
     * @param companyId
     * @return
     */
    @Query("from Depot where companyId =:companyId order by orderNum")
    List<Depot> getDepotByCompanyId(@Param("companyId") String companyId);
 
    /**
     * 根据组织编码和库区编码获取仓库货位信息
     *
     * @param companyId
     * @param deptId
     * @return
     */
    @Query("from Depot where companyId =:companyId and deptId =:deptId order by orderNum")
    List<Depot> getDepot(@Param("companyId") String companyId, @Param("deptId") String deptId);
 
    /**
     * 根据组织编码和仓库编码获取仓库货位信息
     * @param companyId
     * @param id
     * @return
     */
    @Query("from Depot where companyId =:companyId and id =:id")
    Depot getDepotById(@Param("companyId") String companyId, @Param("id") String id);
 
 
    /**
     * 更新仓库状态
     * @param status
     * @param depotId
     */
    @Transactional
    @Modifying
    @Query("update Depot set depotStatus =:status where id =:depotId")
    void updateDepotStatus(@Param("status") String status, @Param("depotId") String depotId);
 
    /**
     * 根据ids获取仓库
     *
     * @param list
     * @return
     */
    @Query("from Depot where id IN :list order by orderNum")
    List<Depot> getDepotByIds(@Param("list") List<String> list);
}