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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
<?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.ComSanshuoExpertDao">
 
    <resultMap id="BaseResultMap" type="com.panzhihua.service_community.entity.ComSanshuoExpert">
            <id property="id" column="id" jdbcType="BIGINT"/>
            <result property="level" column="level" jdbcType="TINYINT"/>
            <result property="communityId" column="community_id" jdbcType="BIGINT"/>
            <result property="workTime" column="work_time" jdbcType="VARCHAR"/>
            <result property="goodAt" column="good_at" jdbcType="VARCHAR"/>
            <result property="name" column="name" jdbcType="VARCHAR"/>
            <result property="avatar" column="avatar" jdbcType="VARCHAR"/>
            <result property="phone" column="phone" jdbcType="VARCHAR"/>
            <result property="account" column="account" jdbcType="VARCHAR"/>
            <result property="password" column="password" jdbcType="VARCHAR"/>
            <result property="status" column="status" jdbcType="VARCHAR"/>
            <result property="delFlag" column="del_flag" jdbcType="VARCHAR"/>
            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
            <result property="createBy" column="create_by" jdbcType="VARCHAR"/>
            <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
            <result property="introduction" column="introduction" jdbcType="VARCHAR"/>
            <result property="streetId" column="street_id" jdbcType="BIGINT"/>
            <result property="industryCenterId" column="industry_center_id" jdbcType="VARCHAR"/>
            <result property="param1" column="param1" jdbcType="VARCHAR"/>
            <result property="unit" column="unit" jdbcType="VARCHAR"/>
    </resultMap>
 
    <sql id="Base_Column_List">
        select id,level,community_id,
        work_time,good_at,name,
        avatar,phone,account,
        password,status,del_flag,
        create_time,create_by,update_time,
        introduction,street_id,industry_center_id,
        unit_id,unit from com_sanshuo_expert
    </sql>
    <select id="expertShow" resultType="com.panzhihua.common.model.vos.sanshuo.ExpertShowVO">
        select  count(id) as 'count',level from com_sanshuo_expert where status=1 and del_flag=1 and app_id=#{appId} group by level
    </select>
    <select id="expertPage"  resultType="com.panzhihua.common.model.vos.sanshuo.ComSanshuoExpertVO">
        select id,level,community_id,
        work_time,good_at,name,
        avatar,phone,account,
        password,status,del_flag,
        create_time,create_by,update_time,
        introduction,street_id,industry_center_id,
        unit_id,unit from com_sanshuo_expert
        where del_flag=1
        AND app_id=#{appId}
            <if test="keyWord != null and keyWord != ''">
                AND unit like concat('%',#{keyWord},'%')
                OR name like concat('%',#{keyWord},'%')
                OR phone like concat('%',#{keyWord},'%')
            </if>
            <if test="level != null ">
            AND level=#{level}
                <if test="level == 2">
                       <if test="id != null">
                           AND industry_center_id=#{id}
                       </if>
                </if>
                <if test="level == 3">
                    <if test="id != null">
                    AND street_id=#{id}
                    </if>
                </if>
                <if test="level == 4">
                    <if test="id != null">
                    AND community_id=#{id}
                    </if>
                </if>
            </if>
           <if test="level == null">
               <if test="range != null and range != ''">
                   <if test="range == 3">
                       AND street_id=#{id}
                   </if>
                   <if test="range == 4">
                       AND community_id=#{id}
                   </if>
                   <if test="range == 2">
                       AND industry_center_id=#{id}
                   </if>
                   <if test="range == 1">
                       AND level=1
                   </if>
               </if>
           </if>
    </select>
    <select id="selectExpertIndustry" resultType="com.panzhihua.common.model.vos.sanshuo.ExpertShowVO">
        select  count(t.id) as 'count',t1.name,t1.id,t.level from com_sanshuo_expert t
        left join com_sanshuo_industry_center t1 on t.industry_center_id=t1.id
        where t.level=2 and t.status=1 and t.del_flag=1
        group by t1.name
    </select>
 
 
    <select id="selectExpertStreet" resultType="com.panzhihua.common.model.vos.sanshuo.ExpertShowVO">
        select  count(t.id) as 'count',t1.name,t1.street_id as id,t.level from com_sanshuo_expert t
        left join com_street t1 on t.street_id=t1.street_id
        where t.level=3 and t.status=1 and t.del_flag=1
        group by t1.name
    </select>
    <select id="selectExpertCommunity" resultType="com.panzhihua.common.model.vos.sanshuo.ExpertShowVO">
        select  count(t.id) as 'count',t1.name,t1.community_id as id,t.level from com_sanshuo_expert t
        left join com_act t1 on t.community_id=t1.community_id
        where t.level=4 and t.status=1 and t.del_flag=1 and t.app_id=#{appId}
        group by t1.name
    </select>
    <select id="selectExpertList" resultType="com.panzhihua.service_community.entity.ComSanshuoExpert">
        select t.*,count (select id from com_sanshuo_event_info where specialist_id = t.id )from com_sanshuo_expert as t
        left join com_sanshuo_event_info t1 on t.id=t1.specialist_id
        where t.status=1 and t.del_flag=1
    </select>
    <select id="selectExpertByNameOrPhoneOrAccount"
            resultType="com.panzhihua.service_community.entity.ComSanshuoExpert">
        select * from com_sanshuo_expert where name=#{dto.name} or phone=#{dto.phone} or account=#{dto.account}
        and status=1 and del_flag=1
    </select>
    <select id="selectExpertCount" resultType="Integer">
        select count(id) from com_sanshuo_expert
        where del_flag=1 and status=1 and app_id='wx0cef797390444b75'
        <if test="dto.type != null">
            <if test="dto.type == 2">
                AND level=2
                <if test="dto.id != null">
                    AND industry_center_id=#{dto.id}
                </if>
            </if>
            <if test="dto.type == 3">
                AND level=3
                <if test="dto.id != null">
                    AND street_id=#{dto.id}
                </if>
            </if>
            <if test="dto.type == 4">
                AND level=4
                <if test="dto.id != null">
                    AND community_id=#{dto.id}
                </if>
            </if>
            <if test="dto.type == 1">
                AND level=1
            </if>
        </if>
    </select>
    <select id="selectExpertVoList" resultType="Integer">
        select count(id) from com_sanshuo_expert where level=1
    </select>
    <select id="expertList" resultType="com.panzhihua.common.model.vos.sanshuo.ComSanshuoExpertVO">
        select id,level,community_id,
        work_time,good_at,name,
        avatar,phone,account,
        password,status,del_flag,
        create_time,create_by,update_time,
        introduction,street_id,industry_center_id,
        unit_id,unit from com_sanshuo_expert
        where del_flag=1
        AND app_id=#{appId}
        <if test="keyWord != null and keyWord != ''">
            AND name like concat('%',#{keyWord},'%') or phone like concat('%',#{keyWord},'%') or unit like concat('%',#{keyWord},'%')
        </if>
        <if test="level != null">
            <if test="level == 2">
                AND level = 2
                <if test="id != null">
                    AND industry_center_id=#{id}
                </if>
            </if>
            <if test="level == 3">
                AND level = 3
                <if test="id != null">
                    AND street_id=#{id}
                </if>
            </if>
            <if test="level == 4">
                AND level = 4
                <if test="id != null">
                    AND community_id=#{id}
                </if>
            </if>
        </if>
    </select>
</mapper>