기관/부서 관련 수정

master
mjkhan21 5 months ago
parent 95ddf1a469
commit d07b60bd6a

@ -21,7 +21,7 @@ public class Department extends AbstractEntity {
private String faxno;
/**
* () .
* .
* @return
*/
public String getSggID() {
@ -29,7 +29,7 @@ public class Department extends AbstractEntity {
}
/**
* () .
* .
* @param sggID
*/
public void setSggID(String sggID) {
@ -37,7 +37,7 @@ public class Department extends AbstractEntity {
}
/**
* () .
* .
* @return
*/
public String getDeptID() {
@ -45,7 +45,7 @@ public class Department extends AbstractEntity {
}
/**
* () .
* .
* @param deptID
*/
public void setDeptID(String deptID) {
@ -53,7 +53,7 @@ public class Department extends AbstractEntity {
}
/**
* () .
* .
* @return
*/
public String getInstCode() {
@ -61,7 +61,7 @@ public class Department extends AbstractEntity {
}
/**
* () .
* .
* @param instCode
*/
public void setInstCode(String instCode) {
@ -69,7 +69,7 @@ public class Department extends AbstractEntity {
}
/**
* () .
* .
* @return
*/
public String getName() {
@ -77,7 +77,7 @@ public class Department extends AbstractEntity {
}
/**
* () .
* .
* @param name
*/
public void setName(String name) {

@ -16,6 +16,8 @@ public class DepartmentQuery extends QueryRequest {
private static final long serialVersionUID = 1L;
/** 시군구 코드 */
private String sggID;
/** 기관 코드 */
private String instCode;
/** 부서 코드 */
private String[] deptIDs;
@ -35,6 +37,22 @@ public class DepartmentQuery extends QueryRequest {
return this;
}
/** .
* @return
*/
public String getInstCode() {
return instCode;
}
/** .
* @param instCode
* @return DepartmentQuery
*/
public DepartmentQuery setInstCode(String instCode) {
this.instCode = instCode;
return this;
}
/** .
* @return
*/

@ -60,7 +60,6 @@ public abstract class GenericUser extends User {
phoneNo,
faxNo,
mobilePhoneNo,
groupID,
status;
private int lockCount;
private String lockedDate;
@ -225,20 +224,6 @@ public abstract class GenericUser extends User {
this.mobilePhoneNo = mobilePhoneNo;
}
/** .
* @return
*/
public String getGroupID() {
return groupID;
}
/** .
* @param groupID
*/
public void setGroupID(String groupID) {
this.groupID = groupID;
}
/** .
* @return
*/

@ -8,8 +8,6 @@ public class ManagedUser extends GenericUser {
private String
empNo,
residentRegNo,
orgID,
deptCode,
birthday,
positionName,
certificateDn;
@ -47,34 +45,6 @@ public class ManagedUser extends GenericUser {
this.residentRegNo = residentNo;
}
/**ID .
* @return ID
*/
public String getOrgID() {
return orgID;
}
/**ID .
* @param orgID ID
*/
public void setOrgID(String orgID) {
this.orgID = orgID;
}
/** .
* @return
*/
public String getDeptCode() {
return deptCode;
}
/** .
* @param deptCode
*/
public void setDeptCode(String deptCode) {
this.deptCode = deptCode;
}
/** .
* @return
*/

@ -13,6 +13,8 @@ public class Sigungu extends AbstractEntity {
private String sggName;
/** 기관 코드 */
private String instCode;
/** 기관 구분 */
private String instType;
/** 기관 명 */
private String instName;
/** 기관 주소 */
@ -20,14 +22,14 @@ public class Sigungu extends AbstractEntity {
/** 기관 상세주소 */
private String instDetailAddress;
/** 기관 우편번호 */
private String instituteZipCode;
private String instZipCode;
/** 직인 파일 경로 */
private String officialSealFilepath;
/** 직인 파일 명 */
private String officialSealFilename;
/**
* () .
* .
* @return
*/
public String getSggID() {
@ -35,7 +37,7 @@ public class Sigungu extends AbstractEntity {
}
/**
* () .
* .
* @param id
*/
public void setSggID(String id) {
@ -43,7 +45,7 @@ public class Sigungu extends AbstractEntity {
}
/**
* () .
* .
* @return
*/
public String getSggName() {
@ -51,7 +53,7 @@ public class Sigungu extends AbstractEntity {
}
/**
* () .
* .
* @param name
*/
public void setSggName(String name) {
@ -59,7 +61,7 @@ public class Sigungu extends AbstractEntity {
}
/**
* () .
* .
* @return
*/
public String getInstCode() {
@ -67,15 +69,31 @@ public class Sigungu extends AbstractEntity {
}
/**
* () .
* .
* @param instituteCode
*/
public void setInstCode(String instituteCode) {
this.instCode = instituteCode;
}
/** .
* @return
*/
public String getInstType() {
return instType;
}
/** .
* @param instType
*/
public void setInstType(String instType) {
this.instType = instType;
}
/**
* () .
* .
* @return
*/
public String getInstName() {
@ -83,7 +101,7 @@ public class Sigungu extends AbstractEntity {
}
/**
* () .
* .
* @param instituteName
*/
public void setInstName(String instituteName) {
@ -126,16 +144,16 @@ public class Sigungu extends AbstractEntity {
* () .
* @return
*/
public String getInstituteZipCode() {
return instituteZipCode;
public String getInstZipCode() {
return instZipCode;
}
/**
* () .
* @param zipCode
*/
public void setInstituteZipCode(String zipCode) {
this.instituteZipCode = zipCode;
public void setInstZipCode(String zipCode) {
this.instZipCode = zipCode;
}
/**
@ -155,7 +173,7 @@ public class Sigungu extends AbstractEntity {
}
/**
* () .
* .
* @return
*/
public String getOfficialSealFilename() {
@ -163,7 +181,7 @@ public class Sigungu extends AbstractEntity {
}
/**
* () .
* .
* @param filename
*/
public void setOfficialSealFilename(String filename) {

@ -20,7 +20,6 @@ public class SigunguQuery extends QueryRequest {
/** 기관 코드 */
private String[] instCodes;
/** .
* @return
*/

@ -10,7 +10,7 @@ import cokr.xit.base.user.DepartmentQuery;
import cokr.xit.foundation.component.AbstractMapper;
import cokr.xit.foundation.data.DataObject;
/** DAO
/** DAO
*
* <p> :
*
@ -56,56 +56,51 @@ public interface DepartmentMapper extends AbstractMapper {
return !list.isEmpty() ? list.get(0) : null;
}
/** .
* @param params
* <ul><li>"department" - </li>
* <li>"currentUser" - </li>
* </ul>
* @return
*/
int insertDepartment(Map<String, Object> params);
List<DataObject> selectSggDepts();
/** .
/** .
* @param department
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
default boolean insert(Department department) {
return department != null && insertDepartment(params().set("department", department)) == 1;
}
/** .
* @param params
* <ul><li>"department" - </li>
* <li>"currentUser" - </li>
* </ul>
* @return
*/
int updateDepartment(Map<String, Object> params);
boolean insert(Department department);
/** .
/** .
* @param department
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
default boolean update(Department department) {
return department != null && updateDepartment(params().set("department", department)) == 1;
}
boolean update(Department department);
/** .
/** .
* @param params
* <ul><li>"department" - </li>
* <ul><li>"sggIDs" - </li>
* <li>"deptIDs" - </li>
* <li>"currentUser" - </li>
* </ul>
* @return
*/
int deleteDepartment(Map<String, Object> params);
int delete(Map<String, Object> params);
/** .
* @param sggIDs
* @param deptIDs
* @return
*/
default int delete(String[] sggIDs, String[] deptIDs) {
DataObject params = params();
if (!isEmpty(sggIDs))
params.put("sggIDs", sggIDs);
if (!isEmpty(deptIDs))
params.put("deptIDs", deptIDs);
return delete(params);
}
/** .
/** .
* @param department
* @return
* <ul><li> true</li>
@ -113,6 +108,6 @@ public interface DepartmentMapper extends AbstractMapper {
* </ul>
*/
default int delete(String sggID, String... deptIDs) {
return deleteDepartment(params().set("sggID", sggID).set("deptIDs", deptIDs));
return delete(isEmpty(sggID) ? null : new String[] {sggID}, deptIDs);
}
}

@ -28,6 +28,15 @@ public interface SigunguMapper extends AbstractMapper {
*/
List<DataObject> selectSigunguList(SigunguQuery req);
/** .
* @param sggID
* @return
*/
default DataObject selectSigunguInfo(String sggID) {
List<DataObject> list = selectSigunguList(new SigunguQuery().setSggIDs(sggID));
return !list.isEmpty() ? list.get(0) : null;
}
/** .
* @param req
* @return
@ -84,9 +93,7 @@ public interface SigunguMapper extends AbstractMapper {
* <li> false</li>
* </ul>
*/
default boolean insert(Sigungu sigungu) {
return sigungu != null && insertSigungu(params().set("sigungu", sigungu)) == 1;
}
boolean insert(Sigungu sigungu);
/** .
* @param params
@ -104,9 +111,7 @@ public interface SigunguMapper extends AbstractMapper {
* <li> false</li>
* </ul>
*/
default boolean update(Sigungu sigungu) {
return sigungu != null && updateSigungu(params().set("sigungu", sigungu)) == 1;
}
boolean update(Sigungu sigungu);
/** .
* @param params
@ -115,13 +120,13 @@ public interface SigunguMapper extends AbstractMapper {
* </ul>
* @return
*/
int deleteSigungu(Map<String, Object> params);
int delete(Map<String, Object> params);
/** .
* @param sggIDs
* @return
*/
default int delete(String... sggIDs) {
return !isEmpty(sggIDs) ? deleteSigungu(params().set("sggIDs", sggIDs)) : 0;
return !isEmpty(sggIDs) ? delete(params().set("sggIDs", sggIDs)) : 0;
}
}

@ -4,25 +4,51 @@ import java.util.List;
import cokr.xit.base.user.Department;
import cokr.xit.base.user.DepartmentQuery;
import cokr.xit.base.user.Sigungu;
import cokr.xit.base.user.SigunguQuery;
import cokr.xit.foundation.data.DataObject;
/** .
*
* <p> :
*
* <pre>
* ============ ============
* 2023-10-06 mjkhan
* ================================
* </pre>
*/
public interface DepartmentService {
/** /
* @author mjkhan
*/
public interface SigunguDepartmentService {
/** .
* @param req
* @return
*/
List<DataObject> getSigunguList(SigunguQuery req);
/** .
* @param sigungu
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
boolean create(Sigungu sigungu);
/** .
* @param sigungu
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
boolean update(Sigungu sigungu);
/** .
* @param sggIDs
* @return
*/
int remove(String... sggIDs);
/** .
* @param req
* @return
*/
List<DataObject> getDepartmentList(DepartmentQuery req);
List<DataObject> getSggDepts();
/** .
* @param department
* @return

@ -1,49 +0,0 @@
package cokr.xit.base.user.service;
import java.util.List;
import cokr.xit.base.user.Sigungu;
import cokr.xit.base.user.SigunguQuery;
import cokr.xit.foundation.data.DataObject;
/** .
*
* <p> :
*
* <pre>
* ============ ============
* 2023-10-06 mjkhan
* ================================
* </pre>
*/
public interface SigunguService {
/** .
* @param req
* @return
*/
List<DataObject> getSigunguList(SigunguQuery req);
/** .
* @param sigungu
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
boolean create(Sigungu sigungu);
/** .
* @param sigungu
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
boolean update(Sigungu sigungu);
/** .
* @param sggIDs
* @return
*/
int remove(String... sggIDs);
}

@ -12,7 +12,7 @@ import cokr.xit.base.user.dao.DepartmentMapper;
import cokr.xit.foundation.component.AbstractBean;
import cokr.xit.foundation.data.DataObject;
/** Bean
/** Bean
*
* <p> :
*
@ -24,7 +24,7 @@ import cokr.xit.foundation.data.DataObject;
*/
@Component("departmentBean")
public class DepartmentBean extends AbstractBean {
/** 부서 정보 정보 DAO */
/** 부서정보 DAO */
@Resource(name = "departmentMapper")
private DepartmentMapper departmentMapper;
@ -33,7 +33,7 @@ public class DepartmentBean extends AbstractBean {
* @return
*/
public List<DataObject> getDepartmentList(DepartmentQuery req) {
return departmentMapper.selectDepartmentList(req);
return departmentMapper.selectDepartmentList(req.setOrderBy("DEPT_CD"));
}
/** .
@ -54,7 +54,11 @@ public class DepartmentBean extends AbstractBean {
return departmentMapper.selectDepartment(sggID, deptID);
}
/** .
public List<DataObject> getSggDepts() {
return departmentMapper.selectSggDepts();
}
/** .
* @param department
* @return
* <ul><li> true</li>
@ -65,7 +69,7 @@ public class DepartmentBean extends AbstractBean {
return departmentMapper.insert(department);
}
/** .
/** .
* @param department
* @return
* <ul><li> true</li>
@ -76,7 +80,7 @@ public class DepartmentBean extends AbstractBean {
return departmentMapper.update(department);
}
/** .
/** .
* @param sggID
* @param deptIDs
* @return

@ -1,50 +0,0 @@
package cokr.xit.base.user.service.bean;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import cokr.xit.base.user.Department;
import cokr.xit.base.user.DepartmentQuery;
import cokr.xit.base.user.service.DepartmentService;
import cokr.xit.foundation.component.AbstractServiceBean;
import cokr.xit.foundation.data.DataObject;
/** .
*
* <p> :
*
* <pre>
* ============ ============
* 2023-10-06 mjkhan
* ================================
* </pre>
*/
@Service("departmentService")
public class DepartmentServiceBean extends AbstractServiceBean implements DepartmentService {
/** 부서 정보 정보 Bean */
@Resource(name = "departmentBean")
private DepartmentBean departmentBean;
@Override
public List<DataObject> getDepartmentList(DepartmentQuery req) {
return departmentBean.getDepartmentList(req);
}
@Override
public boolean create(Department department) {
return departmentBean.create(department);
}
@Override
public boolean update(Department department) {
return departmentBean.update(department);
}
@Override
public int remove(String sggID, String... deptIDs) {
return departmentBean.remove(sggID, deptIDs);
}
}

@ -8,6 +8,7 @@ import org.springframework.stereotype.Component;
import cokr.xit.base.user.Sigungu;
import cokr.xit.base.user.SigunguQuery;
import cokr.xit.base.user.dao.DepartmentMapper;
import cokr.xit.base.user.dao.SigunguMapper;
import cokr.xit.foundation.component.AbstractBean;
import cokr.xit.foundation.data.DataObject;
@ -27,13 +28,16 @@ public class SigunguBean extends AbstractBean {
/** 시군구 정보 DAO */
@Resource(name = "sigunguMapper")
private SigunguMapper sigunguMapper;
/** 시군구 정보 DAO */
@Resource(name = "departmentMapper")
private DepartmentMapper departmentMapper;
/** .
* @param req
* @return
*/
public List<DataObject> getSigunguList(SigunguQuery req) {
return sigunguMapper.selectSigunguList(req);
return sigunguMapper.selectSigunguList(req.setOrderBy("SGG_CD"));
}
/** .
@ -95,6 +99,8 @@ public class SigunguBean extends AbstractBean {
* @return
*/
public int remove(String... sggIDs) {
return sigunguMapper.delete(sggIDs);
return
departmentMapper.delete(sggIDs, null)
+ sigunguMapper.delete(sggIDs);
}
}

@ -0,0 +1,80 @@
package cokr.xit.base.user.service.bean;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import cokr.xit.base.user.Department;
import cokr.xit.base.user.DepartmentQuery;
import cokr.xit.base.user.Sigungu;
import cokr.xit.base.user.SigunguQuery;
import cokr.xit.base.user.service.SigunguDepartmentService;
import cokr.xit.foundation.component.AbstractServiceBean;
import cokr.xit.foundation.data.DataObject;
/** / .
*
* <p> :
*
* <pre>
* ============ ============
* 2023-10-06 mjkhan
* ================================
* </pre>
*/
@Service("sigunguDepartmentService")
public class SigunguDepartmentServiceBean extends AbstractServiceBean implements SigunguDepartmentService {
/** 시군구 정보 Bean */
@Resource(name = "sigunguBean")
private SigunguBean sigunguBean;
/** 부서 정보 정보 Bean */
@Resource(name = "departmentBean")
private DepartmentBean departmentBean;
@Override
public List<DataObject> getSigunguList(SigunguQuery req) {
return sigunguBean.getSigunguList(req);
}
@Override
public boolean create(Sigungu sigungu) {
return sigunguBean.create(sigungu);
}
@Override
public boolean update(Sigungu sigungu) {
return sigunguBean.update(sigungu);
}
@Override
public int remove(String... sggIDs) {
return sigunguBean.remove(sggIDs);
}
@Override
public List<DataObject> getDepartmentList(DepartmentQuery req) {
return departmentBean.getDepartmentList(req);
}
@Override
public List<DataObject> getSggDepts() {
return departmentBean.getSggDepts();
}
@Override
public boolean create(Department department) {
return departmentBean.create(department);
}
@Override
public boolean update(Department department) {
return departmentBean.update(department);
}
@Override
public int remove(String sggID, String... deptIDs) {
return departmentBean.remove(sggID, deptIDs);
}
}

@ -1,50 +0,0 @@
package cokr.xit.base.user.service.bean;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import cokr.xit.base.user.Sigungu;
import cokr.xit.base.user.SigunguQuery;
import cokr.xit.base.user.service.SigunguService;
import cokr.xit.foundation.component.AbstractServiceBean;
import cokr.xit.foundation.data.DataObject;
/** .
*
* <p> :
*
* <pre>
* ============ ============
* 2023-10-06 mjkhan
* ================================
* </pre>
*/
@Service("sigunguService")
public class SigunguServiceBean extends AbstractServiceBean implements SigunguService {
/** 시군구 정보 Bean */
@Resource(name = "sigunguBean")
private SigunguBean sigunguBean;
@Override
public List<DataObject> getSigunguList(SigunguQuery req) {
return sigunguBean.getSigunguList(req);
}
@Override
public boolean create(Sigungu sigungu) {
return sigunguBean.create(sigungu);
}
@Override
public boolean update(Sigungu sigungu) {
return sigunguBean.update(sigungu);
}
@Override
public int remove(String... sggIDs) {
return sigunguBean.remove(sggIDs);
}
}

@ -89,6 +89,9 @@ public class UserBean extends AbstractBean {
throw applicationException(null)
.setMessage(message("duplicate.object", "사용자"));
if (isEmpty(user.getInstitute()))
user.setInstitute(currentUser().getInstitute());
String password = user.getPassword();
user.setPassword(passwordEncoder.encode(password));
user.setCreatedBy(currentUser().getId());

@ -1,104 +0,0 @@
package cokr.xit.base.user.web;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import cokr.xit.base.user.Department;
import cokr.xit.base.user.DepartmentQuery;
import cokr.xit.base.user.service.DepartmentService;
import cokr.xit.foundation.web.AbstractController;
/**
*
* <p> :
*
* <pre>
* ============ ============
* 2023-10-06 mjkhan
* ================================
* </pre>
*/
@RequestMapping(name = "부서 정보", value = "/department")
public class DepartmentController extends AbstractController {
/**부서 정보 서비스*/
@Resource(name = "departmentService")
private DepartmentService departmentService;
/** (department/department-main) .
* {@link #getDepartmentList(DepartmentQuery) } .
* @return /department/department-main
*/
@RequestMapping(name = "부서 정보 메인", value = "/main.do")
public ModelAndView main() {
ModelAndView mav = getDepartmentList(new DepartmentQuery().setPageNum(1));
mav.setViewName("/department/department-main");
return mav.addObject("departmentList", toJson(mav.getModel().get("departmentList")));
}
/** .<br />
* {@link DepartmentService#getDepartmentList(DepartmentQuery)}
* @param req
* @return jsonView
* <pre><code> {
* "departmentList": [ ]
* "departmentStart":
* "departmentFetch":
* "departmentTotal":
* }</code></pre>
*/
@RequestMapping(name = "부서 정보 조회", value = "/list.do")
public ModelAndView getDepartmentList(DepartmentQuery req) {
List<?> result = departmentService.getDepartmentList(setFetchSize(req));
return setCollectionInfo(new ModelAndView("jsonView"), result, "department");
}
/** .
* @param department
* @return jsonView
* <pre><code> {
* "saved": true, false
* }</code></pre>
*/
@PostMapping(name = "부서 정보 등록", value = "/create.do")
public ModelAndView create(Department department) {
boolean saved = departmentService.create(department);
return new ModelAndView("jsonView")
.addObject("saved", saved);
}
/** .
* @param department
* @return jsonView
* <pre><code> {
* "saved": true, false
* }</code></pre>
*/
@PostMapping(name = "부서 정보 수정", value = "/update.do")
public ModelAndView update(Department department) {
boolean saved = departmentService.update(department);
return new ModelAndView("jsonView")
.addObject("saved", saved);
}
/** .
* @param sggID
* @param deptIDs
* @return jsonView
* <pre><code> {
* "affected":
* "saved": true, false
* }</code></pre>
*/
@PostMapping(name = "부서 정보 제거", value = "/remove.do")
public ModelAndView remove(String sggID, String... deptIDs) {
int affected = departmentService.remove(sggID, deptIDs);
return new ModelAndView("jsonView")
.addObject("affected", affected)
.addObject("saved", affected > 0);
}
}

@ -1,103 +0,0 @@
package cokr.xit.base.user.web;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import cokr.xit.base.user.Sigungu;
import cokr.xit.base.user.SigunguQuery;
import cokr.xit.base.user.service.SigunguService;
import cokr.xit.foundation.web.AbstractController;
/**
*
* <p> :
*
* <pre>
* ============ ============
* 2023-10-06 mjkhan
* ================================
* </pre>
*/
@RequestMapping(name = "시군구", value = "/sigungu")
public class SigunguController extends AbstractController {
/**시군구 서비스*/
@Resource(name = "sigunguService")
private SigunguService sigunguService;
/** (sigungu/sigungu-main) .
* {@link #getSigunguList(SigunguQuery) } .
* @return /sigungu/sigungu-main
*/
@RequestMapping(name = "시군구 메인", value = "/main.do")
public ModelAndView main() {
ModelAndView mav = getSigunguList(new SigunguQuery().setPageNum(1));
mav.setViewName("/sigungu/sigungu-main");
return mav.addObject("sigunguList", toJson(mav.getModel().get("sigunguList")));
}
/** .<br />
* {@link SigunguService#getSigunguList(SigunguQuery)}
* @param req
* @return jsonView
* <pre><code> {
* "sigunguList": [ ]
* "sigunguStart":
* "sigunguFetch":
* "sigunguTotal":
* }</code></pre>
*/
@RequestMapping(name = "시군구 조회", value = "/list.do")
public ModelAndView getSigunguList(SigunguQuery req) {
List<?> result = sigunguService.getSigunguList(setFetchSize(req));
return setCollectionInfo(new ModelAndView("jsonView"), result, "sigungu");
}
/** .
* @param sigungu
* @return jsonView
* <pre><code> {
* "saved": true, false
* }</code></pre>
*/
@PostMapping(name = "시군구 등록", value = "/create.do")
public ModelAndView create(Sigungu sigungu) {
boolean saved = sigunguService.create(sigungu);
return new ModelAndView("jsonView")
.addObject("saved", saved);
}
/** .
* @param sigungu
* @return jsonView
* <pre><code> {
* "saved": true, false
* }</code></pre>
*/
@PostMapping(name = "시군구 수정", value = "/update.do")
public ModelAndView update(Sigungu sigungu) {
boolean saved = sigunguService.update(sigungu);
return new ModelAndView("jsonView")
.addObject("saved", saved);
}
/** .
* @param sigunguIDs
* @return jsonView
* <pre><code> {
* "affected":
* "saved": true, false
* }</code></pre>
*/
@PostMapping(name = "시군구 제거", value = "/remove.do")
public ModelAndView remove(String... sggIDs) {
int affected = sigunguService.remove(sggIDs);
return new ModelAndView("jsonView")
.addObject("affected", affected)
.addObject("saved", affected > 0);
}
}

@ -0,0 +1,180 @@
package cokr.xit.base.user.web;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import cokr.xit.base.user.Department;
import cokr.xit.base.user.DepartmentQuery;
import cokr.xit.base.user.Sigungu;
import cokr.xit.base.user.SigunguQuery;
import cokr.xit.base.user.service.SigunguDepartmentService;
import cokr.xit.foundation.data.DataObject;
import cokr.xit.foundation.web.AbstractController;
@RequestMapping(name = "시군구 부서정보", value = "/user")
public class SigunguDepartmentController<S extends Sigungu, D extends Department> extends AbstractController {
/**시군구 / 부서 서비스*/
@Resource(name = "sigunguDepartmentService")
private SigunguDepartmentService sggDeptService;
@RequestMapping(name = "시군구 부서 메인", value = "/sgg-dept.do")
public ModelAndView main() {
ModelAndView mav = getSigunguList(new SigunguQuery().setPageNum(1).setIncludeAll(true));
mav.setViewName("base/user/sgg-dept");
Map<String, Object> model = mav.getModel();
mav.addObject("sggList", toJson(model.remove("sggList")));
mav.addObject("deptList", toJson(model.remove("deptList")));
return mav;
}
/** .<br />
* {@link SigunguService#getSigunguList(SigunguQuery)}
* @param req
* @return jsonView
* <pre><code> {
* "sggList": [ ]
* "sggStart":
* "sggFetch":
* "sggTotal":
* }</code></pre>
*/
@RequestMapping(name = "시군구 조회", value = "/sgg/list.do")
public ModelAndView getSigunguList(SigunguQuery req) {
List<DataObject> sggList = sggDeptService.getSigunguList(setFetchSize(req));
ModelAndView mav = setCollectionInfo(new ModelAndView("jsonView"), sggList, "sgg");
String sggID = !sggList.isEmpty() ? sggList.get(0).string("SGG_CD") : "";
return mav.addAllObjects(getDepartmentList(new DepartmentQuery().setSggID(sggID)).getModel());
}
@RequestMapping(name = "시군구 정보", value = "/sgg/info.do")
public ModelAndView getSigunguInfo() {
return new ModelAndView("base/user/sgg-info");
}
/** .
* @param sigungu
* @return jsonView
* <pre><code> {
* "saved": true, false
* }</code></pre>
*/
@PostMapping(name = "시군구 등록", value = "/sgg/create.do")
public ModelAndView create(S sigungu) {
boolean saved = sggDeptService.create(sigungu);
return new ModelAndView("jsonView")
.addObject("saved", saved);
}
/** .
* @param sigungu
* @return jsonView
* <pre><code> {
* "saved": true, false
* }</code></pre>
*/
@PostMapping(name = "시군구 수정", value = "/sgg/update.do")
public ModelAndView update(S sigungu) {
boolean saved = sggDeptService.update(sigungu);
return new ModelAndView("jsonView")
.addObject("saved", saved);
}
/** .
* @param sigunguIDs
* @return jsonView
* <pre><code> {
* "affected":
* "saved": true, false
* }</code></pre>
*/
@PostMapping(name = "시군구 제거", value = "/sgg/remove.do")
public ModelAndView remove(String... sggIDs) {
int affected = sggDeptService.remove(sggIDs);
return new ModelAndView("jsonView")
.addObject("affected", affected)
.addObject("saved", affected > 0);
}
/** .<br />
* {@link DepartmentService#getDepartmentList(DepartmentQuery)}
* @param req
* @return jsonView
* <pre><code> {
* "deptList": [ ]
* "deptStart":
* "deptFetch":
* "deptTotal":
* }</code></pre>
*/
@RequestMapping(name = "부서정보 조회", value = "/dept/list.do")
public ModelAndView getDepartmentList(DepartmentQuery req) {
List<?> result = sggDeptService.getDepartmentList(setFetchSize(req));
return setCollectionInfo(new ModelAndView("jsonView"), result, "dept");
}
@RequestMapping(name = "시군구 부서 선택", value = "/dept/select.do")
public ModelAndView selectSggDepts() {
List<DataObject> list = sggDeptService.getSggDepts();
for (int i = 0; i < list.size(); ++i)
list.get(i).put("dataKey", i + 1);
return new ModelAndView("base/user/select-sggDepts").addObject("sggDepts", toJson(list));
}
@RequestMapping(name = "부서정보", value = "/dept/info.do")
public ModelAndView getDepartmentInfo() {
return new ModelAndView("base/user/dept-info");
}
/** .
* @param department
* @return jsonView
* <pre><code> {
* "saved": true, false
* }</code></pre>
*/
@PostMapping(name = "부서정보 등록", value = "/dept/create.do")
public ModelAndView create(D department) {
boolean saved = sggDeptService.create(department);
return new ModelAndView("jsonView")
.addObject("saved", saved);
}
/** .
* @param department
* @return jsonView
* <pre><code> {
* "saved": true, false
* }</code></pre>
*/
@PostMapping(name = "부서정보 수정", value = "/dept/update.do")
public ModelAndView update(D department) {
boolean saved = sggDeptService.update(department);
return new ModelAndView("jsonView")
.addObject("saved", saved);
}
/** .
* @param sggID
* @param deptIDs
* @return jsonView
* <pre><code> {
* "affected":
* "saved": true, false
* }</code></pre>
*/
@PostMapping(name = "부서정보 제거", value = "/dept/remove.do")
public ModelAndView remove(String sggID, String... deptIDs) {
int affected = sggDeptService.remove(sggID, deptIDs);
return new ModelAndView("jsonView")
.addObject("affected", affected)
.addObject("saved", affected > 0);
}
}

@ -8,7 +8,10 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import cokr.xit.base.user.DepartmentQuery;
import cokr.xit.base.user.SigunguQuery;
import cokr.xit.base.user.UserQuery;
import cokr.xit.base.user.service.SigunguDepartmentService;
import cokr.xit.base.user.service.UserService;
import cokr.xit.foundation.User;
import cokr.xit.foundation.data.DataObject;
@ -24,6 +27,8 @@ public class UserController<U extends User> extends AbstractController {
/**사용자 서비스*/
@Resource(name="userService")
private UserService userService;
@Resource(name="sigunguDepartmentService")
private SigunguDepartmentService sggDeptService;
protected UserService userService() {
return userService;
@ -96,13 +101,26 @@ public class UserController<U extends User> extends AbstractController {
*/
@RequestMapping(name="사용자 정보 조회", value="/info.do")
public ModelAndView getInfo(String userID) {
boolean json = !isEmpty(userID) && jsonResponse();
String
viewName = json ? "jsonView" : "base/user/user-info",
institute = currentUser().getInstitute();
List<DataObject>
sggs = sggDeptService.getSigunguList(new SigunguQuery()),
depts = sggDeptService.getDepartmentList(new DepartmentQuery().setInstCode(institute));
if (!isEmpty(userID)) {
DataObject userInfo = userService.getUserInfo(userID);
boolean json = jsonResponse();
return new ModelAndView(json ? "jsonView" : "base/user/user-info")
.addObject("userInfo", json ? userInfo : toJson(userInfo));
return new ModelAndView(viewName)
.addObject("userInfo", json ? userInfo : toJson(userInfo))
.addObject("sggs", json ? sggs : toJson(sggs))
.addObject("depts", json ? depts : toJson(depts))
.addObject("institute", institute);
} else {
return new ModelAndView("base/user/user-info");
return new ModelAndView("base/user/user-info")
.addObject("sggs", toJson(sggs))
.addObject("depts", toJson(depts))
.addObject("institute", institute);
}
}

@ -0,0 +1,111 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cokr.xit.base.user.dao.DepartmentMapper">
<!-- 부서 정보 정보 매퍼
========== 변경 이력 ==========
2023-10-06 mjkhan 최초 작성
============================ -->
<resultMap id="deptRow" type="cokr.xit.base.user.Department"> <!-- 부서 정보 -->
<result property="deptID" column="DEPT_CD" /> <!-- 부서 코드 -->
<result property="sggID" column="SGG_CD" /> <!-- 시군구 코드 -->
<result property="instCode" column="INST_CD" /> <!-- 기관 코드 -->
<result property="name" column="DEPT_NM" /> <!-- 부서 명 -->
<result property="telno" column="DEPT_TELNO" /> <!-- 부서 전화번호 -->
<result property="faxno" column="DEPT_FXNO" /> <!-- 부서 팩스번호 -->
<result property="useYN" column="USE_YN" /> <!-- 사용 여부 -->
<result property="createdAt" column="REG_DT" /> <!-- 등록 일시 -->
<result property="createdBy" column="RGTR" /> <!-- 등록자 -->
<result property="lastModified" column="MDFCN_DT" /> <!-- 수정 일시 -->
<result property="modifiedBy" column="MDFR" /> <!-- 수정자 -->
</resultMap>
<sql id="select">SELECT DEPT_CD <!-- 부서 코드 -->
, SGG_CD <!-- 시군구 코드 -->
, INST_CD <!-- 기관 코드 -->
, DEPT_NM <!-- 부서 명 -->
, DEPT_TELNO <!-- 부서 전화번호 -->
, DEPT_FXNO <!-- 부서 팩스번호 -->
, USE_YN <!-- 사용 여부 -->
, REG_DT <!-- 등록 일시 -->
, RGTR <!-- 등록자 -->
, MDFCN_DT <!-- 수정 일시 -->
, MDFR <!-- 수정자 -->
FROM TB_DEPT</sql>
<select id="selectDepartmentList" parameterType="map" resultType="dataobject">/* 부서 정보 목록 조회(departmentMapper.selectDepartmentList) */
<include refid="utility.paging-prefix" />
<include refid="select" />
<where><if test="by != null and term != null"> AND ${by} LIKE CONCAT('%', #{term}, '%')</if>
<if test="sggID != null"> AND SGG_CD = #{sggID}</if>
<if test="instCode != null"> AND INST_CD = #{instCode}</if>
<if test="deptIDs != null"> AND DEPT_CD IN (<foreach collection="deptIDs" item="deptID" separator=",">#{deptID}</foreach>)</if>
<if test="!includeAll"> AND USE_YN = 'Y'</if>
</where>
<include refid="utility.orderBy" />
<include refid="utility.paging-suffix" /></select>
<select id="selectDepartments" parameterType="map" resultMap="deptRow">/* 부서 정보 객체 가져오기(departmentMapper.selectDepartments) */
<include refid="select" />
WHERE SGG_CD = #{sggID}
<if test="deptIDs != null">AND DEPT_CD IN (<foreach collection="deptIDs" item="deptID" separator=",">#{deptID}</foreach>)</if>
<include refid="utility.orderBy" /></select>
<sql id="sggDepts">SELECT A.SGG_CD, SGG_NM, A.INST_CD, INST_NM, DEPT_CD, DEPT_NM
FROM TB_SGG A, TB_DEPT B
WHERE A.USE_YN = 'Y'
AND B.USE_YN = 'Y'
AND A.SGG_CD = B.SGG_CD
AND A.INST_CD = B.INST_CD</sql>
<select id="selectSggDepts" resultType="dataobject"><include refid="sggDepts" />
ORDER BY A.SGG_CD, A.INST_CD, DEPT_CD</select>
<insert id="insert" parameterType="cokr.xit.base.user.Department">/* 부서 정보 등록(departmentMapper.insert) */
INSERT INTO TB_DEPT (
DEPT_CD <!-- 부서 코드 -->
, SGG_CD <!-- 시군구 코드 -->
, INST_CD <!-- 기관 코드 -->
, DEPT_NM <!-- 부서 명 -->
, DEPT_TELNO <!-- 부서 전화번호 -->
, DEPT_FXNO <!-- 부서 팩스번호 -->
, USE_YN <!-- 사용 여부 -->
, REG_DT <!-- 등록 일시 -->
, RGTR <!-- 등록자 -->
, MDFCN_DT <!-- 수정 일시 -->
, MDFR <!-- 수정자 -->
) VALUES (
#{deptID} <!-- 부서 코드 -->
, #{sggID} <!-- 시군구 코드 -->
, #{instCode} <!-- 기관 코드 -->
, #{name} <!-- 부서 명 -->
, #{telno} <!-- 부서 전화번호 -->
, #{faxno} <!-- 부서 팩스번호 -->
, #{useYN} <!-- 사용 여부 -->
, #{createdAt} <!-- 등록 일시 -->
, #{createdBy} <!-- 등록자 -->
, #{lastModified} <!-- 수정 일시 -->
, #{modifiedBy} <!-- 수정자 -->
)</insert>
<update id="update" parameterType="cokr.xit.base.user.Department">/* 부서 정보 수정(departmentMapper.update) */
UPDATE TB_DEPT
SET SGG_CD = #{sggID} <!-- 시군구 코드 -->
, INST_CD = #{instCode} <!-- 기관 코드 -->
, DEPT_NM = #{name} <!-- 부서 명 -->
, DEPT_TELNO = #{telno} <!-- 부서 전화번호 -->
, DEPT_FXNO = #{faxno} <!-- 부서 팩스번호 -->
, MDFCN_DT = #{lastModified} <!-- 수정 일시 -->
, MDFR = #{modifiedBy} <!-- 수정자 -->
WHERE DEPT_CD = #{deptID}</update>
<update id="delete" parameterType="map">/* 부서 정보 삭제(departmentMapper.deleteDepartment) */
UPDATE TB_DEPT
SET USE_YN = 'N'
, MDFCN_DT =<include refid="utility.now" />
, MDFR = #{currentUser.id}
<where><if test="sggIDs != null"> AND SGG_CD IN (<foreach collection="sggIDs" item="sggID" separator=",">#{sggID}</foreach>)</if>
<if test="deptIDs != null"> AND DEPT_CD IN (<foreach collection="deptIDs" item="deptID" separator=",">#{deptID}</foreach>)</if></where></update>
</mapper>

@ -0,0 +1,121 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cokr.xit.base.user.dao.SigunguMapper">
<!-- 시군구 정보 매퍼
========== 변경 이력 ==========
2023-10-06 mjkhan 최초 작성
============================ -->
<resultMap id="sggRow" type="cokr.xit.base.user.Sigungu"> <!-- 시군구 -->
<result property="sggID" column="SGG_CD" /> <!-- 시군구 코드 -->
<result property="sggName" column="SGG_NM" /> <!-- 시군구 이름 -->
<result property="instCode" column="INST_CD" /> <!-- 기관 코드 -->
<result property="instType" column="INST_SE_CD" /> <!-- 기관 구분 -->
<result property="instName" column="INST_NM" /> <!-- 기관 명 -->
<result property="instAddress" column="INST_ADDR" /> <!-- 기관 주소 -->
<result property="instDetailAddress" column="INST_DADDR" /> <!-- 기관 상세주소 -->
<result property="instZipCode" column="INST_ZIP" /> <!-- 기관 우편번호 -->
<result property="officialSealFilepath" column="OFFCS_FILE_PATH" /> <!-- 직인 파일 경로 -->
<result property="officialSealFilename" column="OFFCS_FILE_NM" /> <!-- 직인 파일 명 -->
<result property="useYN" column="USE_YN" /> <!-- 사용 여부 -->
<result property="createdAt" column="REG_DT" /> <!-- 등록 일시 -->
<result property="createdBy" column="RGTR" /> <!-- 등록자 -->
<result property="lastModified" column="MDFCN_DT" /> <!-- 수정 일시 -->
<result property="modifiedBy" column="MDFR" /> <!-- 수정자 -->
</resultMap>
<sql id="select">SELECT SGG_CD <!-- 시군구 코드 -->
, SGG_NM <!-- 시군구 이름 -->
, INST_CD <!-- 기관 코드 -->
, INST_SE_CD <!-- 기관 구분 -->
, INST_NM <!-- 기관 명 -->
, INST_ADDR <!-- 기관 주소 -->
, INST_DADDR <!-- 기관 상세주소 -->
, INST_ZIP <!-- 기관 우편번호 -->
, OFFCS_FILE_PATH <!-- 직인 파일 경로 -->
, OFFCS_FILE_NM <!-- 직인 파일 명 -->
, USE_YN <!-- 사용 여부 -->
, REG_DT <!-- 등록 일시 -->
, RGTR <!-- 등록자 -->
, MDFCN_DT <!-- 수정 일시 -->
, MDFR <!-- 수정자 -->
FROM TB_SGG</sql>
<select id="selectSigunguList" parameterType="map" resultType="dataobject">/* 시군구 목록 조회(sigunguMapper.selectSigunguList) */
<include refid="utility.paging-prefix" />
<include refid="select" />
<where><if test="by != null and term != null"> AND ${by} LIKE CONCAT('%', #{term}, '%')</if>
<if test="sggIDs != null"> AND SGG_CD IN (<foreach collection="sggIDs" item="sggID" separator=",">#{sggID}</foreach>)</if>
<if test="instCodes != null"> AND INST_CD IN (<foreach collection="instCodes" item="instCode" separator=",">#{instCode}</foreach>)</if>
<if test="!includeAll">AND USE_YN = 'Y'</if></where>
<include refid="utility.orderBy" />
<include refid="utility.paging-suffix" /></select>
<select id="selectSigungus" parameterType="map" resultMap="sggRow">/* 시군구 객체 가져오기(sigunguMapper.selectSigungus) */
<include refid="select" />
<where><if test="by != null and term != null"> AND ${by} LIKE CONCAT('%', #{term}, '%')</if>
<if test="sggIDs != null">AND SGG_CD IN (<foreach collection="sggIDs" item="sggID" separator=",">#{sggID}</foreach>)</if>
<if test="instCodes != null">AND INST_CD IN (<foreach collection="instCodes" item="instCode" separator=",">#{instCode}</foreach>)</if>
<if test="!includeAll"> AND USE_YN = 'Y'</if></where>
</select>
<insert id="insert" parameterType="cokr.xit.base.user.Sigungu">/* 시군구 등록(sigunguMapper.insert) */
INSERT INTO TB_SGG (
SGG_CD <!-- 시군구 코드 -->
, SGG_NM <!-- 시군구 이름 -->
, INST_CD <!-- 기관 코드 -->
, INST_SE_CD <!-- 기관 구분 -->
, INST_NM <!-- 기관 명 -->
, INST_ADDR <!-- 기관 주소 -->
, INST_DADDR <!-- 기관 상세주소 -->
, INST_ZIP <!-- 기관 우편번호 -->
, OFFCS_FILE_PATH <!-- 직인 파일 경로 -->
, OFFCS_FILE_NM <!-- 직인 파일 명 -->
, USE_YN <!-- 사용 여부 -->
, REG_DT <!-- 등록 일시 -->
, RGTR <!-- 등록자 -->
, MDFCN_DT <!-- 수정 일시 -->
, MDFR <!-- 수정자 -->
) VALUES (
#{sggID} <!-- 시군구 코드 -->
, #{sggName} <!-- 시군구 이름 -->
, #{instCode} <!-- 기관 코드 -->
, #{instType} <!-- 기관 구분 -->
, #{instName} <!-- 기관 명 -->
, #{instAddress} <!-- 기관 주소 -->
, #{instDetailAddress} <!-- 기관 상세주소 -->
, #{instZipCode} <!-- 기관 우편번호 -->
, #{officialSealFilepath} <!-- 직인 파일 경로 -->
, #{officialSealFilename} <!-- 직인 파일 명 -->
, #{useYN} <!-- 사용 여부 -->
, #{createdAt} <!-- 등록 일시 -->
, #{createdBy} <!-- 등록자 -->
, #{lastModified} <!-- 수정 일시 -->
, #{modifiedBy} <!-- 수정자 -->
)</insert>
<update id="update" parameterType="cokr.xit.base.user.Sigungu">/* 시군구 수정(sigunguMapper.update) */
UPDATE TB_SGG
SET INST_CD = #{instCode} <!-- 기관 코드 -->
, INST_SE_CD = #{instType} <!-- 기관 구분 -->
, SGG_NM = #{sggName} <!-- 시군구 이름 -->
, INST_NM = #{instName} <!-- 기관 명 -->
, INST_ADDR = #{instAddress} <!-- 기관 주소 -->
, INST_DADDR = #{instDetailAddress} <!-- 기관 상세주소 -->
, INST_ZIP = #{instZipCode} <!-- 기관 우편번호 -->
, OFFCS_FILE_PATH = #{officialSealFilepath} <!-- 직인 파일 경로 -->
, OFFCS_FILE_NM = #{officialSealFilename} <!-- 직인 파일 명 -->
, USE_YN = #{useYN} <!-- 사용 여부 -->
, MDFCN_DT = #{lastModified} <!-- 수정 일시 -->
, MDFR = #{modifiedBy} <!-- 수정자 -->
WHERE SGG_CD = #{sggID}</update>
<update id="delete" parameterType="map">/* 시군구 삭제(sigunguMapper.delete) */
UPDATE TB_SGG
SET USE_YN = 'N'
, MDFCN_DT =<include refid="utility.now" />
, MDFR = #{currentUser.id}
WHERE SGG_CD IN (<foreach collection="sggIDs" item="sggID" separator=",">#{sggID}</foreach>)</update>
</mapper>
Loading…
Cancel
Save