mirror of
https://github.com/suhf/No1WMS.git
synced 2026-02-05 04:03:45 +09:00
계정 추가 및 개인 권한 설정 기능 추가
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package com.no1.wms.account;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.no1.wms.authority.AuthorityDto;
|
||||
import com.no1.wms.authority.AuthorityService;
|
||||
import com.no1.wms.utils.ConstantValues;
|
||||
@@ -9,7 +11,9 @@ import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import java.io.StringReader;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
@Controller
|
||||
@@ -73,9 +77,24 @@ public class AccountController {
|
||||
|
||||
@PostMapping("/update_process")
|
||||
@ResponseBody
|
||||
public String updateProcess(AccountDto dto, Gson gson){
|
||||
public String updateProcess(@RequestBody Map<String, Object> data, Gson gson){
|
||||
AuthorityDto personalAuthorityDto= gson.fromJson(data.get("personalAuthorityDto").toString(), AuthorityDto.class);
|
||||
|
||||
accountService.update(dto);
|
||||
|
||||
AccountDto accountDto = gson.fromJson(data.get("account").toString(), AccountDto.class);
|
||||
|
||||
System.out.println(accountDto);
|
||||
System.out.println(personalAuthorityDto);
|
||||
accountService.update(accountDto);
|
||||
authorityService.update(personalAuthorityDto);
|
||||
|
||||
return gson.toJson("s");
|
||||
}
|
||||
|
||||
@PostMapping("/reset_password")
|
||||
@ResponseBody
|
||||
public String resetPassword(AccountDto dto, Gson gson){
|
||||
accountService.resetPassword(dto);
|
||||
|
||||
return gson.toJson("s");
|
||||
}
|
||||
@@ -98,4 +117,15 @@ public class AccountController {
|
||||
return mav;
|
||||
}
|
||||
|
||||
@PostMapping("/show_personal_auth_modal")
|
||||
public ModelAndView showPersonalAuthModal(ModelAndView mav, AuthorityDto dto){
|
||||
//db에서 데이터 가져오는거 필요
|
||||
dto = authorityService.selectById(dto);
|
||||
|
||||
//
|
||||
mav.addObject("dto", dto);
|
||||
mav.setViewName("personal_auth");
|
||||
return mav;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -40,5 +40,4 @@ public class AccountDto {
|
||||
|
||||
@Builder.Default
|
||||
private Boolean activation = true;
|
||||
|
||||
}
|
||||
|
||||
@@ -25,4 +25,8 @@ public interface AccountMapper {
|
||||
List<DepartmentDto> selectDeptAll(Map<String, Object> m);
|
||||
|
||||
List<PositionDto> selectPosAll(Map<String, Object> m);
|
||||
|
||||
int resetPassword(AccountDto dto);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -57,5 +57,10 @@ public class AccountService {
|
||||
|
||||
return mapper.selectPosAll(map);
|
||||
}
|
||||
int resetPassword(AccountDto dto){
|
||||
return mapper.resetPassword(dto);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -30,9 +30,16 @@ public class AuthorityController {
|
||||
|
||||
@PostMapping("/read")
|
||||
public ModelAndView read(ModelAndView mav, AuthorityDto dto){
|
||||
dto = authorityService.selectById(dto);
|
||||
if( dto.getIsGroupAuthority() ) {
|
||||
dto = authorityService.selectById(dto);
|
||||
|
||||
mav.setViewName("/authority/update_group");
|
||||
}else{
|
||||
dto = authorityService.selectPersonalAuthorityById(dto);
|
||||
mav.setViewName("/authority/update_personal");
|
||||
}
|
||||
mav.addObject("dto", dto);
|
||||
mav.setViewName("/authority/update_group");
|
||||
System.out.println(dto);
|
||||
return mav;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.no1.wms.authority;
|
||||
|
||||
import com.no1.wms.account.AccountDto;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@@ -18,4 +19,6 @@ public interface AuthorityMapper {
|
||||
int update(AuthorityDto dto);
|
||||
|
||||
List<AuthorityDto> selectAll(Map<String, Object> m);
|
||||
|
||||
AuthorityDto selectPersonalAuthorityById(AuthorityDto dto);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.no1.wms.authority;
|
||||
|
||||
|
||||
import com.no1.wms.account.AccountDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -35,4 +36,10 @@ public class AuthorityService {
|
||||
}
|
||||
|
||||
public int update(AuthorityDto dto) { return mapper.update(dto); }
|
||||
|
||||
public AuthorityDto selectPersonalAuthorityById(AuthorityDto dto){
|
||||
return mapper.selectPersonalAuthorityById(dto);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user