testDao -> testMapper, RandomNumber -> Random

master
mjkhan21 1 year ago
parent 0241fece79
commit a01274ed20

@ -1,7 +1,5 @@
package cokr.xit.foundation.test; package cokr.xit.foundation.test;
import org.springframework.stereotype.Repository;
import cokr.xit.foundation.component.AbstractDao; import cokr.xit.foundation.component.AbstractDao;
/**JUnit SQL DAO.<br /> /**JUnit SQL DAO.<br />
@ -9,7 +7,7 @@ import cokr.xit.foundation.component.AbstractDao;
* TestDao test.xml. * TestDao test.xml.
* @author mjkhan * @author mjkhan
*/ */
@Repository("testDao") //@Repository("testDao")
public class TestDao extends AbstractDao { public class TestDao extends AbstractDao {
/** INSERT . /** INSERT .
* @param sql INSERT SQL * @param sql INSERT SQL

@ -0,0 +1,30 @@
package cokr.xit.foundation.test;
import java.util.Map;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
import cokr.xit.foundation.component.AbstractMapper;
@Mapper("testMapper")
public interface TestMapper extends AbstractMapper {
int insert(Map<String, Object> params);
default int execInsert(String sql) {
return insert(params().set("sql", sql));
}
int update(Map<String, Object> params);
default int execUpdate(String sql) {
return update(params().set("sql", sql));
}
int delete(Map<String, Object> params);
default int execDelete(String sql) {
return delete(params().set("sql", sql));
}
void commit();
}

@ -32,8 +32,8 @@ import cokr.xit.foundation.data.DataObject;
@ContextConfiguration("classpath:spring/context-*.xml") @ContextConfiguration("classpath:spring/context-*.xml")
@ActiveProfiles("test") @ActiveProfiles("test")
public class TestSupport extends AbstractComponent { public class TestSupport extends AbstractComponent {
@Resource(name="testDao") @Resource(name="testMapper")
protected TestDao testDao; protected TestMapper testMapper;
protected DataObject dataObject() { protected DataObject dataObject() {
return new DataObject(); return new DataObject();

@ -5,12 +5,12 @@ import java.util.concurrent.ThreadLocalRandom;
/** /**
* @author mjkhan * @author mjkhan
*/ */
public class RandomNumber { public class Random {
/** 릿 . /** 릿 .
* @param digit 릿 * @param digit 릿
* @return 릿 * @return 릿
*/ */
public static final String get(int digit) { public static final String number(int digit) {
if (digit < 1) if (digit < 1)
throw new IllegalArgumentException("digit < 1"); throw new IllegalArgumentException("digit < 1");

@ -28,6 +28,14 @@ public class AccessFilter implements Filter {
public void doFilter(ServletRequest sreq, ServletResponse sresp, FilterChain chain) throws IOException, ServletException { public void doFilter(ServletRequest sreq, ServletResponse sresp, FilterChain chain) throws IOException, ServletException {
HttpServletRequest hreq = (HttpServletRequest)sreq; HttpServletRequest hreq = (HttpServletRequest)sreq;
String action = hreq.getRequestURI().replace(hreq.getContextPath(), ""); String action = hreq.getRequestURI().replace(hreq.getContextPath(), "");
if ("/".equals(action) || action.endsWith(".do"))
setAccess(hreq, action);
chain.doFilter(sreq, sresp);
}
private void setAccess(HttpServletRequest hreq, String action) {
HttpSession session = hreq.getSession(false); HttpSession session = hreq.getSession(false);
Access access = new Access() Access access = new Access()
@ -40,8 +48,6 @@ public class AccessFilter implements Filter {
.setCurrent(); .setCurrent();
hreq.setAttribute("currentAccess", access); hreq.setAttribute("currentAccess", access);
chain.doFilter(sreq, sresp);
} }
@Override @Override

Loading…
Cancel
Save