xiaoyong931011
2021-04-12 a13a93a493e7e94e28b2225c26e7e13b52d3288c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?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.matrix.system.activity.dao.ActivitySignWriteoffDao">
    <!-- 定义ActivitySignWriteoff 的复杂关联map -->
    <resultMap type="com.matrix.system.activity.entity.ActivitySignWriteoff" id="ActivitySignWriteoffMap">
        <id property="id" column="id" />
        <result property="createBy" column="create_by" />
        <result property="createTime" column="create_time" />
        <result property="updateBy" column="update_by" />
        <result property="updateTime" column="update_time" />
            <result property="writeoffTime" column="writeoff_time" />
            <result property="writeoffUser" column="writeoff_user" />
            <result property="writeoffCode" column="writeoff_code" />
            <result property="actId" column="act_id" />
            <result property="awardId" column="award_id" />
            <result property="winTime" column="win_time" />
            <result property="state" column="state" />
            <result property="userId" column="user_id" />
            <result property="logisticsId" column="logistics_id" />
            <result property="receiveId" column="receive_id" />
            <result property="companyId" column="company_id" />
            <result property="shopId" column="shop_id" />
            <result property="writeoffUserid" column="writeoff_userid" />
    </resultMap>
    
    
    <!-- 定义ActivitySignWriteoff 的简单map  ,本map不添加其他的关联属性 -->
    <resultMap type="com.matrix.system.activity.entity.ActivitySignWriteoff" id="ActivitySignWriteoffSimpleMap">
        <id property="id" column="id" />
        <result property="createBy" column="create_by" />
        <result property="createTime" column="create_time" />
        <result property="updateBy" column="update_by" />
        <result property="updateTime" column="update_time" />
            <result property="writeoffTime" column="writeoff_time" />
            <result property="writeoffUser" column="writeoff_user" />
            <result property="writeoffCode" column="writeoff_code" />
            <result property="actId" column="act_id" />
            <result property="awardId" column="award_id" />
            <result property="winTime" column="win_time" />
            <result property="state" column="state" />
            <result property="userId" column="user_id" />
            <result property="logisticsId" column="logistics_id" />
            <result property="receiveId" column="receive_id" />
            <result property="companyId" column="company_id" />
            <result property="shopId" column="shop_id" />
            <result property="writeoffUserid" column="writeoff_userid" />
    </resultMap>
 
    <select id="findSignWriteoffList" resultType="com.matrix.system.activity.vo.SignWriteoffListVo">
        SELECT
        a.id id,
        a.writeoff_time writeoffTime,
        a.writeoff_user writeoffUser,
        a.writeoff_code writeoffCode,
        a.state state,
        b.nick_name receiveName,
        c.act_name actName,
        d.award_way awardWay,
        d.award_name awardName,
        e.receive_time winTime,
        f.receive_address receiveAddress
        FROM
        activity_sign_writeoff a
        left join biz_user b on a.user_id= b.user_id
        left join shop_activities c on a.act_id= c.id
        left join activity_sign_award_set d on a.award_id= d.id
        left join activity_sign_receive_record e on a.receive_id= e.id
        left join shop_delivery_info f on a.logistics_id= f.id
        <where>
            a.company_id = #{record.companyId}
            <if test="record.zjzxm != null and record.zjzxm != ''">
                and b.nick_name like concat('%',#{record.zjzxm},'%')
            </if>
            <if test="record.hdmcbm != null and record.hdmcbm != ''">
                and (c.act_name like concat('%',#{record.hdmcbm},'%') or c.act_code like concat('%',#{record.hdmcbm},'%'))
            </if>
        </where>
        <if test="record.sort !=null">
            order by
            a.${record.sort} ${record.order}
        </if>
    </select>
 
    <select id="selectUsernameByUserId" resultType="com.matrix.system.activity.vo.ZjrVo">
        SELECT
            a.receive_time zjsj,
               b.nick_name zjr
        FROM
        activity_sign_receive_record a
        left join biz_user b on a.user_id= b.user_id
        where a.user_id = #{userId} and a.award_id = #{receiveId}
    </select>
 
    <select id="selectShopDeliveryInfoByLogisticsId" resultType="com.matrix.system.shopXcx.bean.ShopDeliveryInfo">
        SELECT
            *
        FROM
            shop_delivery_info a
        where a.id = #{logisticsId}
    </select>
 
</mapper>