no message
parent
82320c60b2
commit
a8b73c2576
@ -1,114 +0,0 @@
|
||||
package cokr.xit.custom.boot;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.egovframe.rte.fdl.cmmn.trace.LeaveaTrace;
|
||||
import org.egovframe.rte.fdl.property.impl.EgovPropertyServiceImpl;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
|
||||
import org.springframework.util.AntPathMatcher;
|
||||
import org.springframework.web.servlet.i18n.SessionLocaleResolver;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser.Feature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
/**전자정부 프레임웤과 xit foundation을 사용하는 애플리케이션의 공통 Bean들을 설정한다.
|
||||
* @author mjkhan
|
||||
*/
|
||||
@Configuration
|
||||
@ComponentScan(basePackages = "cokr.xit")
|
||||
public class CommonConfig2 {
|
||||
/**AntPathMatcher를 반환한다.
|
||||
* @return AntPathMatcher
|
||||
*/
|
||||
@Bean
|
||||
public AntPathMatcher antPathMatcher() {
|
||||
return new AntPathMatcher();
|
||||
}
|
||||
|
||||
/**ObjectMapper를 반환한다.
|
||||
* @return ObjectMapper
|
||||
*/
|
||||
@Bean
|
||||
public ObjectMapper objectMapper() {
|
||||
ObjectMapper bean = new ObjectMapper();
|
||||
bean.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
|
||||
bean.configure(Feature.ALLOW_COMMENTS, true);
|
||||
return bean;
|
||||
}
|
||||
|
||||
/**SessionLocaleResolver를 반환한다.
|
||||
* @return SessionLocaleResolver
|
||||
*/
|
||||
@Bean(name="localeResolver")
|
||||
public SessionLocaleResolver localeResolver() {
|
||||
SessionLocaleResolver bean = new SessionLocaleResolver();
|
||||
bean.setDefaultLocale(Locale.getDefault());
|
||||
return bean;
|
||||
}
|
||||
|
||||
/**LeaveaTrace를 반환한다.
|
||||
* @return LeaveaTrace
|
||||
*/
|
||||
@Bean
|
||||
public LeaveaTrace leaveaTrace() {
|
||||
return new LeaveaTrace();
|
||||
}
|
||||
|
||||
private Yml2 yml = new Yml2("application.yml", "application.yml");
|
||||
|
||||
/**application.yml의 설정 내용을 읽어 MessageSource Bean을 설정하여 반환한다.
|
||||
* <pre><code> messageSource:
|
||||
* basenames:
|
||||
* - classpath:message/message-common
|
||||
* - classpath:message/authentication-message
|
||||
* - classpath:org/egovframe/rte/fdl/property/messages/properties</code></pre>
|
||||
* @return ReloadableResourceBundleMessageSource
|
||||
*/
|
||||
@Bean
|
||||
public ReloadableResourceBundleMessageSource messageSource() {
|
||||
ReloadableResourceBundleMessageSource bean = new ReloadableResourceBundleMessageSource();
|
||||
bean.setDefaultEncoding("UTF-8");
|
||||
bean.setCacheSeconds(60);
|
||||
|
||||
List<String> basenames = yml.getValues("messageSource.basenames");
|
||||
if (!basenames.isEmpty())
|
||||
bean.setBasenames(basenames.toArray(new String[basenames.size()]));
|
||||
|
||||
return bean;
|
||||
}
|
||||
|
||||
/**application.yml의 설정 내용을 읽어 EgovPropertyServiceImpl Bean을 설정하여 반환한다.
|
||||
* <pre><code> propertyService:
|
||||
* properties: # 인라인 프로퍼티가 있을 경우
|
||||
* - property0: value0
|
||||
* - property1: value1
|
||||
* extFileName: #외부 프로퍼티 파일이 있을 경우
|
||||
* - encoding: UTF-8
|
||||
* filename: classpath*:properties/your-file-01.properties
|
||||
* - encoding: UTF-8
|
||||
* filename: classpath*:properties/your-file-02.properties</code></pre>
|
||||
* @return EgovPropertyServiceImpl
|
||||
*/
|
||||
@Bean
|
||||
public EgovPropertyServiceImpl propertyService() {
|
||||
EgovPropertyServiceImpl bean = new EgovPropertyServiceImpl();
|
||||
|
||||
Map<String, String> properties = yml.getMap("propertyService.properties");
|
||||
if (!properties.isEmpty())
|
||||
bean.setProperties(properties);
|
||||
|
||||
Set<?> filenames = yml.getMaps("propertyService.extFileName").stream().collect(Collectors.toSet());
|
||||
if (!filenames.isEmpty())
|
||||
bean.setExtFileName(filenames);
|
||||
|
||||
return bean;
|
||||
}
|
||||
}
|
||||
@ -1,93 +0,0 @@
|
||||
package cokr.xit.custom.boot;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
|
||||
import org.springframework.web.servlet.view.json.MappingJackson2JsonView;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import cokr.xit.foundation.web.AccessInitializer;
|
||||
|
||||
@Configuration
|
||||
public class MvcConfig4 implements WebMvcConfigurer {
|
||||
protected static String[] URL_PATTERNS = {"/lvis/**/*"};
|
||||
@Resource(name = "staticResource")
|
||||
private StaticResourceConfig2 staticResource;
|
||||
|
||||
/**AccessInitializer를 반환한다.
|
||||
* @return AccessInitializer
|
||||
*/
|
||||
@Bean(name="accessInitializer2")
|
||||
public AccessInitializer accessInitializer() {
|
||||
return new AccessInitializer();
|
||||
}
|
||||
|
||||
@Value("${spring.web.resources.static-locations}")
|
||||
private String staticLocations;
|
||||
|
||||
/**정적 파일 자원 접근에 대한 설정을 추가한다.
|
||||
* <ul><li>url: /resources/** </li>
|
||||
* <li>위치: /resources/</li>
|
||||
* </ul>
|
||||
*/
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
staticResource.getMappings().forEach((k, v) ->
|
||||
registry
|
||||
.addResourceHandler(k)
|
||||
.addResourceLocations(v)
|
||||
);
|
||||
}
|
||||
|
||||
/**AccessInitializer를 interceptor로 추가한다.
|
||||
*/
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
registry.addInterceptor(accessInitializer()).addPathPatterns(URL_PATTERNS);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
private ObjectMapper objectMapper;
|
||||
|
||||
/**MappingJackson2JsonView를 반환한다.
|
||||
* @return MappingJackson2JsonView
|
||||
*/
|
||||
@Bean
|
||||
public MappingJackson2JsonView jsonView() {
|
||||
MappingJackson2JsonView bean = new MappingJackson2JsonView();
|
||||
bean.setContentType("application/json;charset=UTF-8");
|
||||
bean.setObjectMapper(objectMapper);
|
||||
return bean;
|
||||
}
|
||||
|
||||
/**CommonsMultipartResolver를 반환한다.
|
||||
* @return CommonsMultipartResolver
|
||||
*/
|
||||
@Bean
|
||||
public CommonsMultipartResolver multipartResolver() {
|
||||
CommonsMultipartResolver bean = new CommonsMultipartResolver();
|
||||
int oneGB = 1_073_741_824; // 1GB=1,073,741,824 byte
|
||||
bean.setMaxUploadSize(oneGB);
|
||||
bean.setMaxInMemorySize(oneGB);
|
||||
return bean;
|
||||
}
|
||||
|
||||
/**RequestMappingHandlerMapping을 반환한다.
|
||||
* @return RequestMappingHandlerMapping
|
||||
*/
|
||||
@Bean
|
||||
public RequestMappingHandlerMapping requestHandlers() {
|
||||
return new RequestMappingHandlerMapping();
|
||||
}
|
||||
}
|
||||
@ -1,70 +1,16 @@
|
||||
package cokr.xit.custom.boot;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.apache.catalina.Context;
|
||||
import org.apache.catalina.webresources.ExtractingRoot;
|
||||
import org.apache.cxf.transport.servlet.CXFServlet;
|
||||
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
|
||||
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.filter.CharacterEncodingFilter;
|
||||
|
||||
@Configuration
|
||||
public class ServletConfig2 {
|
||||
protected static String[] URL_PATTERNS = {"/","*.do"};
|
||||
@Resource(name = "staticResource")
|
||||
private StaticResourceConfig2 staticResource;
|
||||
|
||||
/**CharacterEncodingFilter를 등록한다.
|
||||
* @return FilterRegistrationBean
|
||||
*/
|
||||
@Bean
|
||||
public FilterRegistrationBean<CharacterEncodingFilter> encodingFilter() {
|
||||
FilterRegistrationBean<CharacterEncodingFilter> registration = new FilterRegistrationBean<>();
|
||||
registration.setFilter(new CharacterEncodingFilter("utf-8"));
|
||||
registration.addUrlPatterns(URL_PATTERNS);
|
||||
registration.setOrder(-102);
|
||||
return registration;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* @Bean public ServletRegistrationBean<DefaultServlet> defaultServlet() {
|
||||
* String[] urls = staticResource.getURLs(entry ->
|
||||
* !entry.getValue().startsWith("file:")); for (int i = 0; i <urls.length; ++i)
|
||||
* urls[i] = urls[i].replace("/**", "/*");
|
||||
*
|
||||
* ServletRegistrationBean<DefaultServlet> bean = new ServletRegistrationBean<>(
|
||||
* new DefaultServlet(), urls ); bean.setLoadOnStartup(2);
|
||||
* bean.setInitParameters(Map.of( "debug", "0", "listings", "false" ));
|
||||
*
|
||||
* return bean; }
|
||||
*/
|
||||
@Bean
|
||||
public WebServerFactoryCustomizer<TomcatServletWebServerFactory> servletContainerCustomizer() {
|
||||
return (TomcatServletWebServerFactory container) -> {
|
||||
container.addContextCustomizers((Context context) -> {
|
||||
context.setResources(new ExtractingRoot());
|
||||
context.setReloadable(false);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public ServletRegistrationBean<CXFServlet> cxfServlet() {
|
||||
return new ServletRegistrationBean<>(new CXFServlet(), "/lvis/services/*");
|
||||
}
|
||||
/*
|
||||
* @Bean public DispatcherServlet dispatcherServlet() { DispatcherServlet
|
||||
* dispatcherServlet = new DispatcherServlet();
|
||||
* dispatcherServlet.setThreadContextInheritable(true);
|
||||
* dispatcherServlet.setThrowExceptionIfNoHandlerFound(true); return
|
||||
* dispatcherServlet; }
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
@ -1,37 +0,0 @@
|
||||
package cokr.xit.custom.boot;
|
||||
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.WebApplicationType;
|
||||
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
|
||||
/**Spring Boot에서 xit-foundation.jar를 사용하는 stand-alone 애플리케이션의 베이스 클래스
|
||||
* <p>설정 파일을 추가하여 사용하는 경우 설정 파일은
|
||||
* <ul><li>클래스패스의 spring 폴더 아래에 있어야 하고</li>
|
||||
* <li>이름은 'context-'로 시작하는 xml이어야 한다</li>
|
||||
* <li>즉 classpath*:spring/context-*.xml 경로에 해당해야 한다.</li>
|
||||
* </ul>
|
||||
* @author mjkhan
|
||||
*/
|
||||
@SpringBootApplication(exclude = {
|
||||
WebMvcAutoConfiguration.class
|
||||
})
|
||||
@ImportAutoConfiguration({
|
||||
CommonConfig2.class,
|
||||
DatasourceConfig2.class,
|
||||
TransactionConfig2.class,
|
||||
})
|
||||
@ContextConfiguration("classpath:spring/context-*.xml")
|
||||
public class StandAloneApplication2 implements CommandLineRunner {
|
||||
@Override
|
||||
public void run(String... args) throws Exception {}
|
||||
|
||||
protected static void start(Class<?> klass, String... args) {
|
||||
SpringApplication app = new SpringApplication(klass);
|
||||
app.setWebApplicationType(WebApplicationType.NONE);
|
||||
app.run(args);
|
||||
}
|
||||
}
|
||||
@ -1,55 +0,0 @@
|
||||
package cokr.xit.custom.boot;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import cokr.xit.foundation.Assert;
|
||||
import cokr.xit.foundation.data.StringMap;
|
||||
|
||||
@Configuration("staticResource")
|
||||
public class StaticResourceConfig2 {
|
||||
@Value("${spring.mvc.static-path-pattern}")
|
||||
private String staticURLs;
|
||||
@Value("${spring.web.resources.static-locations}")
|
||||
private String staticLocations;
|
||||
|
||||
public Map<String, String> getMappings() {
|
||||
if (Assert.isEmpty(staticURLs) && Assert.isEmpty(staticLocations))
|
||||
return Collections.emptyMap();
|
||||
|
||||
List<String>
|
||||
urls = Arrays.asList(staticURLs.split(",")),
|
||||
locations = Arrays.asList(staticLocations.split(","));
|
||||
if (urls.size() != locations.size())
|
||||
throw new RuntimeException("URLs and locations do not match in size for static resources");
|
||||
|
||||
StringMap<String> resMap = new StringMap<>();
|
||||
for (int i = 0; i < urls.size(); ++i) {
|
||||
String url = urls.get(i),
|
||||
location = locations.get(i);
|
||||
resMap.put(url.trim(), location.trim());
|
||||
}
|
||||
|
||||
return resMap;
|
||||
}
|
||||
|
||||
public String[] getURLs(Predicate<Map.Entry<String, String>> filter) {
|
||||
Predicate<Map.Entry<String, String>> test = filter != null ? filter : entry -> true;
|
||||
List<String> urls = getMappings().entrySet().stream()
|
||||
.filter(test)
|
||||
.map(entry -> entry.getKey())
|
||||
.toList();
|
||||
return urls.toArray(new String[urls.size()]);
|
||||
}
|
||||
|
||||
public String[] getLocations() {
|
||||
List<String> locations = getMappings().values().stream().toList();
|
||||
return locations.toArray(new String[locations.size()]);
|
||||
}
|
||||
}
|
||||
@ -1,79 +0,0 @@
|
||||
package cokr.xit.custom.boot;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.springframework.aop.Advisor;
|
||||
import org.springframework.aop.aspectj.AspectJExpressionPointcut;
|
||||
import org.springframework.aop.support.DefaultPointcutAdvisor;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.EnableAspectJAutoProxy;
|
||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||
import org.springframework.transaction.TransactionDefinition;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
import org.springframework.transaction.interceptor.NameMatchTransactionAttributeSource;
|
||||
import org.springframework.transaction.interceptor.RollbackRuleAttribute;
|
||||
import org.springframework.transaction.interceptor.RuleBasedTransactionAttribute;
|
||||
import org.springframework.transaction.interceptor.TransactionInterceptor;
|
||||
|
||||
/**트랜잭션 설정 클래스.
|
||||
* <p>트랜잭션의 적용 대상은 cokr.xit..service.bean..*ServiceBean 클래스의 메소드들이다.
|
||||
* @author mjkhan
|
||||
*/
|
||||
@Configuration
|
||||
@Aspect
|
||||
@EnableTransactionManagement
|
||||
@EnableAspectJAutoProxy(proxyTargetClass = true)
|
||||
public class TransactionConfig2 {
|
||||
@Resource(name = "dataSource")
|
||||
private DataSource dataSource;
|
||||
|
||||
@Bean
|
||||
public DataSourceTransactionManager txManager() {
|
||||
DataSourceTransactionManager bean = new DataSourceTransactionManager();
|
||||
bean.setDataSource(dataSource);
|
||||
return bean;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public TransactionInterceptor txAdvice() {
|
||||
RuleBasedTransactionAttribute read = new RuleBasedTransactionAttribute(
|
||||
TransactionDefinition.PROPAGATION_REQUIRED,
|
||||
List.of(new RollbackRuleAttribute(Throwable.class))
|
||||
);
|
||||
read.setReadOnly(true);
|
||||
RuleBasedTransactionAttribute write = new RuleBasedTransactionAttribute(
|
||||
TransactionDefinition.PROPAGATION_REQUIRED,
|
||||
List.of(new RollbackRuleAttribute(Throwable.class))
|
||||
);
|
||||
|
||||
NameMatchTransactionAttributeSource txAttrSrc = new NameMatchTransactionAttributeSource();
|
||||
txAttrSrc.setNameMap(Map.of(
|
||||
"get*", read,
|
||||
"*", write
|
||||
));
|
||||
|
||||
TransactionInterceptor bean = new TransactionInterceptor();
|
||||
bean.setTransactionManager(txManager());
|
||||
bean.setTransactionAttributeSource(txAttrSrc);
|
||||
return bean;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Advisor txAdvisor() {
|
||||
String expression = "execution(* cokr.xit..service.bean.*ServiceBean.*(..))";
|
||||
AspectJExpressionPointcut requiredTx = new AspectJExpressionPointcut();
|
||||
requiredTx.setExpression(expression);
|
||||
|
||||
DefaultPointcutAdvisor bean = new DefaultPointcutAdvisor();
|
||||
bean.setPointcut(requiredTx);
|
||||
bean.setAdvice(txAdvice());
|
||||
|
||||
return bean;
|
||||
}
|
||||
}
|
||||
@ -1,19 +0,0 @@
|
||||
package cokr.xit.custom.boot;
|
||||
|
||||
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
|
||||
|
||||
@SpringBootApplication
|
||||
@ImportAutoConfiguration({
|
||||
WebServiceConfig.class,
|
||||
CommonConfig2.class,
|
||||
DatasourceConfig2.class,
|
||||
TransactionConfig2.class,
|
||||
ServletConfig2.class
|
||||
})
|
||||
@ContextConfiguration("classpath:spring/context-*.xml")
|
||||
public class XitBaseApplication2 {
|
||||
|
||||
}
|
||||
@ -1,130 +0,0 @@
|
||||
package cokr.xit.custom.boot;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.boot.env.YamlPropertySourceLoader;
|
||||
import org.springframework.core.env.PropertySource;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
|
||||
import cokr.xit.foundation.Assert;
|
||||
|
||||
/**yml 파일 내용을 프로퍼티 형식으로 읽기를 지원하는 유틸리티.
|
||||
* <p>
|
||||
* @author mjkhan
|
||||
*/
|
||||
public class Yml2 {
|
||||
private Map<String, ?> source;
|
||||
|
||||
/**새 Yml을 생성한다.
|
||||
* @param rootName 프로퍼티 소스의 루트 이름
|
||||
* @param path 클래스패스에서 yml 파일의 경로
|
||||
*/
|
||||
public Yml2(String rootName, String path) {
|
||||
load(rootName, path);
|
||||
}
|
||||
|
||||
/**지정하는 yml 파일의 프로퍼티들을 읽어들인다.
|
||||
* @param rootName 프로퍼티 소스의 루트 이름
|
||||
* @param path 클래스패스에서 yml 파일의 경로
|
||||
* @return 현재 Yml
|
||||
*/
|
||||
public Yml2 load(String rootName, String path) {
|
||||
source = null;
|
||||
try {
|
||||
List<PropertySource<?>> sources = new YamlPropertySourceLoader()
|
||||
.load(rootName, new ClassPathResource(path));
|
||||
if (!sources.isEmpty())
|
||||
source = (Map<String, ?>)sources.get(0).getSource();
|
||||
return this;
|
||||
} catch (Exception e) {
|
||||
throw Assert.runtimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**지정하는 프로퍼티(아래 참고)의 값을 반환한다.
|
||||
* @param key 키. 프로퍼티 이름
|
||||
* <pre><code> spring:
|
||||
* application:
|
||||
* name: my-application
|
||||
* </code></pre>
|
||||
* @return 지정하는 키의 프로퍼티 값
|
||||
*/
|
||||
public String getValue(String key) {
|
||||
if (source == null) return "";
|
||||
|
||||
Object obj = source.get(key);
|
||||
return obj != null ? obj.toString() : "";
|
||||
}
|
||||
|
||||
/**지정하는 문자열로 시작하는 프로퍼티(아래 참고) 값들을 반환한다.
|
||||
* <pre><code> list:
|
||||
* - item-0
|
||||
* - item-2
|
||||
* - item-3</code></pre>
|
||||
* @param prefix 프로퍼티 접두어
|
||||
* @return 지정하는 문자열로 시작하는 프로퍼티 값
|
||||
*/
|
||||
public List<String> getValues(String prefix) {
|
||||
if (source == null) return Collections.emptyList();
|
||||
|
||||
return getPrefixed(prefix).stream()
|
||||
.map(entry -> entry.getValue().toString())
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private List<Map.Entry<String, ?>> getPrefixed(String prefix) {
|
||||
return source.entrySet().stream()
|
||||
.filter(entry -> entry.getKey().startsWith(prefix))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**지정하는 문자열로 시작하는 프로퍼티(아래 참고) 값들을 Map으로 반환한다.
|
||||
* <pre><code> parent:
|
||||
* - property-0: value-0
|
||||
* - property-1: value-1
|
||||
* - property-2: value-2</code></pre>
|
||||
* @param prefix 프로퍼티 접두어
|
||||
* @return 지정하는 문자열로 시작하는 프로퍼티로 된 Map
|
||||
*/
|
||||
public Map<String, String> getMap(String prefix) {
|
||||
if (source == null) return Collections.emptyMap();
|
||||
|
||||
LinkedHashMap<String, String> map = new LinkedHashMap<>();
|
||||
getPrefixed(prefix).stream().forEach(entry -> putTo(map, entry));
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
private void putTo(LinkedHashMap<String, String> map, Map.Entry<String, ?> entry) {
|
||||
String key = entry.getKey();
|
||||
key = key.substring(key.lastIndexOf(".") + 1);
|
||||
String val = entry.getValue().toString();
|
||||
map.put(key, val);
|
||||
}
|
||||
|
||||
/**지정하는 문자열로 시작하는 프로퍼티들(아래 참고)을 Map 목록으로 반환한다.
|
||||
* <pre><code> parent:
|
||||
* - property-0: value-0.0
|
||||
* property-1: value-0.1
|
||||
* - property-0: value-1.0
|
||||
* property-1: value-1.1</code></pre>
|
||||
* @param prefix 프로퍼티 접두어
|
||||
* @return 지정하는 문자열로 시작하는 프로퍼티들의 Map 목록
|
||||
*/
|
||||
public List<Map<String, String>> getMaps(String prefix) {
|
||||
if (source == null) return Collections.emptyList();
|
||||
|
||||
return getPrefixed(prefix).stream()
|
||||
.map(entry -> {
|
||||
String str = entry.getKey();
|
||||
return str.substring(0, str.lastIndexOf("."));
|
||||
})
|
||||
.collect(Collectors.toSet()).stream()
|
||||
.map(this::getMap)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
@ -1,230 +0,0 @@
|
||||
<?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.code.dao.CodeMapper">
|
||||
|
||||
<resultMap id="categoryRow" type="cokr.xit.base.code.CodeCategory">
|
||||
<result property="id" column="CTGR_ID"/>
|
||||
<result property="name" column="CTGR_NM"/>
|
||||
<result property="description" column="DSCRP"/>
|
||||
<result property="createdAt" column="REG_DT"/>
|
||||
<result property="createdBy" column="RGTR"/>
|
||||
<result property="lastModified" column="MDFCN_DT"/>
|
||||
<result property="modifiedBy" column="MDFR"/>
|
||||
<result property="useYN" column="USE_YN"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="groupRow" type="cokr.xit.base.code.CodeGroup">
|
||||
<result property="id" column="GRP_ID"/>
|
||||
<result property="name" column="GRP_NM"/>
|
||||
<result property="categoryID" column="CTGR_ID"/>
|
||||
<result property="description" column="DSCRP"/>
|
||||
<result property="createdAt" column="REG_DT"/>
|
||||
<result property="createdBy" column="RGTR"/>
|
||||
<result property="lastModified" column="MDFCN_DT"/>
|
||||
<result property="modifiedBy" column="MDFR"/>
|
||||
<result property="useYN" column="USE_YN"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="codeRow" type="cokr.xit.base.code.CommonCode">
|
||||
<result property="groupID" column="GRP_ID"/>
|
||||
<result property="code" column="CODE"/>
|
||||
<result property="value" column="CODE_VAL"/>
|
||||
<result property="description" column="DSCRP"/>
|
||||
<result property="etc1" column="ETC_1"/>
|
||||
<result property="etc2" column="ETC_2"/>
|
||||
<result property="etc3" column="ETC_3"/>
|
||||
<result property="sortOrder" column="SRT_ORD"/>
|
||||
<result property="createdAt" column="REG_DT"/>
|
||||
<result property="createdBy" column="RGTR"/>
|
||||
<result property="lastModified" column="MDFCN_DT"/>
|
||||
<result property="modifiedBy" column="MDFR"/>
|
||||
<result property="useYN" column="USE_YN"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectCategories"><include refid="utility.paging-prefix" />
|
||||
SELECT *
|
||||
FROM TB_CODE_CTGR
|
||||
WHERE USE_YN = 'Y'
|
||||
<if test="categoryIDs != null"> AND CTGR_ID IN (<foreach collection="categoryIDs" item="categoryID" separator=",">#{categoryID}</foreach>)</if>
|
||||
<include refid="utility.orderBy" />
|
||||
<include refid="utility.paging-suffix" /></sql>
|
||||
|
||||
<select id="getCategoryList" parameterType="map" resultType="dataobject">/* 코드 카테고리 목록 조회(codeMapper.getCategoryList) */
|
||||
<include refid="selectCategories" /></select>
|
||||
|
||||
<select id="getCategories" parameterType="map" resultMap="categoryRow">/*코드 카테고리 가져오기(codeMapper.getCategories)*/
|
||||
<include refid="selectCategories" /></select>
|
||||
|
||||
<insert id="insertCategory" parameterType="map">/* 코드 카테고리 등록(codeMapper.insertCategory) */
|
||||
INSERT INTO TB_CODE_CTGR (
|
||||
CTGR_ID
|
||||
, CTGR_NM
|
||||
, DSCRP
|
||||
, REG_DT
|
||||
, RGTR
|
||||
, MDFCN_DT
|
||||
, MDFR
|
||||
, USE_YN
|
||||
) VALUES (
|
||||
#{category.id}
|
||||
, #{category.name}
|
||||
, #{category.description}
|
||||
,<include refid="utility.now" />
|
||||
, #{currentUser.id}
|
||||
,<include refid="utility.now" />
|
||||
, #{currentUser.id}
|
||||
, 'Y'
|
||||
)</insert>
|
||||
|
||||
<update id="updateCategory" parameterType="map">/* 코드 카테고리 수정(codeMapper.updateCategory) */
|
||||
UPDATE TB_CODE_CTGR SET
|
||||
CTGR_NM = #{category.name}
|
||||
, DSCRP = #{category.description}
|
||||
, MDFCN_DT =<include refid="utility.now" />
|
||||
, MDFR = #{currentUser.id}
|
||||
WHERE CTGR_ID = #{category.id}</update>
|
||||
|
||||
<delete id="removeCategories" parameterType="map">/* 코드 카테고리 제거(codeMapper.removeCategories) */
|
||||
UPDATE TB_CODE_CTGR SET
|
||||
MDFCN_DT =<include refid="utility.now" />
|
||||
, MDFR = #{currentUser.id}
|
||||
, USE_YN = 'N'
|
||||
<if test='categoryIDs != null'>WHERE CTGR_ID IN (<foreach collection="categoryIDs" item="categoryID" separator=",">#{categoryID}</foreach>)</if></delete>
|
||||
|
||||
<sql id="selectGroups"><include refid="utility.paging-prefix" />
|
||||
SELECT *
|
||||
FROM TB_CODE_GRP
|
||||
WHERE USE_YN = 'Y'
|
||||
<if test="categoryIDs != null">AND CTGR_ID IN (<foreach collection="categoryIDs" item="categoryID" separator=",">#{categoryID}</foreach>)</if>
|
||||
<if test="groupIDs != null">AND GRP_ID IN (<foreach collection="groupIDs" item="groupID" separator=",">#{groupID}</foreach>)</if>
|
||||
<include refid="utility.orderBy" />
|
||||
<include refid="utility.paging-suffix" /></sql>
|
||||
|
||||
<select id="getGroupList" parameterType="dataobject" resultType="dataobject">/* 코드그룹 목록 조회(codeMapper.getGroupList) */
|
||||
<include refid="selectGroups" /></select>
|
||||
|
||||
<select id="getGroups" parameterType="map" resultMap="groupRow">/* 코드그룹 가져오기(codeMapper.getGroups) */
|
||||
<include refid="selectGroups" /></select>
|
||||
|
||||
<insert id="insertGroup" parameterType="map">/* 코드그룹 등록(codeMapper.insertGroup) */
|
||||
INSERT INTO TB_CODE_GRP (
|
||||
GRP_ID
|
||||
, GRP_NM
|
||||
, CTGR_ID
|
||||
, DSCRP
|
||||
, REG_DT
|
||||
, RGTR
|
||||
, MDFCN_DT
|
||||
, MDFR
|
||||
, USE_YN
|
||||
) VALUES (
|
||||
#{group.id}
|
||||
, #{group.name}
|
||||
, #{group.categoryID}
|
||||
, #{group.description}
|
||||
,<include refid="utility.now" />
|
||||
, #{currentUser.id}
|
||||
,<include refid="utility.now" />
|
||||
, #{currentUser.id}
|
||||
, 'Y'
|
||||
)</insert>
|
||||
|
||||
<update id="updateGroup" parameterType="map">/* 코드그룹 수정(codeMapper.updateGroup) */
|
||||
UPDATE TB_CODE_GRP SET
|
||||
GRP_NM = #{group.name}
|
||||
, CTGR_ID = #{group.categoryID}
|
||||
, DSCRP = #{group.description}
|
||||
, MDFCN_DT =<include refid="utility.now" />
|
||||
, MDFR = #{currentUser.id}
|
||||
WHERE GRP_ID = #{group.id}</update>
|
||||
|
||||
<update id="removeGroups" parameterType="map">/*코드그룹 제거(codeMapper.removeGroups) */
|
||||
UPDATE TB_CODE_GRP SET
|
||||
USE_YN = 'N'
|
||||
, MDFCN_DT =<include refid="utility.now" />
|
||||
, MDFR = #{currentUser.id}
|
||||
<where>
|
||||
<if test="categoryIDs != null">CTGR_ID IN (<foreach collection="categoryIDs" item="categoryID" separator=",">#{categoryID}</foreach>)</if>
|
||||
<if test="groupIDs != null">GRP_ID IN (<foreach collection="groupIDs" item="groupID" separator=",">#{groupID}</foreach>)</if>
|
||||
</where></update>
|
||||
|
||||
<sql id="selectCodes"><include refid="utility.paging-prefix" />
|
||||
SELECT *
|
||||
FROM TB_CMN_CODE
|
||||
WHERE USE_YN = 'Y'
|
||||
<if test='groupIDs != null'>AND GRP_ID IN (<foreach collection="groupIDs" item="groupID" separator=",">#{groupID}</foreach>)</if>
|
||||
<if test='codes != null'>AND CODE IN (<foreach collection="codes" item="code" separator=",">#{code}</foreach>)</if>
|
||||
<include refid="utility.orderBy" />
|
||||
<include refid="utility.paging-suffix" /></sql>
|
||||
|
||||
<select id="getCodeList" parameterType="map" resultType="dataobject">/* 그룹별 코드 가져오기(codeMapper.getCodeList) */
|
||||
<include refid="selectCodes" /></select>
|
||||
|
||||
<select id="getCodes" parameterType="map" resultMap="codeRow">/* 코드 가져오기(codeMapper.getCodes) */
|
||||
<include refid="selectCodes" /></select>
|
||||
|
||||
<insert id="insertCode" parameterType="map">/* 코드 등록(codeMapper.insertCode) */
|
||||
INSERT INTO TB_CMN_CODE (
|
||||
GRP_ID
|
||||
, CODE
|
||||
, CODE_VAL
|
||||
, DSCRP
|
||||
, ETC_1
|
||||
, ETC_2
|
||||
, ETC_3
|
||||
, SRT_ORD
|
||||
, REG_DT
|
||||
, RGTR
|
||||
, MDFCN_DT
|
||||
, MDFR
|
||||
, USE_YN
|
||||
) VALUES (
|
||||
#{code.groupID}
|
||||
, #{code.code}
|
||||
, #{code.value}
|
||||
, #{code.description}
|
||||
, #{code.etc1}
|
||||
, #{code.etc2}
|
||||
, #{code.etc3}
|
||||
, #{code.sortOrder}
|
||||
,<include refid="utility.now" />
|
||||
, #{currentUser.id}
|
||||
,<include refid="utility.now" />
|
||||
, #{currentUser.id}
|
||||
, 'Y'
|
||||
)</insert>
|
||||
|
||||
<update id="updateCode" parameterType="map">/* 코드 수정(codeMapper.updateCode) */
|
||||
UPDATE TB_CMN_CODE SET
|
||||
CODE_VAL = #{code.value}
|
||||
, DSCRP = #{code.description}
|
||||
, ETC_1 = #{code.etc1}
|
||||
, ETC_2 = #{code.etc2}
|
||||
, ETC_3 = #{code.etc3}
|
||||
, MDFCN_DT =<include refid="utility.now" />
|
||||
, MDFR = #{currentUser.id}
|
||||
WHERE GRP_ID = #{code.groupID}
|
||||
AND CODE = #{code.code}</update>
|
||||
|
||||
<update id="reorderCodes" parameterType="map">/* 코드 정렬순서 변경(codeMapper.reorderCodes) */
|
||||
UPDATE TB_CMN_CODE SET
|
||||
SRT_ORD = CASE CODE<foreach collection="codes" item="code" index="index" separator=" ">
|
||||
WHEN #{code} THEN #{index}</foreach>
|
||||
ELSE SRT_ORD
|
||||
END
|
||||
, MDFCN_DT =<include refid="utility.now" />
|
||||
, MDFR = #{currentUser.id}
|
||||
WHERE GRP_ID = #{groupID}
|
||||
AND CODE IN (<foreach collection="codes" item="code" separator=",">#{code}</foreach>)</update>
|
||||
|
||||
<update id="removeCodes" parameterType="map">/* 코드 제거(codeMapper.removeCodes) */
|
||||
UPDATE TB_CMN_CODE SET
|
||||
MDFCN_DT =<include refid="utility.now" />
|
||||
, MDFR = #{currentUser.id}
|
||||
, USE_YN = 'N'
|
||||
<where>
|
||||
<if test="groupIDs != null">AND GRP_ID IN (<foreach collection="groupIDs" item="groupID" separator=",">#{groupID}</foreach>)</if>
|
||||
<if test="codes != null">AND CODE IN (<foreach collection="codes" item="code" separator=",">#{code}</foreach>) </if>
|
||||
</where></update>
|
||||
|
||||
</mapper>
|
||||
@ -1,130 +0,0 @@
|
||||
<?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.file.dao.FileMapper">
|
||||
|
||||
<resultMap id="fileRow" type="cokr.xit.base.file.FileInfo">
|
||||
<result property="id" column="FILE_ID"/>
|
||||
<result property="infoType" column="INF_TYPE"/>
|
||||
<result property="infoKey" column="INF_KEY"/>
|
||||
<result property="subType" column="SUB_TYPE"/>
|
||||
<result property="name" column="FILE_NM"/>
|
||||
<result property="path" column="FILE_PATH"/>
|
||||
<result property="url" column="URL"/>
|
||||
<result property="mimeType" column="MIME_TYPE"/>
|
||||
<result property="size" column="FILE_SIZE"/>
|
||||
<result property="downloadCount" column="DNLD_CNT"/>
|
||||
<result property="sortOrder" column="SRT_ORD"/>
|
||||
<result property="createdAt" column="REG_DT"/>
|
||||
<result property="createdBy" column="RGTR"/>
|
||||
<result property="useYN" column="USE_YN"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="fileDirs">SELECT INF_TYPE
|
||||
, CONCAT('files/', DIR, DATE_FORMAT(CURRENT_DATE, '/%Y/%m/%d/')) DIR
|
||||
FROM (
|
||||
SELECT '010' INF_TYPE, 'interface/attachment/smg' DIR UNION <!-- 국민 신문고 -->
|
||||
SELECT '020' INF_TYPE, 'interface/attachment/saeol' DIR UNION <!-- 세올 -->
|
||||
SELECT '030' INF_TYPE, 'interface/attachment/epost' DIR UNION <!-- epost -->
|
||||
|
||||
SELECT '100' INF_TYPE, 'attachment/violation' DIR UNION <!-- 단속 정보 -->
|
||||
SELECT '110' INF_TYPE, 'attachment/opinion' DIR UNION <!-- 의견 진술 -->
|
||||
SELECT '190' INF_TYPE, 'attachment/capture' DIR <!-- 캡쳐용 동영상 -->
|
||||
) FILE_DIRS</sql>
|
||||
|
||||
<sql id="selectFiles">
|
||||
<if test="fileIDs != null">
|
||||
SELECT A.*, FILE_PATH URL
|
||||
FROM TB_FILE A
|
||||
WHERE FILE_ID IN (<foreach collection="fileIDs" item="fileID" separator=",">#{fileID}</foreach>)
|
||||
ORDER BY FILE_ID</if>
|
||||
<if test="fileIDs == null"><include refid="utility.paging-prefix" />
|
||||
SELECT A.*, FILE_PATH URL
|
||||
FROM TB_FILE A
|
||||
<where>
|
||||
<if test="infoType != null"> AND A.INF_TYPE = #{infoType}</if>
|
||||
<if test="infoKeys != null"> AND INF_KEY IN (<foreach collection="infoKeys" item="infoKey" separator=",">#{infoKey}</foreach>)</if>
|
||||
AND USE_YN = 'Y'
|
||||
</where>
|
||||
<include refid="utility.orderBy" />
|
||||
<include refid="utility.paging-suffix" /></if></sql>
|
||||
|
||||
<select id="getFileList" parameterType="map" resultType="dataobject">/* 파일 목록 조회(fileMapper.getFileList) */
|
||||
<include refid="selectFiles" /></select>
|
||||
|
||||
<select id="getFilesOf" parameterType="map" resultMap="fileRow">/* 파일 가져오기(fileMapper.getFilesOf) */
|
||||
<include refid="selectFiles" /></select>
|
||||
|
||||
<select id="getFiles" parameterType="map" resultMap="fileRow">/* 파일 가져오기(fileMapper.getFiles) */
|
||||
<include refid="selectFiles" /></select>
|
||||
|
||||
<insert id="insertFile" parameterType="map">/* 파일 등록(fileMapper.insertFile) */
|
||||
<selectKey keyProperty="file.id,file.path" keyColumn="NEW_ID,PATH" resultType="map" order="BEFORE">
|
||||
SELECT NEW_ID, CONCAT(DIR, NEW_ID, '.', #{file.extension}) PATH
|
||||
FROM (
|
||||
SELECT IFNULL(MAX(FILE_ID) + 1, CONCAT(THIS_DAY, '00001')) NEW_ID
|
||||
FROM TB_FILE A, (<include refid="utility.selectThisDay" />) B
|
||||
WHERE FILE_ID LIKE CONCAT(THIS_DAY, '%')
|
||||
) T1, (
|
||||
<include refid="fileDirs" />
|
||||
WHERE INF_TYPE = #{file.infoType}
|
||||
) T2</selectKey>
|
||||
INSERT INTO TB_FILE (
|
||||
FILE_ID
|
||||
, INF_TYPE
|
||||
, INF_KEY
|
||||
, SUB_TYPE
|
||||
, FILE_NM
|
||||
, FILE_PATH
|
||||
, MIME_TYPE
|
||||
, FILE_SIZE
|
||||
, DNLD_CNT
|
||||
, SRT_ORD
|
||||
, RGTR
|
||||
, REG_DT
|
||||
, USE_YN
|
||||
) VALUES (
|
||||
#{file.id}
|
||||
, #{file.infoType}
|
||||
, #{file.infoKey}
|
||||
, #{file.subType}
|
||||
, #{file.name}
|
||||
, #{file.path}
|
||||
, #{file.mimeType}
|
||||
, #{file.size}
|
||||
, #{file.downloadCount}
|
||||
, #{file.sortOrder}
|
||||
, #{currentUser.id}
|
||||
,<include refid="utility.now" />
|
||||
, 'Y'
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="reorder" parameterType="map">/* 파일 순서 변경(fileMapper.reorder) */
|
||||
UPDATE TB_FILE SET
|
||||
SRT_ORD = CASE FILE_ID
|
||||
<foreach collection="fileIDs" item="fileID" index="index" separator=" ">WHEN #{fileID} THEN #{index}
|
||||
</foreach>
|
||||
ELSE SRT_ORD END
|
||||
WHERE FILE_ID IN (<foreach collection="fileIDs" item="fileID" separator=",">#{fileID}</foreach>)</update>
|
||||
|
||||
<update id="updateDownloadCount" parameterType="map">/* 다운로드 횟수 증가(fileMapper.updateDownloadCount) */
|
||||
UPDATE TB_FILE SET
|
||||
DNLD_CNT = DNLD_CNT + 1
|
||||
WHERE USE_YN = 'Y'
|
||||
AND FILE_ID IN (<foreach collection="fileIDs" item="fileID" separator=",">#{fileID}</foreach>)</update>
|
||||
|
||||
<update id="removeFiles" parameterType="map">/* 파일 제거(fileMapper.removeFiles) */
|
||||
UPDATE TB_FILE SET
|
||||
USE_YN = 'N'
|
||||
WHERE USE_YN = 'Y'
|
||||
<if test="fileIDs != null"> AND FILE_ID IN (<foreach collection="fileIDs" item="fileID" separator=",">#{fileID}</foreach>)</if>
|
||||
<if test="infoKeys != null">
|
||||
AND INF_TYPE = #{infoType}
|
||||
AND INF_KEY IN (<foreach collection="infoKeys" item="infoKey" separator=",">#{infoKey}</foreach>)</if></update>
|
||||
|
||||
<delete id="deleteFiles" parameterType="map">/* 파일 삭제(fileMapper.deleteFiles) */
|
||||
DELETE FROM TB_FILE
|
||||
<if test="fileIDs != null">WHERE FILE_ID IN (<foreach collection="fileIDs" item="fileID" separator=",">#{fileID}</foreach>)</if>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
@ -1,94 +0,0 @@
|
||||
<?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.menu.dao.MenuMapper">
|
||||
|
||||
<resultMap id="menuRow" type="cokr.xit.base.menu.Menu">
|
||||
<result property="id" column="MENU_NO"/>
|
||||
<result property="name" column="MENU_NM"/>
|
||||
<result property="programFilename" column="PGRM_FILE_NM"/>
|
||||
<result property="action" column="ACTION"/>
|
||||
<result property="description" column="DSCRP"/>
|
||||
<result property="parentID" column="PRNT_NO"/>
|
||||
<result property="imageName" column="IMG_NM"/>
|
||||
<result property="imageConf" column="IMG_CNF"/>
|
||||
<result property="sortOrder" column="SRT_ORD"/>
|
||||
<result property="createdAt" column="REG_DT"/>
|
||||
<result property="createdBy" column="RGTR"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectMenus">
|
||||
SELECT A.*
|
||||
FROM TB_MENU A
|
||||
<if test='menuID != null'>WHERE MENU_NO = #{menuID}</if>
|
||||
ORDER BY PRNT_NO, SRT_ORD, MENU_NO</sql>
|
||||
|
||||
<select id="getMenus" parameterType="map" resultMap="menuRow">/* 메뉴 정보 조회(menuMapper.getMenus) */
|
||||
<include refid="selectMenus" /></select>
|
||||
|
||||
<select id="getMenu" parameterType="int" resultMap="menuRow">/* 메뉴 가져오기(menuMapper.getMenu) */
|
||||
<include refid="selectMenus" /></select>
|
||||
|
||||
<insert id="insertMenu" parameterType="map">/* 메뉴 등록(menuMapper.insertMenu) */
|
||||
<selectKey order="BEFORE" resultType="map" keyColumn="NEW_NO,NEW_ORD" keyProperty="menu.id,menu.sortOrder">
|
||||
SELECT NEW_NO, NEW_ORD
|
||||
FROM (SELECT IFNULL(MAX(MENU_NO) + 1, 0) NEW_NO FROM TB_MENU) A,
|
||||
(<include refid="newSortOrder" />) B</selectKey>
|
||||
INSERT INTO TB_MENU (
|
||||
MENU_NO
|
||||
, MENU_NM
|
||||
, PRNT_NO
|
||||
, PGRM_FILE_NM
|
||||
, ACTION
|
||||
, DSCRP
|
||||
, IMG_NM
|
||||
, IMG_CNF
|
||||
, SRT_ORD
|
||||
, REG_DT
|
||||
, RGTR
|
||||
) VALUES (
|
||||
#{menu.id}
|
||||
, #{menu.name}
|
||||
, #{menu.parentID}
|
||||
, #{menu.programFilename}
|
||||
, #{menu.action}
|
||||
, #{menu.description}
|
||||
, #{menu.imageName}
|
||||
, #{menu.imageConf}
|
||||
, #{menu.sortOrder}
|
||||
,<include refid="utility.now" />
|
||||
, #{currentUser.id}
|
||||
)</insert>
|
||||
|
||||
<update id="updateMenu" parameterType="map">/* 메뉴 수정(menuMapper.updateMenu) */
|
||||
UPDATE TB_MENU SET
|
||||
MENU_NM = #{menu.name}
|
||||
, PGRM_FILE_NM = #{menu.programFilename}
|
||||
, ACTION = #{menu.action}
|
||||
, DSCRP = #{menu.description}
|
||||
, IMG_NM = #{menu.imageName}
|
||||
, IMG_CNF = #{menu.imageConf}
|
||||
WHERE MENU_NO = #{menu.id}</update>
|
||||
|
||||
<sql id="newSortOrder">SELECT IFNULL(MAX(SRT_ORD) + 1, 0) NEW_ORD FROM TB_MENU WHERE PRNT_NO = IFNULL(#{parentID}, IFNULL(#{menu.parentID}, 0))</sql>
|
||||
|
||||
<update id="moveMenus" parameterType="map">/* 메뉴 이동(menuMapper.moveMenus) */
|
||||
UPDATE TB_MENU SET
|
||||
PRNT_NO = #{parentID}
|
||||
, SRT_ORD = SRT_ORD + (<include refid="newSortOrder" />)
|
||||
WHERE MENU_NO IN (<foreach collection="menuIDs" item="menuID" separator=",">#{menuID}</foreach>)
|
||||
</update>
|
||||
|
||||
<update id="reorderMenus" parameterType="map">/* 메뉴 순서 변경(menuMapper.reorderMenus) */
|
||||
UPDATE TB_MENU SET
|
||||
SRT_ORD = CASE MENU_NO
|
||||
<foreach collection="menuIDs" item="menuID" index="index">WHEN #{menuID} THEN #{index}
|
||||
</foreach>
|
||||
ELSE MENU_NO END
|
||||
WHERE MENU_NO IN (<foreach collection="menuIDs" item="menuID" separator=",">#{menuID}</foreach>)</update>
|
||||
|
||||
<delete id="removeMenus" parameterType="map">/* 메뉴 제거(menuMapper.removeMenus) */
|
||||
DELETE FROM TB_MENU
|
||||
WHERE MENU_NO IN (<foreach collection="menuIDs" item="menuID" separator=",">#{menuID}</foreach>)
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
@ -1,135 +0,0 @@
|
||||
<?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="program">
|
||||
|
||||
<resultMap id="programRow" type="cokr.xit.base.menu.Program">
|
||||
<result property="filename" column="PGRM_FILE_NM"/>
|
||||
<result property="location" column="PGRM_FILE_PATH"/>
|
||||
<result property="name" column="PGRM_NM"/>
|
||||
<result property="description" column="DSCRP"/>
|
||||
<result property="url" column="URL"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="reqRow" type="cokr.xit.base.menu.ChangeRequest">
|
||||
<result property="filename" column="PGRM_FILE_NM"/>
|
||||
<result property="id" column="REQ_ID"/>
|
||||
<result property="subject" column="SUBJECT"/>
|
||||
<result property="requestorID" column="REQ_USER"/>
|
||||
<result property="requestDate" column="REQ_DT"/>
|
||||
<result property="requestDetail" column="REQ_CNTNT"/>
|
||||
<result property="processorID" column="PRSC_USER"/>
|
||||
<result property="processDate" column="PRCS_DT"/>
|
||||
<result property="processDetail" column="PRCS_CNTNT"/>
|
||||
<result property="status" column="PRCS_STATUS"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectPrograms">
|
||||
<include refid="utility.paging-prefix"/>
|
||||
SELECT A.*
|
||||
FROM TB_PROGRAM A
|
||||
<where>
|
||||
<if test="by != null and term != null">${by} LIKE CONCAT('%', #{term}, '%')</if>
|
||||
<if test='filenames != null'>PGRM_FILE_NM IN (<foreach collection="filenames" item="filename" separator=",">#{filename}</foreach>)</if>
|
||||
</where>
|
||||
ORDER BY<if test='by != null'>${by}</if><if test='by == null'>PGRM_FILE_NM</if>
|
||||
<include refid="utility.paging-suffix"/></sql>
|
||||
|
||||
<select id="getProgramList" parameterType="map" resultType="dataobject">/* 프로그램 목록 조회(program.getProgramList) */
|
||||
<include refid="selectPrograms"/></select>
|
||||
|
||||
<select id="getPrograms" parameterType="map" resultMap="programRow">/* 프로그램 가져오기(program.getPrograms) */
|
||||
<include refid="selectPrograms"/></select>
|
||||
|
||||
<insert id="insertProgram" parameterType="cokr.xit.base.menu.Program">/* 프로그램 등록(program.insertProgram) */
|
||||
INSERT INTO TB_PROGRAM (
|
||||
PGRM_FILE_NM
|
||||
, PGRM_FILE_PATH
|
||||
, PGRM_NM
|
||||
, DSCRP
|
||||
, URL
|
||||
) VALUES (
|
||||
#{filename}
|
||||
, #{location}
|
||||
, #{name}
|
||||
, #{description}
|
||||
, #{url}
|
||||
)</insert>
|
||||
|
||||
<update id="updateProgram" parameterType="cokr.xit.base.menu.Program">/* 프로그램 수정(program.updateProgram) */
|
||||
UPDATE TB_PROGRAM SET
|
||||
PGRM_FILE_PATH = #{location}
|
||||
, PGRM_NM = #{name}
|
||||
, DSCRP = #{description}
|
||||
, URL = #{url}
|
||||
WHERE PGRM_FILE_NM = #{filename}</update>
|
||||
|
||||
<delete id="removePrograms" parameterType="map">/* 프로그램 삭제(program.removePrograms) */
|
||||
DELETE FROM TB_PROGRAM
|
||||
WHERE PGRM_FILE_NM IN (<foreach collection="filenames" item="filename" separator=",">#{filename}</foreach>)</delete>
|
||||
|
||||
<delete id="clearPrograms" parameterType="map">/* 프로그램 비우기(program.clearPrograms) */
|
||||
DELETE FROM TB_PROGRAM
|
||||
WHERE PGRM_FILE_NM NOT IN (SELECT PGRM_FILE_NM FROM TB_MENU)</delete>
|
||||
|
||||
<sql id="selectRequests">
|
||||
SELECT A.*
|
||||
FROM TB_PGRM_CHNG_REQ A
|
||||
<where>
|
||||
<if test='fromReqDate != null'>REQ_DT >= #{fromReqDate}</if>
|
||||
<if test='toReqDate != null'>REQ_DT <= #{toReqDate}</if>
|
||||
<if test="by != null and term != null">${by} LIKE CONCAT('%', #{term}, '%')</if>
|
||||
<if test='filenames != null'>PGRM_FILE_NAME IN (<foreach collection="filenames" item="filename" separator=",">#{filename}</foreach>)</if>
|
||||
<if test='reqIDs != null'>REQ_ID IN (<foreach collection="reqIDs" item="reqID" separator=",">#{reqID}</foreach>)</if>
|
||||
</where>
|
||||
ORDER BY PGRM_FILE_NM,<if test='by != null'>${by}</if><if test='by == null'>REQ_ID DESC</if></sql>
|
||||
|
||||
<select id="getRequestList" parameterType="map" resultType="dataobject">/* 변경요청 목록 조회(program.getRequestList) */
|
||||
<include refid="selectRequests" /></select>
|
||||
|
||||
<select id="getRequests" parameterType="map" resultType="dataobject">/* 프로그램별 변경요청 목록 조회(program.getRequests) */
|
||||
<include refid="selectRequests" /></select>
|
||||
|
||||
<insert id="insertRequest" parameterType="cokr.xit.base.menu.ChangeRequest">/* 프로그램 변경요청 등록(program.insertRequest) */
|
||||
INSERT INTO TB_PGRM_CHNG_REQ (
|
||||
PGRM_FILE_NM
|
||||
, REQ_ID
|
||||
, SUBJECT
|
||||
, REQ_USER
|
||||
, REQ_DT
|
||||
, REQ_CNTNT
|
||||
, PRSC_USER
|
||||
, PRCS_DT
|
||||
, PRCS_CNTNT
|
||||
, PRCS_STATUS
|
||||
) VALUES (
|
||||
#{filename}
|
||||
, #{id}
|
||||
, #{subject}
|
||||
, #{requestorID}
|
||||
, #{requestDate}
|
||||
, #{requestDetail}
|
||||
, #{processorID}
|
||||
, #{processDate}
|
||||
, #{processDetail}
|
||||
, #{status}
|
||||
)</insert>
|
||||
|
||||
<update id="updateRequest" parameterType="cokr.xit.base.menu.ChangeRequest">/* 프로그램 변경요청 수정(program.updateRequest) */
|
||||
UPDATE TB_PGRM_CHNG_REQ SET
|
||||
SUBJECT = #{subject}
|
||||
, REQ_USER = #{requestorID}
|
||||
, REQ_DT = #{requestDate}
|
||||
, REQ_CNTNT = #{requestDetail}
|
||||
, PRSC_USER = #{processorID}
|
||||
, PRCS_DT = #{processDate}
|
||||
, PRCS_CNTNT = #{processDetail}
|
||||
WHERE PGRM_FILE_NM = #{filename}
|
||||
AND REQ_ID = #{id}</update>
|
||||
|
||||
<update id="setRequestStatus" parameterType="map">/* 프로그램 변경요청 상태 변경(program.setRequestStatus) */
|
||||
UPDATE TB_PGRM_CHNG_REQ SET
|
||||
PRCS_STATUS = #{status}
|
||||
WHERE PGRM_FILE_NM = #{filename}
|
||||
AND REQ_ID = #{id}</update>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue