mirror of
https://github.com/JeffLi1993/springboot-learning-example.git
synced 2026-03-14 14:13:52 +08:00
Spring Boot HTTP over JSON 的错误码异常处理
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
## master 数据源配置
|
||||
master.datasource.url=jdbc:mysql://localhost:3306/springbootdb?useUnicode=true&characterEncoding=utf8
|
||||
master.datasource.username=root
|
||||
master.datasource.password=123456
|
||||
master.datasource.driverClassName=com.mysql.jdbc.Driver
|
||||
|
||||
## cluster 数据源配置
|
||||
cluster.datasource.url=jdbc:mysql://localhost:3306/springbootdb_cluster?useUnicode=true&characterEncoding=utf8
|
||||
cluster.datasource.username=root
|
||||
cluster.datasource.password=123456
|
||||
cluster.datasource.driverClassName=com.mysql.jdbc.Driver
|
||||
@@ -0,0 +1,24 @@
|
||||
<?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="org.spring.springboot.dao.cluster.CityDao">
|
||||
<resultMap id="BaseResultMap" type="org.spring.springboot.domain.City">
|
||||
<result column="id" property="id" />
|
||||
<result column="province_id" property="provinceId" />
|
||||
<result column="city_name" property="cityName" />
|
||||
<result column="description" property="description" />
|
||||
</resultMap>
|
||||
|
||||
<parameterMap id="City" type="org.spring.springboot.domain.City"/>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id, province_id, city_name, description
|
||||
</sql>
|
||||
|
||||
<select id="findByName" resultMap="BaseResultMap" parameterType="java.lang.String">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from city
|
||||
where city_name = #{cityName}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?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="org.spring.springboot.dao.master.UserDao">
|
||||
<resultMap id="BaseResultMap" type="org.spring.springboot.domain.User">
|
||||
<result column="id" property="id" />
|
||||
<result column="user_name" property="userName" />
|
||||
<result column="description" property="description" />
|
||||
</resultMap>
|
||||
|
||||
<parameterMap id="User" type="org.spring.springboot.domain.User"/>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id, user_name, description
|
||||
</sql>
|
||||
|
||||
<select id="findByName" resultMap="BaseResultMap" parameterType="java.lang.String">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from user
|
||||
where id = 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user