huiwon.seo 4 лет назад
Родитель
Сommit
fb5a9ccce3

+ 18 - 17
src/main/java/com/lemon/lifecenter/controller/StaffController.java

@@ -131,7 +131,10 @@ public class StaffController extends LifeCenterController {
     
     @RequestMapping("/info")
     public ModelAndView staffInfo(
+            HttpServletRequest request,HttpServletResponse response,
             @RequestParam(value="staffId", required=false, defaultValue="") String staffID) {
+        String sesId  = LifeCenterSessionController.getSession( request, "sesId" );
+        
         
         StaffDTO dto = new StaffDTO();
         dto.setId(staffID);
@@ -140,7 +143,8 @@ public class StaffController extends LifeCenterController {
         
         ModelAndView mv = setMV("staff/info");
         mv.addObject("info", dto);
-
+        mv.addObject( "sesId", sesId );
+        
         return mv;
     }
 
@@ -152,22 +156,22 @@ public class StaffController extends LifeCenterController {
         StaffDTO dto = new StaffDTO();
         dto.setId(staffId);
         dto = memberService.selectMemberInfo(dto);
-        String groupIdx = LifeCenterFunction.aesEncrypt(config.aesKey, config.IV, String.valueOf(dto.getGroupIdx()));
+//        String groupIdx = LifeCenterFunction.aesEncrypt(config.aesKey, config.IV, String.valueOf(dto.getGroupIdx()));
         int centerCode = dto.getCenterCode();
         
-        GroupListDTO gDto = new GroupListDTO();
-        List<GroupListDTO> groupList = groupListService.selectGroupList(gDto);
+//        GroupListDTO gDto = new GroupListDTO();
+//        List<GroupListDTO> groupList = groupListService.selectGroupList(gDto);
         
-        for( GroupListDTO data : groupList ) {
-            data.setEncryptIdx( LifeCenterFunction.aesEncrypt( config.aesKey, config.IV, String.valueOf( data.getIdx() ) ) );
-        }
+//        for( GroupListDTO data : groupList ) {
+//            data.setEncryptIdx( LifeCenterFunction.aesEncrypt( config.aesKey, config.IV, String.valueOf( data.getIdx() ) ) );
+//        }
         
         ModelAndView mv = setMV("staff/edit");
         mv.addObject("info", dto);
         mv.addObject("centerCode", centerCode);
-        mv.addObject("groupIdx", groupIdx);
+//        mv.addObject("groupIdx", groupIdx);
 //        mv.addObject("centerList", centerList);
-        mv.addObject( "groupList", groupList );
+//        mv.addObject( "groupList", groupList );
 
         return mv;
     }
@@ -175,18 +179,14 @@ public class StaffController extends LifeCenterController {
     @RequestMapping("edit/update")
     public String editUpdate(
             HttpServletRequest request,HttpServletResponse response,
-            @ModelAttribute("dto") StaffDTO dto,
-            @RequestParam(value="encGroupIdx", required=true) String encGroupIdx) throws Exception {
+            @ModelAttribute("dto") StaffDTO dto
+            ) throws Exception {
         
         String sesId  = LifeCenterSessionController.getSession( request, "sesId" );
-        String groupIdx = LifeCenterFunction.aesDecrypt(config.aesKey, config.IV, encGroupIdx);
         dto.setUpdateById(sesId);
-        dto.setGroupIdx(Integer.parseInt(groupIdx));
-        
         
         int rts = memberService.updateEditMember(dto);
         
-        
         return "redirect:/staff/info?staffId=" + dto.getId();
     }
     
@@ -248,7 +248,7 @@ public class StaffController extends LifeCenterController {
             @RequestParam(value="useYn", required=false, defaultValue="") String useYn,
             @RequestParam(value="page", required=false, defaultValue="1") int page,
             HttpServletRequest request, HttpServletResponse response) {
-        
+        String sesId  = LifeCenterSessionController.getSession( request, "sesId" );
         String sesCenterCode  = LifeCenterSessionController.getSession( request, "sesCenterCode" );
         
         if (selectState.equals("sId")) {
@@ -263,7 +263,7 @@ public class StaffController extends LifeCenterController {
         dto.setLimit( ( Integer.valueOf( page ) - 1 ) * config.pageDataSize );
         dto.setLimitMax( config.pageDataSize );
         
-        int total = memberService.selectMemeberListCount(dto);
+        int total = memberService.selectMemberListCount(dto);
         List<StaffDTO> list = new ArrayList<StaffDTO>();
         if (total > 0) {
             list = memberService.selectMemberList(dto);
@@ -279,6 +279,7 @@ public class StaffController extends LifeCenterController {
         mv.addObject("useYn", useYn);
         mv.addObject("item", list);
         mv.addObject("paging", paging);
+        mv.addObject( "sesId", sesId );
         
         return mv;
     }

+ 1 - 1
src/main/java/com/lemon/lifecenter/service/StaffService.java

@@ -18,7 +18,7 @@ public class StaffService {
         return mapper.selectMemberCount(dto);
     }
     
-    public int selectMemeberListCount(StaffDTO dto) {
+    public int selectMemberListCount(StaffDTO dto) {
         return mapper.selectMemberListCount(dto);
     }
     

+ 5 - 4
src/main/webapp/WEB-INF/jsp/staff/edit.jsp

@@ -89,13 +89,14 @@ $( function(){
                                             <tr>
                                                 <th>권한</th>
                                                 <td>
-                                                    <select class="custom-select" name="encGroupIdx">
+                                                    <c:if test="${info.groupIdx eq 1}">시스템관리자</c:if>
+                                                    <c:if test="${info.groupIdx eq 2}">관리자</c:if>
+                                                    <c:if test="${info.groupIdx eq 3}">일반사용자</c:if>
+                                                    <!-- select class="custom-select" name="encGroupIdx">
                                                         <c:forEach var="gl" items="${groupList}"> 
                                                             <option value="${gl.encryptIdx}" <c:if test="${gl.encryptIdx eq groupIdx}"> selected="selected" </c:if> ><c:out value="${gl.groupName}"/></option>
                                                         </c:forEach>
-                                                        <!-- <option selected="">센터-1</option>
-                                                        <option selected="">센터-2</option> -->
-                                                    </select>
+                                                    </select-->
                                                 </td>
                                                 <th>상태</th>
                                                 <td>

+ 18 - 3
src/main/webapp/WEB-INF/jsp/staff/info.jsp

@@ -61,7 +61,14 @@ function reset() {
                                     <div class="row mb-3">
                                         <div class="col-12">
                                             <div class="text-right">
-                                                <button class="btn btn-primary w100" onclick="location.href='./edit?staffId=${info.id}';">수정</button>
+                                                <c:if test="${info.id eq sesId}">
+                                                    <button class="btn btn-secondary w100" onclick="location.href='./myinfo';">내정보 변경</button>
+                                                </c:if>
+                                                
+                                                
+                                                <c:if test="${info.id ne sesId}">
+                                                    <button class="btn btn-secondary w100" onclick="location.href='./edit?staffId=${info.id}';">수정</button>
+                                                </c:if>
                                             </div>
                                         </div>
                                     </div>
@@ -94,8 +101,14 @@ function reset() {
                                             </td>
                                         </tr>
                                         <tr>
+                                            <th>권한</th>
+                                            <td>
+                                                <c:if test="${info.groupIdx eq 1}">시스템관리자</c:if>
+                                                <c:if test="${info.groupIdx eq 2}">관리자</c:if>
+                                                <c:if test="${info.groupIdx eq 3}">일반사용자</c:if>
+                                            </td>
                                             <th>상태</th>
-                                            <td colspan="3">
+                                            <td>
                                                 <c:choose>
                                                     <c:when test="${info.useYn == 'Y'}">
                                                         활성
@@ -131,7 +144,9 @@ function reset() {
                                     <div class="row mt-3">
                                         <div class="col-12">
                                             <div class="text-right">
-                                                <button class="btn btn-warning w150" onclick="reset();">비밀번호 초기화</button>
+                                                <c:if test="${info.id ne sesId}">
+                                                    <button class="btn btn-warning w150" onclick="reset();">비밀번호 초기화</button>
+                                                </c:if>
                                                 <button class="btn btn-primary w100" onclick="location.href='./list';">확인</button>
                                             </div>
                                         </div>

+ 7 - 3
src/main/webapp/WEB-INF/jsp/staff/list.jsp

@@ -126,16 +126,20 @@
                                                                 </td>
                                                                 <td><c:out value="${l.name}" /></td>
                                                                 <td><c:out value="${l.centerName}" /></td>
-                                                                <td><c:out value="${l.groupIdx}" /></td>
+                                                                <td>
+                                                                    <c:if test="${l.groupIdx eq 1}">시스템관리자</c:if>
+                                                                    <c:if test="${l.groupIdx eq 2}">관리자</c:if>
+                                                                    <c:if test="${l.groupIdx eq 3}">일반사용자</c:if>
+                                                                </td>
                                                                 <td><c:out value="${l.lastLoginTime}" /></td>
                                                                 <td><c:out value="${l.createDate}" /></td>
                                                                 <td>
                                                                     <c:choose>
                                                                         <c:when test="${l.useYn == 'Y'}">
-                                                                            활성
+                                                                            <span class="text-success">활성</span>
                                                                         </c:when>
                                                                         <c:otherwise>
-                                                                            비활성
+                                                                            <span class="text-danger">비활성</span>
                                                                         </c:otherwise>
                                                                     
                                                                     </c:choose>