OWL ITS + 탐지시스템(인터넷 진흥원)
wyu
2021-11-08 4fd246e32166938d7f86c7ab236ed554a2bc9fef
업체 관리 백엔드 추가
11개 파일 추가됨
7개 파일 변경됨
982 ■■■■■ 파일 변경됨
src/main/java/kr/wisestone/owl/constant/MsgConstants.java 13 ●●●● 패치 | 보기 | raw | blame | 히스토리
src/main/java/kr/wisestone/owl/domain/CompanyField.java 98 ●●●●● 패치 | 보기 | raw | blame | 히스토리
src/main/java/kr/wisestone/owl/mapper/CompanyFieldMapper.java 22 ●●●●● 패치 | 보기 | raw | blame | 히스토리
src/main/java/kr/wisestone/owl/mapper/DepartmentManageMapper.java 2 ●●●●● 패치 | 보기 | raw | blame | 히스토리
src/main/java/kr/wisestone/owl/repository/CompanyFieldRepository.java 8 ●●●●● 패치 | 보기 | raw | blame | 히스토리
src/main/java/kr/wisestone/owl/service/CompanyFieldService.java 31 ●●●●● 패치 | 보기 | raw | blame | 히스토리
src/main/java/kr/wisestone/owl/service/DepartmentManageService.java 2 ●●●●● 패치 | 보기 | raw | blame | 히스토리
src/main/java/kr/wisestone/owl/service/impl/CompanyFieldServiceImpl.java 185 ●●●●● 패치 | 보기 | raw | blame | 히스토리
src/main/java/kr/wisestone/owl/service/impl/DepartmentManageServiceImpl.java 113 ●●●●● 패치 | 보기 | raw | blame | 히스토리
src/main/java/kr/wisestone/owl/service/impl/UserLevelServiceImpl.java 2 ●●● 패치 | 보기 | raw | blame | 히스토리
src/main/java/kr/wisestone/owl/vo/CompanyFieldVo.java 101 ●●●●● 패치 | 보기 | raw | blame | 히스토리
src/main/java/kr/wisestone/owl/web/condition/CompanyFieldCondition.java 112 ●●●●● 패치 | 보기 | raw | blame | 히스토리
src/main/java/kr/wisestone/owl/web/controller/CompanyFieldController.java 97 ●●●●● 패치 | 보기 | raw | blame | 히스토리
src/main/java/kr/wisestone/owl/web/controller/DepartmentManageController.java 15 ●●●● 패치 | 보기 | raw | blame | 히스토리
src/main/java/kr/wisestone/owl/web/form/CompanyFieldForm.java 112 ●●●●● 패치 | 보기 | raw | blame | 히스토리
src/main/resources/migration/V1_11__Alter_Table.sql 16 ●●●●● 패치 | 보기 | raw | blame | 히스토리
src/main/resources/mybatis/query-template/companyField-template.xml 40 ●●●●● 패치 | 보기 | raw | blame | 히스토리
src/main/webapp/WEB-INF/i18n/messages_ko_KR.properties 13 ●●●●● 패치 | 보기 | raw | blame | 히스토리
src/main/java/kr/wisestone/owl/constant/MsgConstants.java
@@ -205,11 +205,20 @@
    public static final String PAGE_SIZE_NEGATIVE_OR_NULL = "PAGE_SIZE_NEGATIVE_OR_NULL";   //  요청한 페이지 크기가 잘못되었습니다.
    public static final String USER_LEVEL_ALREADY_IN_USE = "USER_LEVEL_ALREADY_IN_USE"; // 사용자 등급을 사용하고 있는 사용자가 있습니다.
    public static final String USER_LEVEL_ALREADY = "USER_LEVEL_ALREADY"; // 사용자 등급을 사용하고 있는 사용자가 있습니다.
    public static final String USER_LEVEL_PERMISSION_DENIED = "USER_LEVEL_PERMISSION_DENIED"; // 사용자 등급 정보를 수정할수 없습니다.
    public static final String USER_LEVEL_NOT_EXIST = "USER_LEVEL_NOT_EXIST";   //  사용자 등급이 존재하지 않습니다.
    public static final String USER_LEVEL_NOT_DELETE = "USER_LEVEL_NOT_DELETE";   // 기본 사용자 등급은 삭제할수 없습니다.
    public static final String USER_LEVEL_REMOVE_NOT_SELECT = "USER_LEVEL_REMOVE_NOT_SELECT";   // 삭제할 사용자 등급이 선택되지 않았습니다.
    public static final String DEPARTMENT_NOT_EXIST = "DEPARTMENT_NOT_EXIST";   // 부서가 존재하지 않습니다.
    public static final String DEPARTMENT_ALREADY_IN_USE = "DEPARTMENT_ALREADY_IN_USE";   // 선택한 부서는 이미 사용하고 있습니다.
    public static final String DEPARTMENT_REMOVE_NOT_SELECT = "DEPARTMENT_REMOVE_NOT_SELECT";   // 삭제할 부서가 선택되지 않았습니다.
    public static final String COMPANY_REMOVE_NOT_SELECT = "COMPANY_REMOVE_NOT_SELECT";   // 삭제할 업체가 선택되지 않았습니다.
    public static final String COMPANYFIELD_NOT_EXIST = "COMPANYFIELD_NOT_EXIST";   // 업체가 존재하지 않습니다.
}
src/main/java/kr/wisestone/owl/domain/CompanyField.java
New file
@@ -0,0 +1,98 @@
package kr.wisestone.owl.domain;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import java.io.Serializable;
@Entity
public class CompanyField extends BaseEntity implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    private String name;
    private String companyType;
    private String profitYN;
    private String industy;
    private String domain;
    private String email;
    private String tel;
    private String desc;
    public CompanyField() {}
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getCompanyType() {
        return companyType;
    }
    public void setCompanyType(String companyType) {
        this.companyType = companyType;
    }
    public String getProfitYN() {
        return profitYN;
    }
    public void setProfitYN(String profitYN) {
        this.profitYN = profitYN;
    }
    public String getIndusty() {
        return industy;
    }
    public void setIndusty(String industy) {
        this.industy = industy;
    }
    public String getDomain() {
        return domain;
    }
    public void setDomain(String domain) {
        this.domain = domain;
    }
    public String getEmail() {
        return email;
    }
    public void setEmail(String email) {
        this.email = email;
    }
    public String getTel() {
        return tel;
    }
    public void setTel(String tel) {
        this.tel = tel;
    }
    public String getDesc() {
        return desc;
    }
    public void setDesc(String desc) {
        this.desc = desc;
    }
}
src/main/java/kr/wisestone/owl/mapper/CompanyFieldMapper.java
New file
@@ -0,0 +1,22 @@
package kr.wisestone.owl.mapper;
import kr.wisestone.owl.web.condition.CompanyFieldCondition;
import kr.wisestone.owl.web.condition.DepartmentManageCondition;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
/**
 * Created by wisestone on 2018-02-26.
 */
@Repository
public interface CompanyFieldMapper {
    List<Map<String, Object>> find(CompanyFieldCondition companyFieldCondition);
    Long count(CompanyFieldCondition companyFieldCondition);
    List<Map<String, Object>> findEvent();
    Long findByCompany(Long id);
}
src/main/java/kr/wisestone/owl/mapper/DepartmentManageMapper.java
@@ -16,4 +16,6 @@
    Long count(DepartmentManageCondition departmentManageCondition);
    List<Map<String, Object>> findEvent();
    Long findBydepartmentId(Long Id);
}
src/main/java/kr/wisestone/owl/repository/CompanyFieldRepository.java
New file
@@ -0,0 +1,8 @@
package kr.wisestone.owl.repository;
import kr.wisestone.owl.domain.CompanyField;
import org.springframework.data.jpa.repository.JpaRepository;
public interface CompanyFieldRepository extends JpaRepository<CompanyField, Long> {
}
src/main/java/kr/wisestone/owl/service/CompanyFieldService.java
New file
@@ -0,0 +1,31 @@
package kr.wisestone.owl.service;
import kr.wisestone.owl.domain.CompanyField;
import kr.wisestone.owl.vo.CompanyFieldVo;
import kr.wisestone.owl.web.condition.CompanyFieldCondition;
import kr.wisestone.owl.web.form.CompanyFieldForm;
import org.springframework.data.domain.Pageable;
import org.springframework.ui.Model;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
public interface CompanyFieldService {
    CompanyField addCompany(CompanyFieldForm companyFieldForm);
    List<CompanyFieldVo> findCompany(Map<String, Object> resJsonData, CompanyFieldCondition make, Pageable pageable);
    CompanyField getCompany(Long id);
    void detailCompany(Map<String, Object> resJsonData, CompanyFieldCondition make);
    void modifyCompany(CompanyFieldForm make);
    void removeCompany(CompanyFieldForm make);
    ModelAndView downloadExcel(HttpServletRequest request, Model model);
    boolean company(Long id);
}
src/main/java/kr/wisestone/owl/service/DepartmentManageService.java
@@ -27,4 +27,6 @@
    void detailDepartment(Map<String, Object> resJsonData, DepartmentManageCondition make);
    ModelAndView downloadExcel(HttpServletRequest request, Model model);
    boolean department(Long id);
}
src/main/java/kr/wisestone/owl/service/impl/CompanyFieldServiceImpl.java
New file
@@ -0,0 +1,185 @@
package kr.wisestone.owl.service.impl;
import kr.wisestone.owl.domain.CompanyField;
import kr.wisestone.owl.service.UserService;
import kr.wisestone.owl.web.condition.CompanyFieldCondition;
import kr.wisestone.owl.web.form.CompanyFieldForm;
import org.springframework.ui.Model;
import com.google.common.collect.Lists;
import kr.wisestone.owl.common.ExcelConditionCheck;
import kr.wisestone.owl.constant.Constants;
import kr.wisestone.owl.constant.MsgConstants;
import kr.wisestone.owl.exception.OwlRuntimeException;
import kr.wisestone.owl.mapper.CompanyFieldMapper;
import kr.wisestone.owl.repository.CompanyFieldRepository;
import kr.wisestone.owl.service.CompanyFieldService;
import kr.wisestone.owl.service.WorkspaceService;
import kr.wisestone.owl.util.ConvertUtil;
import kr.wisestone.owl.vo.*;
import kr.wisestone.owl.web.view.ExcelView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Service;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class CompanyFieldServiceImpl extends AbstractServiceImpl<CompanyField, Long, JpaRepository<CompanyField, Long>> implements CompanyFieldService {
    @Autowired
    private CompanyFieldRepository companyFieldRepository;
    @Autowired
    private CompanyFieldMapper companyFieldMapper;
    @Autowired
    private UserService userService;
    @Autowired
    private WorkspaceService workspaceService;
    @Autowired
    private ExcelView excelView;
    @Autowired
    private ExcelConditionCheck excelConditionCheck;
    @Override
    protected JpaRepository<CompanyField, Long> getRepository() {
        return this.companyFieldRepository;
    }
    // 업체 추가
    @Override
    public CompanyField addCompany(CompanyFieldForm companyFieldForm) {
        CompanyField companyField = ConvertUtil.copyProperties(companyFieldForm, CompanyField.class);
        companyFieldRepository.saveAndFlush(companyField);
        return companyField;
    }
    // 업체 목록을 가져온다.
    @Override
    public List<CompanyFieldVo> findCompany(Map<String, Object> resJsonData,
                                            CompanyFieldCondition condition, Pageable pageable) {
        condition.setPage(pageable.getPageNumber() * pageable.getPageSize());
        condition.setPageSize(pageable.getPageSize());
        List<Map<String, Object>> results = this.companyFieldMapper.find(condition);
        Long totalCompanyCount = this.companyFieldMapper.count(condition);
        return this.convertCompanyVoToMap(results, totalCompanyCount, pageable, resJsonData);
    }
    // 업체 상세 조회한다.
    @Override
    public void detailCompany(Map<String, Object> resJsonData, CompanyFieldCondition companyFieldCondition) {
        CompanyFieldVo companyFieldVo = new CompanyFieldVo();
        Long companyId = companyFieldCondition.getId();
        if (companyId != null) {
            CompanyField companyField = this.getCompany(companyId);
            companyFieldVo = ConvertUtil.copyProperties(companyField, CompanyFieldVo.class);
        }
        resJsonData.put(Constants.REQ_KEY_CONTENT, companyFieldVo);
    }
    // 업체 정로를 수정한다.
    @Override
    public void modifyCompany(CompanyFieldForm companyFieldForm) {
        CompanyField companyField = ConvertUtil.copyProperties(companyFieldForm, CompanyField.class);
        companyFieldRepository.saveAndFlush(companyField);
    }
    // 업체를 삭제한다.
    @Override
    public void removeCompany(CompanyFieldForm companyFieldForm) {
        if (companyFieldForm.getRemoveIds().size() < 1) {
            throw new OwlRuntimeException(
                    this.messageAccessor.getMessage(MsgConstants.COMPANY_REMOVE_NOT_SELECT));
        }
        this.companyFieldRepository.flush();
    }
    // 업체 목록을 엑셀로 다운로드 한다.
    @Override
    public ModelAndView downloadExcel(HttpServletRequest request, Model model) {
        ModelAndView modelAndView = this.workspaceService.checkUseExcelDownload(model);
        if (modelAndView != null) {
            return modelAndView;
        }
        Map<String, Object> conditions = new HashMap<>();
        //  엑셀 다운로드에 필요한 검색 조건 정보를 추출하고 검색 조건 추출에 오류가 발생하면 경고를 표시해준다.
        modelAndView = this.excelConditionCheck.checkCondition(conditions, request, model);
        if (modelAndView != null) {
            return modelAndView;
        }
        CompanyFieldCondition companyFieldCondition = CompanyFieldCondition.make(conditions);
        List<Map<String, Object>> results = this.companyFieldMapper.find(companyFieldCondition);
        List<CompanyFieldVo> companyFieldVos = ConvertUtil.convertListToListClass(results, CompanyFieldVo.class);
        // code_ko_KR 에 code명 설정
        ExportExcelVo excelInfo = new ExportExcelVo();
        excelInfo.setFileName(this.messageAccessor.message("업체 목록"));
        excelInfo.addAttrInfos(new ExportExcelAttrVo("companyName", this.messageAccessor.message("departmentManage.departmentName"), 6, ExportExcelAttrVo.ALIGN_CENTER));
        excelInfo.addAttrInfos(new ExportExcelAttrVo("", this.messageAccessor.message("departmentManage.departmentDescription"), 10, ExportExcelAttrVo.ALIGN_CENTER));
        excelInfo.addAttrInfos(new ExportExcelAttrVo("companyPhone", this.messageAccessor.message("departmentManage.departmentCount"), 10, ExportExcelAttrVo.ALIGN_CENTER));
        excelInfo.addAttrInfos(new ExportExcelAttrVo("companyEmail", this.messageAccessor.message("departmentManage.departmentCount"), 10, ExportExcelAttrVo.ALIGN_CENTER));
        excelInfo.addAttrInfos(new ExportExcelAttrVo("companyDesc", this.messageAccessor.message("departmentManage.departmentCount"), 10, ExportExcelAttrVo.ALIGN_CENTER));
        excelInfo.setDatas(companyFieldVos);
        model.addAttribute(Constants.EXCEL, excelInfo);
        return new ModelAndView(this.excelView);
    }
    // 삭제 할 업체가 있는지 확인
    @Override
    public boolean company(Long Id) {
        return this.companyFieldMapper.findByCompany(Id) > 0;
    }
    //  검색 결과를 CompanyFieldVo 로 변환한다.
    private List<CompanyFieldVo> convertCompanyVoToMap(List<Map<String, Object>> results, Long totalCompanyCount, Pageable pageable, Map<String, Object> resJsonData) {
        List<CompanyFieldVo> companyFieldVos = Lists.newArrayList();
        for (Map<String, Object> result : results) {
            CompanyFieldVo companyFieldVo = ConvertUtil.convertMapToClass(result, CompanyFieldVo.class);
            companyFieldVos.add(companyFieldVo);
        }
        int totalPage = (int) Math.ceil((totalCompanyCount - 1) / pageable.getPageSize()) + 1;
        resJsonData.put(Constants.RES_KEY_CONTENTS, companyFieldVos);
        resJsonData.put(Constants.REQ_KEY_PAGE_VO, new ResPage(pageable.getPageNumber(), pageable.getPageSize(),
                totalPage, totalCompanyCount));
        return companyFieldVos;
    }
    // 업체 ID 로 조회한다
    @Override
    public CompanyField getCompany(Long id) {
        if (id == null) {
            throw new OwlRuntimeException(
                    this.messageAccessor.getMessage(MsgConstants.COMPANYFIELD_NOT_EXIST));
        }
        CompanyField companyField = this.findOne(id);
        if (companyField == null) {
            throw new OwlRuntimeException(
                    this.messageAccessor.getMessage(MsgConstants.COMPANYFIELD_NOT_EXIST));
        }
        return companyField;
    }
}
src/main/java/kr/wisestone/owl/service/impl/DepartmentManageServiceImpl.java
@@ -1,7 +1,6 @@
package kr.wisestone.owl.service.impl;
import kr.wisestone.owl.domain.UserLevel;
import kr.wisestone.owl.web.form.UserLevelForm;
import kr.wisestone.owl.service.UserService;
import org.springframework.ui.Model;
import com.google.common.collect.Lists;
import kr.wisestone.owl.common.ExcelConditionCheck;
@@ -39,6 +38,9 @@
    private DepartmentManageMapper departmentManageMapper;
    @Autowired
    private UserService userService;
    @Autowired
    private WorkspaceService workspaceService;
    @Autowired
@@ -73,39 +75,6 @@
        return this.convertDepartmentManageVoToMap(results, totalDepartmentCount, pageable, resJsonData);
    }
    // 사용자 부서 ID로 조회한다.
    @Override
    public DepartmentManage getDepartment(Long id) {
        if (id == null) {
            throw new OwlRuntimeException(
                    this.messageAccessor.getMessage(MsgConstants.USER_LEVEL_NOT_EXIST));
        }
        DepartmentManage departmentManage = this.findOne(id);
        if (departmentManage == null) {
            throw new OwlRuntimeException(
                    this.messageAccessor.getMessage(MsgConstants.USER_LEVEL_NOT_EXIST));
        }
        return departmentManage;
    }
    // 부서를 삭제한다.
    @Override
    public void removeDepartment(DepartmentManageForm departmentManageForm) {
        if (departmentManageForm.getRemoveIds().size() < 1) {
            throw new OwlRuntimeException(
                    this.messageAccessor.getMessage(MsgConstants.PROJECT_REMOVE_NOT_SELECT));
        }
        for (Long departmentId : departmentManageForm.getRemoveIds()) {
            this.departmentManageRepository.deleteById(departmentId);
        }
        this.departmentManageRepository.flush();
    }
    // 부서 상세 조회한다.
    @Override
    public void detailDepartment(Map<String, Object> resJsonData, DepartmentManageCondition departmentManageCondition) {
@@ -126,23 +95,24 @@
        departmentManageRepository.saveAndFlush(departmentManage);
    }
    //  검색 결과를 DepartmentManageVo 로 변환한다.
    private List<DepartmentManageVo> convertDepartmentManageVoToMap(List<Map<String, Object>> results, Long totalDepartmentsCount, Pageable pageable, Map<String, Object> resJsonData) {
        List<DepartmentManageVo> departmentManageVos = Lists.newArrayList();
        for (Map<String, Object> result : results) {
            DepartmentManageVo departmentManageVo = ConvertUtil.convertMapToClass(result, DepartmentManageVo.class);
            departmentManageVos.add(departmentManageVo);
    // 부서를 삭제한다.
    @Override
    public void removeDepartment(DepartmentManageForm departmentManageForm) {
        if (departmentManageForm.getRemoveIds().size() < 1) {
            throw new OwlRuntimeException(
                    this.messageAccessor.getMessage(MsgConstants.DEPARTMENT_REMOVE_NOT_SELECT));
        }
        int totalPage = (int) Math.ceil((totalDepartmentsCount - 1) / pageable.getPageSize()) + 1;
        for (Long id : departmentManageForm.getRemoveIds()) {
            if (!this.userService.useUserLevel(id)) {
                this.departmentManageRepository.deleteById(id);
            } else {
                throw new OwlRuntimeException(
                        this.messageAccessor.getMessage(MsgConstants.DEPARTMENT_ALREADY_IN_USE));
            }
        resJsonData.put(Constants.RES_KEY_CONTENTS, departmentManageVos);
        resJsonData.put(Constants.REQ_KEY_PAGE_VO, new ResPage(pageable.getPageNumber(), pageable.getPageSize(),
                totalPage, totalDepartmentsCount));
        return departmentManageVos;
        }
        this.departmentManageRepository.flush();
    }
    // 부서 목록을 엑셀로 다운로드 한다.
@@ -166,7 +136,6 @@
        List<Map<String, Object>> results = this.departmentManageMapper.find(departmentManageCondition);
        List<DepartmentManageVo> departmentManageVos = ConvertUtil.convertListToListClass(results, DepartmentManageVo.class);
        // code_ko_KR 에 code명 설정
        ExportExcelVo excelInfo = new ExportExcelVo();
        excelInfo.setFileName(this.messageAccessor.message("부서 목록"));
@@ -178,6 +147,50 @@
        model.addAttribute(Constants.EXCEL, excelInfo);
        return new ModelAndView(this.excelView);
    }
    // 사용자 부서 ID로 조회한다.
    @Override
    public DepartmentManage getDepartment(Long id) {
        if (id == null) {
            throw new OwlRuntimeException(
                    this.messageAccessor.getMessage(MsgConstants.DEPARTMENT_NOT_EXIST));
        }
        DepartmentManage departmentManage = this.findOne(id);
        if (departmentManage == null) {
            throw new OwlRuntimeException(
                    this.messageAccessor.getMessage(MsgConstants.DEPARTMENT_NOT_EXIST));
        }
        return departmentManage;
    }
    //  삭제 할 부서 유저가 사용하고 있는지 확인
    @Override
    public boolean department(Long Id) {
        return this.departmentManageMapper.findBydepartmentId(Id) > 0;
    }
    //  검색 결과를 DepartmentManageVo 로 변환한다.
    private List<DepartmentManageVo> convertDepartmentManageVoToMap(List<Map<String, Object>> results, Long totalDepartmentsCount, Pageable pageable, Map<String, Object> resJsonData) {
        List<DepartmentManageVo> departmentManageVos = Lists.newArrayList();
        for (Map<String, Object> result : results) {
            DepartmentManageVo departmentManageVo = ConvertUtil.convertMapToClass(result, DepartmentManageVo.class);
            departmentManageVos.add(departmentManageVo);
        }
        int totalPage = (int) Math.ceil((totalDepartmentsCount - 1) / pageable.getPageSize()) + 1;
        resJsonData.put(Constants.RES_KEY_CONTENTS, departmentManageVos);
        resJsonData.put(Constants.REQ_KEY_PAGE_VO, new ResPage(pageable.getPageNumber(), pageable.getPageSize(),
                totalPage, totalDepartmentsCount));
        return departmentManageVos;
    }
}
src/main/java/kr/wisestone/owl/service/impl/UserLevelServiceImpl.java
@@ -173,7 +173,7 @@
    public void removeUserLevel(UserLevelForm userLevelForm) {
        if (userLevelForm.getRemoveIds().size() < 1) {
            throw new OwlRuntimeException(
                    this.messageAccessor.getMessage(MsgConstants.PROJECT_REMOVE_NOT_SELECT));
                    this.messageAccessor.getMessage(MsgConstants.USER_LEVEL_REMOVE_NOT_SELECT));
        }
        // 기본 사용자 등급 삭제 체크
src/main/java/kr/wisestone/owl/vo/CompanyFieldVo.java
New file
@@ -0,0 +1,101 @@
package kr.wisestone.owl.vo;
public class CompanyFieldVo extends BaseVo{
    private Long id;
    private String name;
    private String companyType;
    private String profitYN;
    private String industy;
    private String domain;
    private String email;
    private String tel;
    private String desc;
    public CompanyFieldVo() {}
    public CompanyFieldVo(Long id, String name, String companyType, String profitYN, String industy, String domain, String email, String tel, String desc) {
        this.id = id;
        this.name = name;
        this.companyType = companyType;
        this.profitYN = profitYN;
        this.industy = industy;
        this.domain = domain;
        this.email = email;
        this.tel = tel;
        this.desc = desc;
    }
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getCompanyType() {
        return companyType;
    }
    public void setCompanyType(String companyType) {
        this.companyType = companyType;
    }
    public String getProfitYN() {
        return profitYN;
    }
    public void setProfitYN(String profitYN) {
        this.profitYN = profitYN;
    }
    public String getIndusty() {
        return industy;
    }
    public void setIndusty(String industy) {
        this.industy = industy;
    }
    public String getDomain() {
        return domain;
    }
    public void setDomain(String domain) {
        this.domain = domain;
    }
    public String getEmail() {
        return email;
    }
    public void setEmail(String email) {
        this.email = email;
    }
    public String getTel() {
        return tel;
    }
    public void setTel(String tel) {
        this.tel = tel;
    }
    public String getDesc() {
        return desc;
    }
    public void setDesc(String desc) {
        this.desc = desc;
    }
}
src/main/java/kr/wisestone/owl/web/condition/CompanyFieldCondition.java
New file
@@ -0,0 +1,112 @@
package kr.wisestone.owl.web.condition;
import kr.wisestone.owl.util.ConvertUtil;
import java.util.Map;
public class CompanyFieldCondition {
    private Long id;
    private String name;
    private String companyType;
    private String profitYN;
    private String industy;
    private String domain;
    private String email;
    private String tel;
    private String desc;
    private Integer Page;
    private Integer PageSize;
    public static CompanyFieldCondition make(Map<String, Object> companyFieldCondition) {
        return ConvertUtil.convertMapToClass(companyFieldCondition, CompanyFieldCondition.class);
    }
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getCompanyType() {
        return companyType;
    }
    public void setCompanyType(String companyType) {
        this.companyType = companyType;
    }
    public String getProfitYN() {
        return profitYN;
    }
    public void setProfitYN(String profitYN) {
        this.profitYN = profitYN;
    }
    public String getIndusty() {
        return industy;
    }
    public void setIndusty(String industy) {
        this.industy = industy;
    }
    public String getDomain() {
        return domain;
    }
    public void setDomain(String domain) {
        this.domain = domain;
    }
    public String getEmail() {
        return email;
    }
    public void setEmail(String email) {
        this.email = email;
    }
    public String getTel() {
        return tel;
    }
    public void setTel(String tel) {
        this.tel = tel;
    }
    public String getDesc() {
        return desc;
    }
    public void setDesc(String desc) {
        this.desc = desc;
    }
    public Integer getPage() {
        return Page;
    }
    public void setPage(Integer page) {
        Page = page;
    }
    public Integer getPageSize() {
        return PageSize;
    }
    public void setPageSize(Integer pageSize) {
        PageSize = pageSize;
    }
}
src/main/java/kr/wisestone/owl/web/controller/CompanyFieldController.java
New file
@@ -0,0 +1,97 @@
package kr.wisestone.owl.web.controller;
import kr.wisestone.owl.constant.Constants;
import kr.wisestone.owl.service.CompanyFieldService;
import kr.wisestone.owl.web.condition.CompanyFieldCondition;
import kr.wisestone.owl.web.form.CompanyFieldForm;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
@Controller
public class CompanyFieldController extends BaseController{
    @Autowired
    private CompanyFieldService companyFieldService;
    // 업체 생성
    @RequestMapping(value = "/companyField/add", method = RequestMethod.POST)
    public
    @ResponseBody
    Map<String, Object> add(@RequestBody Map<String, Map<String, Object>> params) {
        Map<String, Object> resJsonData = new HashMap<>();
        Map<String, Object> content = params.get(Constants.REQ_KEY_CONTENT);
        this.companyFieldService.addCompany(CompanyFieldForm.make(content));
        return this.setSuccessMessage(resJsonData);
    }
    // 업체 조회
    @RequestMapping(value = "/companyField/find", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public
    @ResponseBody
    Map<String, Object> find(@RequestBody Map<String, Map<String, Object>> params) {
        Map<String, Object> resJsonData = new HashMap<>();
        Pageable pageable = this.pageUtil.convertPageable(this.getPageVo(params));
        this.companyFieldService.findCompany(resJsonData, CompanyFieldCondition.make(params.get(Constants.REQ_KEY_CONTENT)), pageable);
        return this.setSuccessMessage(resJsonData);
    }
    // 업체 상세 조회
    @RequestMapping(value = "/companyField/detail", produces = MediaType.APPLICATION_JSON_VALUE)
    public
    @ResponseBody
    Map<String, Object> detail(@RequestBody Map<String, Map<String, Object>> params) {
        Map<String, Object> resJsonData = new HashMap<>();
        this.companyFieldService.detailCompany(resJsonData, CompanyFieldCondition.make(params.get(Constants.REQ_KEY_CONTENT)));
        return this.setSuccessMessage(resJsonData);
    }
    // 업체 수정
    @RequestMapping(value = "/companyField/modify", produces = MediaType.APPLICATION_JSON_VALUE)
    public
    @ResponseBody
    Map<String, Object> modify(@RequestBody Map<String, Map<String, Object>> params) {
        Map<String, Object> resJsonData = new HashMap<>();
        this.companyFieldService.modifyCompany(CompanyFieldForm.make(params.get(Constants.REQ_KEY_CONTENT)));
        return this.setSuccessMessage(resJsonData);
    }
    // 업체 삭제
    @RequestMapping(value = "/companyField/remove", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public
    @ResponseBody
    Map<String, Object> remove(@RequestBody Map<String, Map<String, Object>> params) {
        Map<String, Object> resJsonData = new HashMap<>();
        Map<String, Object> content = params.get(Constants.REQ_KEY_CONTENT);
        this.companyFieldService.removeCompany(CompanyFieldForm.make(content));
        return this.setSuccessMessage(resJsonData);
    }
    // 업체 엑셀 다운로드
    @RequestMapping(value = "/companyField/downloadExcel", method = RequestMethod.POST)
    public ModelAndView downloadExcel(HttpServletRequest request, Model model) {
        return this.companyFieldService.downloadExcel(request, model);
    }
}
src/main/java/kr/wisestone/owl/web/controller/DepartmentManageController.java
@@ -28,11 +28,11 @@
    @Autowired
    private DepartmentManageService departmentManageService;
    //  부서 생성
    // 부서 생성
    @RequestMapping(value = "/departmentManage/add", method = RequestMethod.POST)
    public
    @ResponseBody
    Map<String, Object> addDepartmentManage(@RequestBody Map<String, Map<String, Object>> params) {
    Map<String, Object> add(@RequestBody Map<String, Map<String, Object>> params) {
        Map<String, Object> resJsonData = new HashMap<>();
        Map<String, Object> content = params.get(Constants.REQ_KEY_CONTENT);
        this.departmentManageService.addDepartmentManage(DepartmentManageForm.make(content));
@@ -40,7 +40,7 @@
        return this.setSuccessMessage(resJsonData);
    }
    //  부서 조회
    // 부서 조회
    @RequestMapping(value = "/departmentManage/find", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public
    @ResponseBody
@@ -53,8 +53,7 @@
        return this.setSuccessMessage(resJsonData);
    }
    //
   //  부서 상세 조회
   // 부서 상세 조회
   @RequestMapping(value = "/departmentManage/detail", produces = MediaType.APPLICATION_JSON_VALUE)
   public
   @ResponseBody
@@ -65,7 +64,7 @@
       return this.setSuccessMessage(resJsonData);
   }
   //  부서 수정
   // 부서 수정
   @RequestMapping(value = "/departmentManage/modify", produces = MediaType.APPLICATION_JSON_VALUE)
   public
   @ResponseBody
@@ -77,7 +76,7 @@
       return this.setSuccessMessage(resJsonData);
   }
   //  부서 삭제
   // 부서 삭제
    @RequestMapping(value = "/departmentManage/remove", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public
    @ResponseBody
@@ -91,7 +90,7 @@
    }
    //  부서 엑셀 다운로드
    // 부서 엑셀 다운로드
    @RequestMapping(value = "/departmentManage/downloadExcel", method = RequestMethod.POST)
    public ModelAndView downloadExcel(HttpServletRequest request, Model model) {
        return this.departmentManageService.downloadExcel(request, model);
src/main/java/kr/wisestone/owl/web/form/CompanyFieldForm.java
New file
@@ -0,0 +1,112 @@
package kr.wisestone.owl.web.form;
import com.google.common.collect.Lists;
import kr.wisestone.owl.util.ConvertUtil;
import kr.wisestone.owl.util.MapUtil;
import java.util.List;
import java.util.Map;
public class CompanyFieldForm {
    private Long id;
    private String name;
    private String companyType;
    private String profitYN;
    private String industy;
    private String domain;
    private String email;
    private String tel;
    private String desc;
    private List<Long> removeIds = Lists.newArrayList();
    public CompanyFieldForm() {
    }
    public static CompanyFieldForm make(Map<String, Object> params) {
        CompanyFieldForm form = ConvertUtil.convertMapToClass(params, CompanyFieldForm.class);
        if (MapUtil.getLongs(params,"removeIds") != null) {
            form.setRemoveIds(MapUtil.getLongs(params, "removeIds"));
        }
        return form;
    }
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getCompanyType() {
        return companyType;
    }
    public void setCompanyType(String companyType) {
        this.companyType = companyType;
    }
    public String getProfitYN() {
        return profitYN;
    }
    public void setProfitYN(String profitYN) {
        this.profitYN = profitYN;
    }
    public String getIndusty() {
        return industy;
    }
    public void setIndusty(String industy) {
        this.industy = industy;
    }
    public String getDomain() {
        return domain;
    }
    public void setDomain(String domain) {
        this.domain = domain;
    }
    public String getEmail() {
        return email;
    }
    public void setEmail(String email) {
        this.email = email;
    }
    public String getTel() {
        return tel;
    }
    public void setTel(String tel) {
        this.tel = tel;
    }
    public String getDesc() {
        return desc;
    }
    public void setDesc(String desc) {
        this.desc = desc;
    }
    public List<Long> getRemoveIds() {
        return removeIds;
    }
    public void setRemoveIds(List<Long> removeIds) {
        this.removeIds = removeIds;
    }
}
src/main/resources/migration/V1_11__Alter_Table.sql
New file
@@ -0,0 +1,16 @@
CREATE TABLE `company`(
    `id` BIGINT(11) AUTO_INCREMENT,
    `name` VARCHAR(50) NOT NULL,
    `company_type` VARCHAR(50) NOT NULL,
    `profit_yn` VARCHAR(50) NOT NULL,
    `industry` VARCHAR(50) NOT NULL,
    `domain` VARCHAR(255) NOT NULL,
    `email` VARCHAR (255) NOT NULL,
    `tel` VARCHAR (50) NOT NULL,
    `desc` VARCHAR(255) NOT NULL,
    `register_date` TIMESTAMP NULL,
    `modify_id` BIGINT(20) NOT NULL,
    `modify_date` TIMESTAMP NULL,
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/* 이메일은 ID 값으로 받고 연락처도 user에 phone에서 받으면 되고*/
src/main/resources/mybatis/query-template/companyField-template.xml
New file
@@ -0,0 +1,40 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="kr.wisestone.owl.mapper.CompanyFieldMapper">
    <select id="find" resultType="java.util.HashMap" parameterType="kr.wisestone.owl.web.condition.CompanyFieldCondition">
        SELECT
        c.id as id,
        c.name as name,
        c.email as email,
        c.tel as tel,
        c.desc as desc
        FROM
        company c
        WHERE 1=1
        <if test="name != '' and name != null">
            AND c.name like CONCAT('%',#{name},'%')
        </if>
        <if test="id != '' and id != null">
            AND c.id like CONCAT('%',#{id},'%')
        </if>
        <if test="pageSize != '' and pageSize != null">
            limit #{pageSize} offset #{page};
        </if>
    </select>
    <select id="count" resultType="java.lang.Long" parameterType="kr.wisestone.owl.web.condition.CompanyFieldCondition">
        SELECT
        count(c.id)
        FROM
        company c
        WHERE 1=1
        <if test="name != '' and name != null">
            AND c.name like CONCAT('%',#{name},'%')
        </if>
        <if test="id != '' and id != null">
            AND c.id like CONCAT('%',#{id},'%')
        </if>
    </select>
</mapper>
src/main/webapp/WEB-INF/i18n/messages_ko_KR.properties
@@ -150,6 +150,10 @@
USER_RETURN_PASSWORD_NOT_PROVIDER_SOCIAL_JOIN_USER = \uBE44\uBC00\uBC88\uD638 \uCC3E\uAE30 \uAE30\uB2A5\uC744 \uC18C\uC15C \uACC4\uC815 \uAC00\uC785 \uC0AC\uC6A9\uC790\uB294 \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
USER_NOT_USE_ACTIVE_STATUS = \uC0AC\uC6A9\uC790\uB294 \uD65C\uC131 \uC0C1\uD0DC\uAC00 \uC544\uB2C8\uBA74 \uB85C\uADF8\uC778\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
USER_LEVEL_ALREADY_IN_USE = \uC120\uD0DD\uD55C \uC0AC\uC6A9\uC790 \uB4F1\uAE09\uC744 \uC774\uBBF8 \uC0AC\uC6A9\uD558\uACE0 \uC788\uB294 \uC0AC\uC6A9\uC790\uAC00 \uC788\uC2B5\uB2C8\uB2E4.
USER_LEVEL_PERMISSION_DENIED = \uC0AC\uC6A9\uC790 \uB4F1\uAE09 \uC815\uBCF4\uB97C \uC218\uC815\uD560\uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
USER_LEVEL_NOT_EXIST = \uC0AC\uC6A9\uC790 \uB4F1\uAE09\uC774 \uC874\uC7AC\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
USER_LEVEL_NOT_DELETE = \uAE30\uBCF8 \uC0AC\uC6A9\uC790 \uB4F1\uAE09\uC740 \uC0AD\uC81C\uD560\uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
USER_LEVEL_REMOVE_NOT_SELECT = \uC0AD\uC81C\uD560 \uC0AC\uC6A9\uC790 \uB4F1\uAE09\uC774 \uC120\uD0DD\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4.
EXCEL_NOT_EXTENSION = \uC5D1\uC140 \uD30C\uC77C \uD655\uC7A5\uC790 (xlsx)\uB9CC \uC5C5\uB85C\uB4DC\uAC00 \uAC00\uB2A5\uD569\uB2C8\uB2E4.
EXCEL_DOWNLOAD_MAX_ROWS_OVER = \uC5D1\uC140 \uB2E4\uC6B4\uB85C\uB4DC\uB294 1.000 \uAC74 \uAE4C\uC9C0\uB9CC \uAC00\uB2A5\uD569\uB2C8\uB2E4. \uAC80\uC0C9 \uC870\uAC74\uC744 \uC0AC\uC6A9\uD558\uC5EC \uC870\uD68C\uB418\uB294 \uBAA9\uB85D\uC744 1,000 \uAC74 \uC774\uD558\uB85C \uBCC0\uACBD\uD558\uC5EC \uB2E4\uC6B4\uB85C\uB4DC\uB97C \uC9C4\uD589\uD574\uC8FC\uC138\uC694.
@@ -191,4 +195,11 @@
EVENT_EMPTY_CONTENT=\uC774\uBCA4\uD2B8\uAC00 \uC81C\uBAA9 \uBC0F \uB0B4\uC6A9 \uC911 \uC785\uB825 \uAC12\uC774 \uC5C6\uB294 \uD544\uB4DC\uAC00 \uC788\uC2B5\uB2C8\uB2E4.
QNA_NOT_EXIST=QnA\uAC00 \uC874\uC7AC\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
QNA_EMPTY_CONTENT=QnA\uAC00 \uC81C\uBAA9 \uBC0F \uB0B4\uC6A9 \uC911 \uC785\uB825 \uAC12\uC774 \uC5C6\uB294 \uD544\uB4DC\uAC00 \uC788\uC2B5\uB2C8\uB2E4.
QNA_EMPTY_CONTENT=QnA\uAC00 \uC81C\uBAA9 \uBC0F \uB0B4\uC6A9 \uC911 \uC785\uB825 \uAC12\uC774 \uC5C6\uB294 \uD544\uB4DC\uAC00 \uC788\uC2B5\uB2C8\uB2E4.
DEPARTMENT_NOT_EXIST = \uBD80\uC11C\uAC00 \uC874\uC7AC\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
DEPARTMENT_ALREADY_IN_USE = \uC120\uD0DD\uD55C \uBD80\uC11C\uB294 \uC774\uBBF8 \uC0AC\uC6A9\uD558\uACE0 \uC788\uC2B5\uB2C8\uB2E4.
DEPARTMENT_REMOVE_NOT_SELECT = \uC0AD\uC81C\uD560 \uBD80\uC11C\uAC00 \uC120\uD0DD\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4.
COMPANY_REMOVE_NOT_SELECT = \uC0AD\uC81C\uD560 \uC5C5\uCCB4\uAC00 \uC120\uD0DD\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4.
COMPANYFIELD_NOT_EXIST = \uC5C5\uCCB4\uAC00 \uC874\uC7AC\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.