feat: sql parser 추가

dev
Jonguk. Lim 2 years ago
parent 85215cedf5
commit 09d2d5219c

@ -14,9 +14,31 @@ import java.util.Iterator;
import java.util.Map; import java.util.Map;
/** /**
* <pre>
*
* query xml : mybatis
* #{var} --> .setParameter("var", "")
* ? --> .setParameter(1, "")
* <if text="id != null"> and id in (:ids)</if>
* --> .setParameter("ids", Arrays.asList("id1", "id2")
*
* <where>
* <if text= "">AND ...</if>
* <if text= "">AND ...</if>
* </where>
*
* <switch>
* <case text=" " >...</case>
* <case text=" " >...</case>
* <otherwise>
* .....
* </otherwise>
* </switch>
*
* lib use * lib use
* implementation 'dom4j:dom4j:1.6.1' * implementation 'dom4j:dom4j:1.6.1'
* implementation 'jaxen:jaxen:1.2.0' * implementation 'jaxen:jaxen:1.2.0'
* </pre>
*/ */
public class QueryGenerator { public class QueryGenerator {

@ -17,10 +17,11 @@
FROM min_civ_board680 MCB FROM min_civ_board680 MCB
LEFT OUTER JOIN min_userinfo MU LEFT OUTER JOIN min_userinfo MU
ON MCB.ci_id = MU.userid ON MCB.ci_id = MU.userid
WHERE 1=1 <where>
<if text="ciTitle != null and ciTitle != ''">AND INSTR(MCB.ci_title, #{ciTitle}) > 0</if> <if text="ciTitle != null and ciTitle != ''">AND INSTR(MCB.ci_title, #{ciTitle}) > 0</if>
<if text="ciName != null and ciName != ''">AND MCB.ci_name like #{ciName}||'%'</if> <if text="ciName != null and ciName != ''">AND MCB.ci_name like #{ciName}||'%'</if>
<if text="ciContents != null and ciContents != ''">AND INSTR(MCB.ci_contents, #{ciContents}) > 0</if> <if text="ciContents != null and ciContents != ''">AND INSTR(MCB.ci_contents, #{ciContents}) > 0</if>
</where>
ORDER BY MCB.ci_ref DESC, ORDER BY MCB.ci_ref DESC,
MCB.ci_step ASC, MCB.ci_step ASC,
MCB.ci_code DESC MCB.ci_code DESC

@ -1,6 +1,5 @@
package com.xit.core; package com.xit.core;
import com.xit.core.util.CommUtil;
import org.jasypt.encryption.pbe.StandardPBEStringEncryptor; import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
@ -25,11 +24,6 @@ class JasyptApplicationTests {
System.out.println(jasyptEncoding(password)); System.out.println(jasyptEncoding(password));
} }
@Test
void xmlSql() {
CommUtil.getXmlSql("/sql/board2-mapper", "select");
}
private String jasyptEncoding(String value) { private String jasyptEncoding(String value) {
String key = "xit_jasypt_key"; String key = "xit_jasypt_key";

Loading…
Cancel
Save