| 5432 |
amar.kumar |
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
2 |
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
3 |
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
4 |
|
|
|
5 |
<mapper namespace="in.shop2020.user.persistence.AddressMapper">
|
|
|
6 |
<resultMap type="address" id="addressResult">
|
|
|
7 |
<id property="id" column="id"/>
|
|
|
8 |
</resultMap>
|
|
|
9 |
|
|
|
10 |
<insert id="addAddressForUser" parameterType="address" useGeneratedKeys="true" keyProperty="id">
|
|
|
11 |
INSERT INTO address
|
|
|
12 |
(line_1, line_2, landmark, city, country, enabled, state, pin, type, added_on, name, phone,user_id)
|
|
|
13 |
VALUES
|
|
|
14 |
(#{line_1}, #{line_2}, #{landmark}, #{city}, #{country}, #{enabled}, #{state}, #{pin},
|
|
|
15 |
#{type}, #{added_on}, #{name}, #{phone}, #{user_id})
|
|
|
16 |
</insert>
|
|
|
17 |
|
|
|
18 |
<select id="getAddress" parameterType="long" resultType="address">
|
|
|
19 |
SELECT *
|
|
|
20 |
FROM address
|
|
|
21 |
<where>
|
|
|
22 |
id = #{addressId}
|
|
|
23 |
</where>
|
|
|
24 |
</select>
|
|
|
25 |
|
|
|
26 |
<update id="disableAddress" parameterType="long">
|
|
|
27 |
UPDATE address
|
|
|
28 |
SET enabled = 0
|
|
|
29 |
<where>
|
|
|
30 |
id = #{addressId}
|
|
|
31 |
</where>
|
|
|
32 |
</update>
|
|
|
33 |
|
|
|
34 |
<select id="getPincodeForAddress" parameterType="long" resultType="String">
|
|
|
35 |
SELECT pin
|
|
|
36 |
FROM address
|
|
|
37 |
<where>
|
|
|
38 |
id = #{id}
|
|
|
39 |
</where>
|
|
|
40 |
</select>
|
|
|
41 |
|
|
|
42 |
<select id="getAllAddressesForUser" parameterType="long" resultType="address">
|
|
|
43 |
SELECT *
|
|
|
44 |
FROM address
|
|
|
45 |
<where>
|
|
|
46 |
user_id = #{userId}
|
|
|
47 |
AND enabled = 1
|
|
|
48 |
</where>
|
|
|
49 |
</select>
|
|
|
50 |
|
|
|
51 |
</mapper>
|