springboot 통합 my batis 및 패키지 curd 작업 - 프로필
mybatis-config.xml
"1.0" encoding="UTF-8" ?>
span style="color:#800000;">"-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">
"cacheEnabled" value="true"/>
"callSettersOnNulls" value="true"/>
"Integer" type="java.lang.Integer" />
"Long" type="java.lang.Long" />
"HashMap" type="java.util.HashMap" />
"LinkedHashMap" type="java.util.LinkedHashMap" />
"ArrayList" type="java.util.ArrayList" />
"LinkedList" type="java.util.LinkedList" />
BaseMapper.xml
insert into ${table}
close=")" separator=",">
${item1}
values
close=")" separator=",">
#{item2}
useGeneratedKeys="true" keyProperty="id">
insert into ${table}
close=")" separator=",">
${item}
values
close=")" separator=",">
#{item}
update ${table} set
separator=",">
${item} = #{columnvalues[${item}]}
<if test="wheres != null">
1=1
${item}
<when
test='val.toString() == "=" || val.toString() == "!=" || val.toString() == "<" || val.toString() == ">"
|| val.toString() == "<=" || val.toString() == ">=" || val.toString() == "like"
|| val.toString() == "is null" || val.toString() == "is not null"'>
#{val}
if>
delete from ${table}
<if test="wheres != null">
1=1
${item}
<when
test='val.toString() == "=" || val.toString() == "!=" || val.toString() == "<" || val.toString() == ">"
|| val.toString() == "<=" || val.toString() == ">=" || val.toString() == "like"
|| val.toString() == "is null" || val.toString() == "is not null"'>
#{val}
if>
delete from ${table}
<if test="wheres != null">
${idkey} in
close=")" separator=",">
#{item}
if>
pom.xml
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
com.example
smalldemo
2
war
SpringBootDemo
Demo project for Spring Boot
org.springframework.boot
spring-boot-starter-parent
1.5.4.RELEASE
UTF-8
UTF-8
1.7
org.springframework.boot
spring-boot-starter-redis
1.4.7.RELEASE
org.mybatis.spring.boot
mybatis-spring-boot-starter
1.3.0
org.springframework.boot
spring-boot-starter-web
com.alibaba
fastjson
1.2.16
com.alibaba
druid-spring-boot-starter
1.1.2
mysql
mysql-connector-java
runtime
org.springframework.boot
spring-boot-starter-test
test
com.caucho
hessian
4.0.38
org.springframework.boot
spring-boot-starter-tomcat
provided
com.github.wxpay
wxpay-sdk
0.0.3
org.apache.httpcomponents
httpclient
4.5.3
net.sourceforge.htmlunit
htmlunit
org.springframework.boot
spring-boot-maven-plugin
Application.java
/**
*
* spring boot application
* @author sys
*
*/
@SpringBootApplication
@EnableAutoConfiguration(exclude = { JacksonAutoConfiguration.class })
@ServletComponentScan
@EnableTransactionManagement //
@MapperScan("com.sys.mapper")
public class Application extends SpringBootServletInitializer{
//fastkson
@Bean
public HttpMessageConverters fastJsonHttpMessageConverters() {
FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter();
FastJsonConfig fastJsonConfig = new FastJsonConfig();
fastJsonConfig.setSerializerFeatures(SerializerFeature.PrettyFormat);
fastConverter.setFastJsonConfig(fastJsonConfig);
HttpMessageConverter> converter = fastConverter;
return new HttpMessageConverters(converter);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(Application.class);
}
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
다음 편 계속 -- 자바 my batis 에 대한 curd 패키지
원본 연락
다음으로 전송:https://www.cnblogs.com/syscn/p/7506711.html
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.