mirror of
https://github.com/JeffLi1993/springboot-learning-example.git
synced 2026-03-14 06:03:52 +08:00
Spring Boot 整合 Redis 实现缓存操作
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
<?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.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="findById" resultMap="BaseResultMap" parameterType="java.lang.Long">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from city
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="findAllCity" resultMap="BaseResultMap" >
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from city
|
||||
</select>
|
||||
|
||||
<insert id="saveCity" parameterMap="City" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into
|
||||
city(id,province_id,city_name,description)
|
||||
values
|
||||
(#{id},#{provinceId},#{cityName},#{description})
|
||||
</insert>
|
||||
|
||||
<update id="updateCity" parameterMap="City">
|
||||
update
|
||||
city
|
||||
set
|
||||
<if test="provinceId!=null">
|
||||
province_id = #{provinceId},
|
||||
</if>
|
||||
<if test="cityName!=null">
|
||||
city_name = #{cityName},
|
||||
</if>
|
||||
<if test="description!=null">
|
||||
description = #{description}
|
||||
</if>
|
||||
where
|
||||
id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteCity" parameterType="java.lang.Long">
|
||||
delete from
|
||||
city
|
||||
where
|
||||
id = #{id}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user