|
@@ -32,9 +32,62 @@
|
|
<result column="updated_time" property="updatedTime" />
|
|
<result column="updated_time" property="updatedTime" />
|
|
</resultMap>
|
|
</resultMap>
|
|
|
|
|
|
|
|
+ <!-- 通用查询VO映射结果 -->
|
|
|
|
+ <resultMap id="VoResultMap" type="com.qs.mp.channel.domain.vo.ChannelVO">
|
|
|
|
+ <id column="channel_id" property="channelId" />
|
|
|
|
+ <result column="channel_no" property="channelNo" />
|
|
|
|
+ <result column="name" property="name" />
|
|
|
|
+ <result column="parent_id" property="parentId" />
|
|
|
|
+ <result column="level" property="level" />
|
|
|
|
+ <result column="site_type" property="siteType" />
|
|
|
|
+ <result column="comm_rate" property="commRate" />
|
|
|
|
+ <result column="province" property="province" />
|
|
|
|
+ <result column="province_id" property="provinceId" />
|
|
|
|
+ <result column="city" property="city" />
|
|
|
|
+ <result column="city_id" property="cityId" />
|
|
|
|
+ <result column="area" property="area" />
|
|
|
|
+ <result column="area_id" property="areaId" />
|
|
|
|
+ <result column="address" property="address" />
|
|
|
|
+ <result column="contact" property="contact" />
|
|
|
|
+ <result column="mobile" property="mobile" />
|
|
|
|
+ <result column="user_id" property="userId" />
|
|
|
|
+ <result column="money" property="money" />
|
|
|
|
+ <result column="frozen_money" property="frozenMoney" />
|
|
|
|
+ <result column="certify_status" property="certifyStatus" />
|
|
|
|
+ <result column="verify_status" property="verifyStatus" />
|
|
|
|
+ <result column="biz_license_pic" property="bizLicensePic" />
|
|
|
|
+ <result column="door_pic" property="doorPic" />
|
|
|
|
+ <result column="memo" property="memo" />
|
|
|
|
+ <result column="created_time" property="createdTime" />
|
|
|
|
+ <result column="updated_time" property="updatedTime" />
|
|
|
|
+ <result column="parentName" property="parentName" />
|
|
|
|
+ <association property="siteCnt" javaType="java.lang.Integer" select="getChannelSiteCnt" column="{channelNo=channelNo}" />
|
|
|
|
+ <association property="userCnt" javaType="java.lang.Integer" select="com.qs.mp.channel.mapper.ChannelUserRelMapper.getChannelUserCnt" column="{channelNo=channelNo}" />
|
|
|
|
+ </resultMap>
|
|
|
|
+
|
|
<!-- 通用查询结果列 -->
|
|
<!-- 通用查询结果列 -->
|
|
<sql id="Base_Column_List">
|
|
<sql id="Base_Column_List">
|
|
- channel_id, channel_no, name, parent_id, level, site_type, comm_rate, province, province_id, city, city_id, area, area_id, address, contact, mobile, user_id, money, frozen_money, certify_status, verify_status, biz_license, door_pic, memo, created_time, updated_time
|
|
|
|
|
|
+ channel_id, channel_no, name, parent_id, level, site_type, comm_rate, province, province_id, city, city_id, area, area_id, address, contact, mobile, user_id, money, frozen_money, certify_status, verify_status, biz_license_pic, door_pic, memo, created_time, updated_time
|
|
</sql>
|
|
</sql>
|
|
|
|
|
|
|
|
+ <!-- 查询子渠道信息 -->
|
|
|
|
+ <select id="selectChannelVoList" resultMap="VoResultMap">
|
|
|
|
+ select t1.* , t2.siteCnt, t3.userCnt, t4.name parentName
|
|
|
|
+ from mp_channel t1
|
|
|
|
+ left join (select parent_id, count(*) as siteCnt from mp_channel where `level` = 0 GROUP BY parent_id ) t2 on t1.channel_id = t2.parent_id
|
|
|
|
+ left join (select channel_id, count(user_id) as userCnt from mp_channel_user_rel GROUP BY channel_id ) t3 on t1.channel_id = t3.channel_id
|
|
|
|
+ left join mp_channel t4 on t1.parent_id = t4.channel_id
|
|
|
|
+ ${ew.customSqlSegment}
|
|
|
|
+ order by a.channel_id desc
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <!-- 查询渠道及其子渠道经销商用户数总和 -->
|
|
|
|
+ <select id="getChannelSiteCnt" resultType="integer">
|
|
|
|
+ select count(t1.channel_id) as siteCnt
|
|
|
|
+ from mp_channel t1
|
|
|
|
+ left join mp_channel t2 on t1.parent_id = t2.channel_id
|
|
|
|
+ where t1.`level`= 0 and t1.certify_status = 'y'
|
|
|
|
+ and t2.channel_no like concat(#{channelNo}, '%')
|
|
|
|
+ </select>
|
|
|
|
+
|
|
</mapper>
|
|
</mapper>
|