parent
174b19723a
commit
fb75521bc6
@ -1,41 +0,0 @@
|
||||
package cn.iocoder.mall.system.biz.dao.user;
|
||||
|
||||
import cn.iocoder.mall.system.biz.dataobject.user.UserAddressDO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户 地址
|
||||
*
|
||||
* @author Sin
|
||||
* @time 2019-04-06 13:29
|
||||
*/
|
||||
@Repository
|
||||
// TODO FROM 芋艿 to 小范:替换成 Mybatis Plus
|
||||
public interface UserAddressMapper {
|
||||
|
||||
int insert(UserAddressDO userAddressDO);
|
||||
|
||||
int updateById(
|
||||
@Param("id") Integer id,
|
||||
@Param("userAddressDO") UserAddressDO userAddressDO
|
||||
);
|
||||
|
||||
List<UserAddressDO> selectByUserIdAndDeleted(
|
||||
Integer deleted,
|
||||
Integer userId
|
||||
);
|
||||
|
||||
UserAddressDO selectByUserIdAndId(
|
||||
Integer userId,
|
||||
Integer id
|
||||
);
|
||||
|
||||
UserAddressDO selectHasDefault(
|
||||
Integer deleted,
|
||||
Integer userId,
|
||||
Integer hasDefault
|
||||
);
|
||||
}
|
||||
@ -1,72 +0,0 @@
|
||||
<?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