- 提交:address .xml
This commit is contained in:
parent
47d4d3f2dc
commit
f605775ba7
72
system/system-biz/src/main/resources/mapper/UserAddress.xml
Normal file
72
system/system-biz/src/main/resources/mapper/UserAddress.xml
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
<?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="cn.iocoder.mall.system.biz.dao.user.UserAddressMapper">
|
||||||
|
|
||||||
|
<sql id="FIELDS">
|
||||||
|
id, user_id, area_no, `name`, mobile, address,
|
||||||
|
create_time, update_time, has_default, deleted
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<insert id="insert" parameterType="UserAddressDO" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
INSERT INTO user_address (
|
||||||
|
user_id, area_no, `name`, mobile, address,
|
||||||
|
create_time, update_time, has_default, deleted
|
||||||
|
) VALUES (
|
||||||
|
#{userId}, #{areaNo}, #{name}, #{mobile}, #{address},
|
||||||
|
#{createTime}, #{updateTime}, #{hasDefault}, #{deleted}
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateById">
|
||||||
|
UPDATE user_address
|
||||||
|
<set>
|
||||||
|
<if test="userAddressDO.areaNo != null">
|
||||||
|
, area_no = #{userAddressDO.areaNo}
|
||||||
|
</if>
|
||||||
|
<if test="userAddressDO.name != null">
|
||||||
|
, `name` = #{userAddressDO.name}
|
||||||
|
</if>
|
||||||
|
<if test="userAddressDO.mobile != null">
|
||||||
|
, mobile = #{userAddressDO.mobile}
|
||||||
|
</if>
|
||||||
|
<if test="userAddressDO.address != null">
|
||||||
|
, address = #{userAddressDO.address}
|
||||||
|
</if>
|
||||||
|
<if test="userAddressDO.updateTime != null">
|
||||||
|
, update_time = #{userAddressDO.updateTime}
|
||||||
|
</if>
|
||||||
|
<if test="userAddressDO.hasDefault != null">
|
||||||
|
, has_default = #{userAddressDO.hasDefault}
|
||||||
|
</if>
|
||||||
|
<if test="userAddressDO.deleted != null">
|
||||||
|
, deleted = #{userAddressDO.deleted}
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
WHERE id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<select id="selectByUserIdAndId" resultType="cn.iocoder.mall.system.biz.dataobject.user.UserAddressDO">
|
||||||
|
SELECT
|
||||||
|
<include refid="FIELDS" />
|
||||||
|
FROM user_address
|
||||||
|
WHERE user_id = #{userId}
|
||||||
|
AND id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectByUserIdAndDeleted" resultType="cn.iocoder.mall.system.biz.dataobject.user.UserAddressDO">
|
||||||
|
SELECT
|
||||||
|
<include refid="FIELDS" />
|
||||||
|
FROM user_address
|
||||||
|
WHERE deleted = #{deleted}
|
||||||
|
AND `user_id` = #{userId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectHasDefault" resultType="cn.iocoder.mall.system.biz.dataobject.user.UserAddressDO">
|
||||||
|
SELECT
|
||||||
|
<include refid="FIELDS" />
|
||||||
|
FROM user_address
|
||||||
|
WHERE deleted = #{deleted}
|
||||||
|
AND `user_id` = #{userId}
|
||||||
|
AND `has_default` = #{hasDefault}
|
||||||
|
</select>
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue
Block a user