시군구 관리, 부서 관리 추가

master
mjkhan21 1 year ago
parent 0a9daa171c
commit 21a210300d

@ -0,0 +1,118 @@
package cokr.xit.base.user;
import cokr.xit.foundation.AbstractEntity;
/**
*
* @author mjkhan
*/
public class Department extends AbstractEntity {
/** 시군구 코드 */
private String sggID;
/** 기관 코드 */
private String instCode;
/** 부서 코드 */
private String deptID;
/** 부서 명 */
private String name;
/** 부서 전화번호 */
private String telno;
/** 부서 팩스번호 */
private String faxno;
/**
* () .
* @return
*/
public String getSggID() {
return sggID;
}
/**
* () .
* @param sggID
*/
public void setSggID(String sggID) {
this.sggID = sggID;
}
/**
* () .
* @return
*/
public String getDeptID() {
return deptID;
}
/**
* () .
* @param deptID
*/
public void setDeptID(String deptID) {
this.deptID = deptID;
}
/**
* () .
* @return
*/
public String getInstCode() {
return instCode;
}
/**
* () .
* @param instCode
*/
public void setInstCode(String instCode) {
this.instCode = instCode;
}
/**
* () .
* @return
*/
public String getName() {
return name;
}
/**
* () .
* @param name
*/
public void setName(String name) {
this.name = name;
}
/**
* () .
* @return
*/
public String getTelno() {
return telno;
}
/**
* () .
* @param telno
*/
public void setTelno(String telno) {
this.telno = telno;
}
/**
* () .
* @return
*/
public String getFaxno() {
return faxno;
}
/**
* () .
* @param faxno
*/
public void setFaxno(String faxno) {
this.faxno = faxno;
}
}

@ -0,0 +1,53 @@
package cokr.xit.base.user;
import cokr.xit.foundation.component.QueryRequest;
/**
*
* <p> :
*
* <pre>
* ============ ============
* 2023-10-06 mjkhan
* ================================
* </pre>
*/
public class DepartmentQuery extends QueryRequest {
private static final long serialVersionUID = 1L;
/** 시군구 코드 */
private String sggID;
/** 부서 코드 */
private String[] deptIDs;
/** .
* @return
*/
public String getSggID() {
return sggID;
}
/** .
* @param sggID
* @return DepartmentQuery
*/
public DepartmentQuery setSggID(String sggID) {
this.sggID = sggID;
return this;
}
/** .
* @return
*/
public String[] getDeptIDs() {
return ifEmpty(deptIDs, () -> null);
}
/** .
* @param deptIDs
* @return DepartmentQuery
*/
public DepartmentQuery setDeptIDs(String... deptIDs) {
this.deptIDs = deptIDs;
return this;
}
}

@ -0,0 +1,172 @@
package cokr.xit.base.user;
import cokr.xit.foundation.AbstractEntity;
/**
*
* @author mjkhan
*/
public class Sigungu extends AbstractEntity {
/** 시군구 코드 */
private String sggID;
/** 시군구 이름 */
private String sggName;
/** 기관 코드 */
private String instCode;
/** 기관 명 */
private String instName;
/** 기관 주소 */
private String instAddress;
/** 기관 상세주소 */
private String instDetailAddress;
/** 기관 우편번호 */
private String instituteZipCode;
/** 직인 파일 경로 */
private String officialSealFilepath;
/** 직인 파일 명 */
private String officialSealFilename;
/**
* () .
* @return
*/
public String getSggID() {
return sggID;
}
/**
* () .
* @param id
*/
public void setSggID(String id) {
this.sggID = id;
}
/**
* () .
* @return
*/
public String getSggName() {
return sggName;
}
/**
* () .
* @param name
*/
public void setSggName(String name) {
this.sggName = name;
}
/**
* () .
* @return
*/
public String getInstCode() {
return instCode;
}
/**
* () .
* @param instituteCode
*/
public void setInstCode(String instituteCode) {
this.instCode = instituteCode;
}
/**
* () .
* @return
*/
public String getInstName() {
return instName;
}
/**
* () .
* @param instituteName
*/
public void setInstName(String instituteName) {
this.instName = instituteName;
}
/**
* () .
* @return
*/
public String getInstAddress() {
return instAddress;
}
/**
* () .
* @param address
*/
public void setInstAddress(String address) {
this.instAddress = address;
}
/**
* () .
* @return
*/
public String getInstDetailAddress() {
return instDetailAddress;
}
/**
* () .
* @param detailAddress
*/
public void setInstDetailAddress(String detailAddress) {
this.instDetailAddress = detailAddress;
}
/**
* () .
* @return
*/
public String getInstituteZipCode() {
return instituteZipCode;
}
/**
* () .
* @param zipCode
*/
public void setInstituteZipCode(String zipCode) {
this.instituteZipCode = zipCode;
}
/**
* () .
* @return
*/
public String getOfficialSealFilepath() {
return officialSealFilepath;
}
/**
* () .
* @param filepath
*/
public void setOfficialSealFilepath(String filepath) {
this.officialSealFilepath = filepath;
}
/**
* () .
* @return
*/
public String getOfficialSealFilename() {
return officialSealFilename;
}
/**
* () .
* @param filename
*/
public void setOfficialSealFilename(String filename) {
this.officialSealFilename = filename;
}
}

@ -0,0 +1,56 @@
package cokr.xit.base.user;
import cokr.xit.foundation.component.QueryRequest;
/**
*
* <p> :
*
* <pre>
* ============ ============
* 2023-10-06 mjkhan
* ================================
* </pre>
*/
public class SigunguQuery extends QueryRequest {
private static final long serialVersionUID = 1L;
/** 시군구 코드 */
private String[] sggIDs;
/** 기관 코드 */
private String[] instCodes;
/** .
* @return
*/
public String[] getSggIDs() {
return ifEmpty(sggIDs, () -> null);
}
/** .
* @param sggIDs
* @return SigunguQuery
*/
public SigunguQuery setSggIDs(String... sggIDs) {
this.sggIDs = sggIDs;
return this;
}
/** .
* @return
*/
public String[] getInstCodes() {
return ifEmpty(instCodes, () -> null);
}
/** .
* @param instituteCodes
* @return SigunguQuery
*/
public SigunguQuery setInstCodes(String[] instituteCodes) {
this.instCodes = instituteCodes;
return this;
}
}

@ -1,4 +1,4 @@
package cokr.xit.base.user.service; package cokr.xit.base.user;
import cokr.xit.foundation.component.QueryRequest; import cokr.xit.foundation.component.QueryRequest;

@ -0,0 +1,118 @@
package cokr.xit.base.user.dao;
import java.util.List;
import java.util.Map;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
import cokr.xit.base.user.Department;
import cokr.xit.base.user.DepartmentQuery;
import cokr.xit.foundation.component.AbstractMapper;
import cokr.xit.foundation.data.DataObject;
/** DAO
*
* <p> :
*
* <pre>
* ============ ============
* 2023-10-06 mjkhan
* ================================
* </pre>
*/
@Mapper("departmentMapper")
public interface DepartmentMapper extends AbstractMapper {
/** .<br />
* @param req
* @return
*/
List<DataObject> selectDepartmentList(DepartmentQuery req);
/** .
* @param req
* @return
*/
List<Department> selectDepartments(DepartmentQuery req);
/** .
* @param sggID
* @param deptIDs
* @return
*/
default List<Department> selectDepartments(String sggID, String... deptIDs) {
return selectDepartments(new DepartmentQuery()
.setSggID(sggID)
.setDeptIDs(deptIDs)
);
}
/** .
* @param sggID
* @param deptID
* @return
*/
default Department selectDepartment(String sggID, String deptID) {
List<Department> list = selectDepartments(sggID, deptID);
return !list.isEmpty() ? list.get(0) : null;
}
/** .
* @param params
* <ul><li>"department" - </li>
* <li>"currentUser" - </li>
* </ul>
* @return
*/
int insertDepartment(Map<String, Object> params);
/** .
* @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);
/** .
* @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;
}
/** .
* @param params
* <ul><li>"department" - </li>
* <li>"currentUser" - </li>
* </ul>
* @return
*/
int deleteDepartment(Map<String, Object> params);
/** .
* @param department
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
default int delete(String sggID, String... deptIDs) {
return deleteDepartment(params().set("sggID", sggID).set("deptIDs", deptIDs));
}
}

@ -0,0 +1,127 @@
package cokr.xit.base.user.dao;
import java.util.List;
import java.util.Map;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
import cokr.xit.base.user.Sigungu;
import cokr.xit.base.user.SigunguQuery;
import cokr.xit.foundation.component.AbstractMapper;
import cokr.xit.foundation.data.DataObject;
/** DAO
*
* <p> :
*
* <pre>
* ============ ============
* 2023-10-06 mjkhan
* ================================
* </pre>
*/
@Mapper("sigunguMapper")
public interface SigunguMapper extends AbstractMapper {
/** .<br />
* @param req
* @return
*/
List<DataObject> selectSigunguList(SigunguQuery req);
/** .
* @param req
* @return
*/
List<Sigungu> selectSigungus(SigunguQuery req);
/** .
* @param sggIDs
* @return
*/
default List<Sigungu> selectSigungus(String... sggIDs) {
return selectSigungus(new SigunguQuery().setSggIDs(sggIDs));
}
/** .
* @param sggID
* @return
*/
default Sigungu selectSigungu(String sggID) {
List<Sigungu> list = selectSigungus(sggID);
return !list.isEmpty() ? list.get(0) : null;
}
/** .
* @param instCodes
* @return
*/
default List<Sigungu> selectInstitutes(String... instCodes) {
return selectSigungus(new SigunguQuery().setInstCodes(instCodes));
}
/** .
* @param instCodes
* @return
*/
default Sigungu selectInstitute(String instCode) {
List<Sigungu> list = selectInstitutes(instCode);
return !list.isEmpty() ? list.get(0) : null;
}
/** .
* @param params
* <ul><li>"sigungu" - </li>
* <li>"currentUser" - </li>
* </ul>
* @return
*/
int insertSigungu(Map<String, Object> params);
/** .
* @param sigungu
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
default boolean insert(Sigungu sigungu) {
return sigungu != null && insertSigungu(params().set("sigungu", sigungu)) == 1;
}
/** .
* @param params
* <ul><li>"sigungu" - </li>
* <li>"currentUser" - </li>
* </ul>
* @return
*/
int updateSigungu(Map<String, Object> params);
/** .
* @param sigungu
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
default boolean update(Sigungu sigungu) {
return sigungu != null && updateSigungu(params().set("sigungu", sigungu)) == 1;
}
/** .
* @param params
* <ul><li>"sggIDs" - </li>
* <li>"currentUser" - </li>
* </ul>
* @return
*/
int deleteSigungu(Map<String, Object> params);
/** .
* @param sggIDs
* @return
*/
default int delete(String... sggIDs) {
return !isEmpty(sggIDs) ? deleteSigungu(params().set("sggIDs", sggIDs)) : 0;
}
}

@ -7,7 +7,7 @@ import java.util.stream.Stream;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper; import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
import cokr.xit.base.user.service.UserQuery; import cokr.xit.base.user.UserQuery;
import cokr.xit.foundation.User; import cokr.xit.foundation.User;
import cokr.xit.foundation.component.AbstractMapper; import cokr.xit.foundation.component.AbstractMapper;
import cokr.xit.foundation.data.DataObject; import cokr.xit.foundation.data.DataObject;

@ -0,0 +1,50 @@
package cokr.xit.base.user.service;
import java.util.List;
import cokr.xit.base.user.Department;
import cokr.xit.base.user.DepartmentQuery;
import cokr.xit.foundation.data.DataObject;
/** .
*
* <p> :
*
* <pre>
* ============ ============
* 2023-10-06 mjkhan
* ================================
* </pre>
*/
public interface DepartmentService {
/** .
* @param req
* @return
*/
List<DataObject> getDepartmentList(DepartmentQuery req);
/** .
* @param department
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
boolean create(Department department);
/** .
* @param department
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
boolean update(Department department);
/** .
* @param sggID
* @param deptIDs
* @return
*/
int remove(String sggID, String... deptIDs);
}

@ -0,0 +1,49 @@
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);
}

@ -2,6 +2,7 @@ package cokr.xit.base.user.service;
import java.util.List; import java.util.List;
import cokr.xit.base.user.UserQuery;
import cokr.xit.foundation.User; import cokr.xit.foundation.User;
import cokr.xit.foundation.data.DataObject; import cokr.xit.foundation.data.DataObject;

@ -0,0 +1,87 @@
package cokr.xit.base.user.service.bean;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;
import cokr.xit.base.user.Department;
import cokr.xit.base.user.DepartmentQuery;
import cokr.xit.base.user.dao.DepartmentMapper;
import cokr.xit.foundation.AbstractComponent;
import cokr.xit.foundation.data.DataObject;
/** Bean
*
* <p> :
*
* <pre>
* ============ ============
* 2023-10-06 mjkhan
* ================================
* </pre>
*/
@Component("departmentBean")
public class DepartmentBean extends AbstractComponent {
/** 부서 정보 정보 DAO */
@Resource(name = "departmentMapper")
private DepartmentMapper departmentMapper;
/** .
* @param req
* @return
*/
public List<DataObject> getDepartmentList(DepartmentQuery req) {
return departmentMapper.selectDepartmentList(req);
}
/** .
* @param sggID
* @param deptIDs
* @return
*/
public List<Department> getDepartments(String sggID, String... deptIDs) {
return departmentMapper.selectDepartments(sggID, deptIDs);
}
/** .
* @param sggID
* @param deptID
* @return
*/
public Department getDepartment(String sggID, String deptID) {
return departmentMapper.selectDepartment(sggID, deptID);
}
/** .
* @param department
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean create(Department department) {
return departmentMapper.insert(department);
}
/** .
* @param department
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean update(Department department) {
return departmentMapper.update(department);
}
/** .
* @param sggID
* @param deptIDs
* @return
*/
public int remove(String sggID, String... deptIDs) {
return departmentMapper.delete(sggID, deptIDs);
}
}

@ -0,0 +1,50 @@
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);
}
}

@ -0,0 +1,100 @@
package cokr.xit.base.user.service.bean;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;
import cokr.xit.base.user.Sigungu;
import cokr.xit.base.user.SigunguQuery;
import cokr.xit.base.user.dao.SigunguMapper;
import cokr.xit.foundation.AbstractComponent;
import cokr.xit.foundation.data.DataObject;
/** Bean
*
* <p> :
*
* <pre>
* ============ ============
* 2023-10-06 mjkhan
* ================================
* </pre>
*/
@Component("sigunguBean")
public class SigunguBean extends AbstractComponent {
/** 시군구 정보 DAO */
@Resource(name = "sigunguMapper")
private SigunguMapper sigunguMapper;
/** .
* @param req
* @return
*/
public List<DataObject> getSigunguList(SigunguQuery req) {
return sigunguMapper.selectSigunguList(req);
}
/** .
* @param sggIDs
* @return
*/
public List<Sigungu> getSigungus(String... sggIDs) {
return sigunguMapper.selectSigungus(sggIDs);
}
/** .
* @param sggID
* @return
*/
public Sigungu getSigungu(String sggID) {
return sigunguMapper.selectSigungu(sggID);
}
/** .
* @param instCodes
* @return
*/
public List<Sigungu> getInstitutes(String... instCodes) {
return sigunguMapper.selectInstitutes(instCodes);
}
/** .
* @param instCode
* @return
*/
public Sigungu getInstitute(String instCode) {
return sigunguMapper.selectInstitute(instCode);
}
/** .
* @param sigungu
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean create(Sigungu sigungu) {
return sigunguMapper.insert(sigungu);
}
/** .
* @param sigungu
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean update(Sigungu sigungu) {
return sigunguMapper.update(sigungu);
}
/** .
* @param sggIDs
* @return
*/
public int remove(String... sggIDs) {
return sigunguMapper.delete(sggIDs);
}
}

@ -0,0 +1,50 @@
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);
}
}

@ -6,8 +6,8 @@ import javax.annotation.Resource;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import cokr.xit.base.user.UserQuery;
import cokr.xit.base.user.dao.UserMapper; import cokr.xit.base.user.dao.UserMapper;
import cokr.xit.base.user.service.UserQuery;
import cokr.xit.foundation.AbstractComponent; import cokr.xit.foundation.AbstractComponent;
import cokr.xit.foundation.User; import cokr.xit.foundation.User;
import cokr.xit.foundation.data.DataObject; import cokr.xit.foundation.data.DataObject;

@ -7,7 +7,7 @@ import javax.annotation.Resource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import cokr.xit.base.user.GenericUser; import cokr.xit.base.user.GenericUser;
import cokr.xit.base.user.service.UserQuery; import cokr.xit.base.user.UserQuery;
import cokr.xit.base.user.service.UserService; import cokr.xit.base.user.service.UserService;
import cokr.xit.foundation.User; import cokr.xit.foundation.User;
import cokr.xit.foundation.component.AbstractServiceBean; import cokr.xit.foundation.component.AbstractServiceBean;

@ -0,0 +1,104 @@
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);
}
}

@ -0,0 +1,103 @@
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);
}
}

@ -8,7 +8,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import cokr.xit.base.user.service.UserQuery; import cokr.xit.base.user.UserQuery;
import cokr.xit.base.user.service.UserService; import cokr.xit.base.user.service.UserService;
import cokr.xit.foundation.User; import cokr.xit.foundation.User;
import cokr.xit.foundation.data.DataObject; import cokr.xit.foundation.data.DataObject;

Loading…
Cancel
Save