“djh”
2024-12-04 d1549b8445c65a6775cf1ba093f5040ace0f87e7
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
package com.gkhy.huataiFourierSpecialGasMonitor.domain.sysAdmin.repository.jpa;
 
import com.gkhy.huataiFourierSpecialGasMonitor.domain.sysAdmin.entity.MenuItem;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
 
import java.util.List;
 
public interface MenuItemRepository extends JpaRepository<MenuItem, Long> {
 
    @Query(value = "select m from MenuItem m where m.id = :menuItemId and m.visiable = true and m.del = 0")
    MenuItem findVisiableById(Long menuItemId);
 
    @Query(value = "select m from MenuItem m where m.id = :menuId and m.visiable = false and m.del = 0")
    MenuItem findDisVisiableById(Long menuId);
 
    @Modifying
    @Query(value = "update MenuItem m set m.del = 1 where m.id = :menuItemId")
    Integer logicDeleteMenuItem(Long menuItemId);
 
    @Modifying
    @Query(value = "delete from MenuItem m where m.id = :menuItemId")
    Integer deleteByMenuItemId(Long menuItemId);
 
    @Modifying
    @Query(value = "update MenuItem m set m.visiable = true where m.id = :menuItemId and m.visiable = false and m.del = 0")
    Integer setMenuItemVisiabel(Long menuItemId);
 
    @Modifying
    @Query(value = "update MenuItem m set m.visiable = false where m.id = :menuItemId and m.visiable = true and m.del = 0")
    Integer setMenuItemDisVisiabel(Long menuItemId);
 
    @Query(value = "select m from MenuItem m where m.del = 0 order by m.priority asc ")
    List findAllActive();
 
    @Query(value = "select m from MenuItem m where m.del = 0 and m.visiable = true order by m.priority asc ")
    List findAllVisiable();
 
    @Query(value = "select m from MenuItem m where m.id in :idList and m.del = 0 order by m.priority asc ")
    List<MenuItem> findAllActiveByIdIn(List<Long> idList);
 
    @Query(value = "select m from MenuItem m where m.id in :idList and m.del = 0 and m.visiable = :visiable order by m.priority asc ")
    List<MenuItem> findAllByIdInAndVisiable(List<Long> idList,Boolean visiable);
 
 
    @Query(value = "select m from MenuItem m where m.type = 1 and m.del = 0 order by m.priority asc")
    List<MenuItem> findAllActivePublicMenuItems();
 
    @Query("select count(m) from MenuItem m where m.parentId = :parentId")
    Integer countSubMenuItems(Long parentId);
}