Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
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.AffiliateMapper">
6
 
7
<resultMap type="masteraffiliate" id="masteraffiliateResult">
8
		<id property="id" column="id"/>
9
</resultMap>
10
 
11
<resultMap type="affiliate" id="affiliateResult">
12
		<id property="id" column="id"/>
13
</resultMap>
14
 
15
 
16
<select id="getAffiliateById" parameterType="long" resultType="affiliate">
17
    SELECT *
18
    FROM affiliate
19
    <where>
20
        id = #{id}
21
	</where>
22
</select>
23
 
24
<select id="getAffiliateByName" parameterType="String" resultType="affiliate">
25
    SELECT *
26
    FROM affiliate
27
    <where>
28
        name = #{name}
29
	</where>
30
</select>
31
 
32
<select id="getAffiliatesByMasterAffiliate" parameterType="String" resultType="affiliate">
33
    SELECT *
34
    FROM affiliate
35
    <where>
36
        master_affiliate_id = #{masterAffiliateId}
37
	</where>
38
</select>
39
 
40
<select id="getMasterAffiliateById" parameterType="long" resultType="masteraffiliate">
41
    SELECT *
42
    FROM masteraffiliate
43
    <where>
44
        id = #{id}
45
	</where>
46
</select>
47
 
48
<select id="getMasterAffiliateByName" parameterType="String" resultType="masteraffiliate">
49
    SELECT *
50
    FROM masteraffiliate
51
    <where>
52
        name = #{name}
53
	</where>
54
</select>
55
 
56
<select id="getAllMasterAffiliates" resultType="masteraffiliate">
57
    SELECT *
58
    FROM masteraffiliate
59
</select>
60
 
61
<insert id="createMasterAffiliate" parameterType="masteraffiliate" useGeneratedKeys="true" keyProperty="id">
62
   INSERT INTO masteraffiliate
63
      (name, added_on)
64
    VALUES
65
      (#{name}, #{added_on})
66
</insert>
67
 
68
<insert id="createAffiliate" parameterType="affiliate" useGeneratedKeys="true" keyProperty="id">
69
   INSERT INTO affiliate
70
      (master_affiliate_id, name, url, added_on)
71
    VALUES
72
      (#{master_affiliate_id}, #{name}, #{url}, #{added_on})
73
</insert>
74
 
75
</mapper>