Ver código fonte

menu auth update

shjung 3 anos atrás
pai
commit
9fe4aa6e30

+ 0 - 4
src/main/java/com/its/op/common/CommonTest.java

@@ -1,4 +0,0 @@
-package com.its.op.common;
-
-public class CommonTest {
-}

+ 1 - 4
src/main/java/com/its/op/model/entity/database/Atrd.java

@@ -1,10 +1,7 @@
 package com.its.op.model.entity.database;
 
 import com.its.op.model.dto.database.AtrdDto;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
+import lombok.*;
 import org.hibernate.annotations.ColumnDefault;
 import org.hibernate.annotations.DynamicInsert;
 import org.hibernate.annotations.DynamicUpdate;

+ 1 - 1
src/main/java/com/its/op/repository/cctv/CctvMonitoringRepository.java

@@ -23,7 +23,7 @@ public interface CctvMonitoringRepository extends JpaRepository<CctvMonitoring,
     void deleteByName(String MONITORING_NM) throws Exception;
 
     @Modifying // select 문이 아님을 나타낸다
-    @Query(value = "insert into TB_CCTV_MONITORING m values(:mtype, :name, :seq, :nmbr, :mode)", nativeQuery = true)
+    @Query(value = "insert into TB_CCTV_MONITORING values(:mtype, :name, :seq, :nmbr, :mode)", nativeQuery = true)
     void insertValue(Integer mtype, String name, Integer seq, Long nmbr, Integer mode) throws Exception;
 
 }

+ 9 - 0
src/main/java/com/its/op/repository/database/GropMenuAthrRepository.java

@@ -3,6 +3,7 @@ package com.its.op.repository.database;
 import com.its.op.model.entity.database.GropMenuAthr;
 import com.its.op.model.entity.database.GropMenuAthrKey;
 import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Modifying;
 import org.springframework.data.jpa.repository.Query;
 import org.springframework.stereotype.Repository;
 
@@ -13,4 +14,12 @@ public interface GropMenuAthrRepository extends JpaRepository<GropMenuAthr, Grop
 
     @Query(value = "select p from GropMenuAthr p inner join fetch p.operMenu inner join fetch p.userGrop")
     List<GropMenuAthr> findAll();
+
+    @Modifying // select 문이 아님을 나타낸다
+    @Query("delete from GropMenuAthr p where p.GROP_ID = :GROP_ID and p.OPERSYST_MENU_ID = :OPERSYST_MENU_ID")
+    void deleteByMenuId(String GROP_ID, String OPERSYST_MENU_ID) throws Exception;
+
+    @Modifying // select 문이 아님을 나타낸다
+    @Query(value = "insert into TB_GROP_MENU_ATHR(GROP_ID, OPERSYST_MENU_ID, ATHR_YN) values(:grop_id, :menu_id, :authr_yn)", nativeQuery = true)
+    void insertValue(String grop_id, String menu_id, String authr_yn) throws Exception;
 }

+ 3 - 1
src/main/java/com/its/op/service/database/GropMenuAthrService.java

@@ -124,7 +124,9 @@ public class GropMenuAthrService {
                 Optional<GropMenuAthr> data = this.menuAuthRepo.findById(key);
                 GropMenuAthr obj = data.orElseGet(() -> new GropMenuAthr(req.getGROP_ID(), req.getOPERSYST_MENU_ID()));
                 obj.updateInfo(req);
-                this.menuAuthRepo.save(obj);
+                //this.menuAuthRepo.save(obj);
+                this.menuAuthRepo.deleteByMenuId(req.getGROP_ID(), req.getOPERSYST_MENU_ID());
+                this.menuAuthRepo.insertValue(req.getGROP_ID(), req.getOPERSYST_MENU_ID(), req.getATHR_YN());
                 result.add(obj);
             }
         }