You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
SRuml/SuperRice/springboot/target/classes/mapper/AddressMapper.xml

72 lines
2.4 KiB

<?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="com.example.mapper.AddressMapper">
<sql id="Base_Column_List">
id,user_id,username,useraddress,phone
</sql>
<select id="selectAll" resultType="com.example.entity.Address">
select address.*
from address
<where>
<if test="id != null"> and id= #{id}</if>
<if test="userId != null"> and user_id = #{userId}</if>
<if test="username != null"> and username = #{username}</if>
<if test="useraddress != null"> and useraddress = #{useraddress}</if>
<if test="phone != null"> and phone = #{phone}</if>
</where>
</select>
<select id="selectById" resultType="com.example.entity.Address">
select
<include refid="Base_Column_List" />
from address
where id = #{id}
</select>
<delete id="deleteById">
delete from address
where id = #{id}
</delete>
<insert id="insert" parameterType="com.example.entity.Address" useGeneratedKeys="true">
insert into address
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="userId != null">user_id,</if>
<if test="username != null">username,</if>
<if test="useraddress != null">useraddress,</if>
<if test="phone != null">phone,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="userId != null">#{userId},</if>
<if test="username != null">#{username},</if>
<if test="useraddress != null">#{useraddress},</if>
<if test="phone != null">#{phone},</if>
</trim>
</insert>
<update id="updateById" parameterType="com.example.entity.Address">
update address
<set>
<if test="userId != null">
user_id = #{userId},
</if>
<if test="username != null">
username = #{username},
</if>
<if test="useraddress != null">
useraddress = #{useraddress},
</if>
<if test="phone != null">
phone = #{phone},
</if>
</set>
where id = #{id}
</update>
</mapper>