mitao
2025-02-21 31573d6180d15ef65ed0df9c2732495f40b12663
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
<?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.panzhihua.service_community.dao.ConvenientElevatingPointDAO">
    <resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ConvenientElevatingPointDO">
        <!--@Table com_convenient_elevating_point-->
        <id column="id" jdbcType="BIGINT" property="id"/>
        <result column="name" jdbcType="VARCHAR" property="name"/>
        <result column="community_id" jdbcType="VARCHAR" property="communityId"/>
        <result column="community_name" jdbcType="VARCHAR" property="communityName"/>
        <result column="address" jdbcType="VARCHAR" property="address"/>
        <result column="contacts" jdbcType="VARCHAR" property="contacts"/>
        <result column="phone" jdbcType="VARCHAR" property="phone"/>
        <result column="wechat_account" jdbcType="VARCHAR" property="wechatAccount"/>
        <result column="lat" jdbcType="VARCHAR" property="lat"/>
        <result column="lon" jdbcType="VARCHAR" property="lon"/>
        <result column="business_status" property="businessStatus"/>
        <result column="cumulative_goods_num" jdbcType="BIGINT" property="cumulativeGoodsNum"/>
        <result column="prepare_goods_num" jdbcType="BIGINT" property="prepareGoodsNum"/>
        <result column="already_goods_num" jdbcType="BIGINT" property="alreadyGoodsNum"/>
        <result column="is_del" jdbcType="BIT" property="isDel"/>
        <result column="created_at" jdbcType="TIMESTAMP" property="createdAt"/>
        <result column="created_by" jdbcType="BIGINT" property="createdBy"/>
        <result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt"/>
        <result column="updated_by" jdbcType="BIGINT" property="updatedBy"/>
    </resultMap>
    <sql id="Base_Column_List">
        id, `name`, community_id, community_name, address, contacts, phone, wechat_account,
        lat, lon, `business_status`, cumulative_goods_num, prepare_goods_num, already_goods_num, is_del,
        created_at, created_by, updated_at, updated_by
    </sql>
 
    <select id="page" resultType="com.panzhihua.common.model.vos.community.convenient.ConvenientElevatingPointVO">
        SELECT cce.* FROM com_convenient_elevating_point cce WHERE cce.is_del = 0
        <if test="pageConvenientElevatingPointDTO.businessStatus != null and pageConvenientElevatingPointDTO.businessStatus != ''">
            AND cce.business_status = #{pageConvenientElevatingPointDTO.businessStatus}
        </if>
        <if test="pageConvenientElevatingPointDTO.communityId != null and pageConvenientElevatingPointDTO.communityId != 0">
            AND ccm.community_id = ${pageConvenientElevatingPointDTO.communityId}
        </if>
 
        <if test="pageConvenientElevatingPointDTO.keyword != null and pageConvenientElevatingPointDTO.keyword != &quot;&quot;">
            AND (
            cce.name LIKE CONCAT('%', #{pageConvenientElevatingPointDTO.keyword}, '%')
            OR cce.address LIKE CONCAT('%', #{pageConvenientElevatingPointDTO.keyword}, '%')
            OR cce.contacts LIKE CONCAT('%', #{pageConvenientElevatingPointDTO.keyword}, '%')
            )
        </if>
        ORDER BY cce.prepare_goods_num DESC
    </select>
 
    <update id="deletePointById">
        UPDATE com_convenient_elevating_point SET is_del = 1, updated_by = #{operator} WHERE id = #{pointId}
    </update>
 
    <select id="pageNoDelivery"
            resultType="com.panzhihua.common.model.vos.community.convenient.ConvenientElevatingPointVO">
        SELECT ccep.*,count(csfo.id) delivery_order_num ,sum(og.amount) delivery_goods_num
        FROM com_convenient_elevating_point ccep
        LEFT JOIN com_shop_flower_order csfo ON ccep.id = csfo.point_id
        LEFT JOIN com_shop_flower_order_goods og ON og.order_id = csfo.id
        WHERE
        csfo.`status` = 1 and ccep.business_status = 1
        <if test="pageComFlowerOrderDeliveryDTO.storeId != null">
            and csfo.store_id = #{pageComFlowerOrderDeliveryDTO.storeId}
        </if>
        GROUP BY ccep.id
 
    </select>
    <select id="selectOrderNum"
            resultType="com.panzhihua.common.model.vos.community.convenient.ConvenientElevatingPointVO">
        SELECT ccep.*,count(csfo.id) delivery_order_num ,sum(og.amount) delivery_goods_num
        FROM com_convenient_elevating_point ccep
        LEFT JOIN com_shop_flower_order csfo ON ccep.id = csfo.point_id
        LEFT JOIN com_shop_flower_order_goods og ON og.order_id = csfo.id
        WHERE
        csfo.`status` = 1 and ccep.business_status = 1
        <if test="pageComFlowerOrderListDTO.storeId != null">
            and csfo.store_id = #{pageComFlowerOrderListDTO.storeId}
        </if>
        <if test="pageComFlowerOrderListDTO.pointId != null">
            and ccep.id = #{pageComFlowerOrderListDTO.pointId}
        </if>
        GROUP BY ccep.id
    </select>
</mapper>