mitao
2024-04-30 ab4ea7b8f10c9b66aed9c2ea161a08b25c3851a7
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
<?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.sinata.rest.modular.mall.dao.MallUserReportMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.sinata.rest.modular.mall.model.MallUserReport">
        <id column="id" property="id"/>
        <result column="user_id" property="userId"/>
        <result column="goods_type" property="goodsType"/>
        <result column="goods_id" property="goodsId"/>
        <result column="order_id" property="orderId"/>
        <result column="detail" property="detail"/>
        <result column="rep_image" property="repImage"/>
        <result column="state" property="state"/>
        <result column="is_delete" property="isDelete"/>
        <result column="create_time" property="createTime"/>
    </resultMap>
    <update id="updateForId">
        UPDATE mall_user_report
        SET state = 1
        WHERE id = {id}
    </update>
    <select id="selectReoortList" resultType="java.util.Map">
        SELECT
        mur.id,
        mur.create_time AS createTime,
        mur.goods_type AS goodsType,
        mur.detail,
        mur.rep_image,
        mur.state,
        mg.goods_name AS goodName,
        mu.nick_name AS nickName,
        mu.id AS userId
        mu.phone,
        mm.merchant_name AS merchantName,
        mm.id AS merchantId
        FROM
        mall_user_report mur
        LEFT JOIN mem_user mu ON mu.id = mur.user_id
        LEFT JOIN mall_goods mg ON mg.id = mur.goods_id
        LEFT JOIN mem_merchant mm ON mm.id = mg.merchant_id
        WHERE 1=1
        <if test="beginTime !=null and beginTime !=''">
            <![CDATA[ AND mur.createTime >= CONCAT(#{beginTime},' 00:00:00')  ]]>
        </if>
        <if test="endTime !=null and endTime !=''">
            <![CDATA[ AND mur.createTime <= CONCAT(#{endTime},' 23:59:59')  ]]>
        </if>
        <if test="nickName !=null and nickName !=''">
            AND mu.nickName like '%${nickName}%'
        </if>
        <if test="merchantName !=null and merchantName !=''">
            AND mm.merchantName like '%${merchantName}%'
        </if>
        <if test="goodName !=null and goodName !=''">
            AND mg.goodName like '%${goodName}%'
        </if>
        <if test="goodName !=null and goodName !=''">
            AND mg.goodName like '%${goodName}%'
        </if>
        <if test="id !=null and id !=''">
            AND mur.id = #{id}'
        </if>
        <if test="state !=null and state !=''">
            AND mur.state = #{state}
        </if>
        <if test="merchantId !=null and merchantId !=''">
            AND mm.id = #{merchantId}
        </if>
        <if test="userId !=null and userId !=''">
            AND mu.id = #{userId}
        </if>
    </select>
 
</mapper>