|
@@ -185,24 +185,34 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="GroupingListOne" resultType="com.bizmatics.model.GroupingList">
|
|
|
- select
|
|
|
- a.id,
|
|
|
- a.grouping_name
|
|
|
- from site_grouping as a
|
|
|
- join site as b on a.id = b.grouping_id
|
|
|
- <where>
|
|
|
- <if test="name != null and name != ''">
|
|
|
- and b.site_name like CONCAT(CONCAT('%', #{name}), '%')
|
|
|
- </if>
|
|
|
- <if test="creator != null and creator != ''">
|
|
|
- and a.creator = #{creator}
|
|
|
- </if>
|
|
|
- <if test="tenantId != null and tenantId != 0 and tenantId !=''">
|
|
|
- and a.tenant_id = #{tenantId}
|
|
|
- </if>
|
|
|
- group by a.id
|
|
|
- order by a.id desc
|
|
|
- </where>
|
|
|
+ SELECT
|
|
|
+ *
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ g.*, COUNT(s.id) AS sl
|
|
|
+ FROM
|
|
|
+ site_grouping AS g
|
|
|
+ LEFT JOIN site AS s ON g.id = s.grouping_id
|
|
|
+ JOIN user_site AS us ON us.site_id = s.id
|
|
|
+ WHERE
|
|
|
+ s. ENABLE = 1
|
|
|
+ <if test="tenantId != null and tenantId != 0 and tenantId !=''">
|
|
|
+ and g.tenant_id = #{tenantId}
|
|
|
+ </if>
|
|
|
+ <if test="userId != null and userId != '' and userId != 0">
|
|
|
+ and us.user_id = #{userId}
|
|
|
+ </if>
|
|
|
+ <if test="name != null and name != ''">
|
|
|
+ and s.site_name like CONCAT(CONCAT('%', #{name}), '%')
|
|
|
+ </if>
|
|
|
+ GROUP BY
|
|
|
+ g.id
|
|
|
+ ) AS a
|
|
|
+ WHERE
|
|
|
+ a.sl > 0
|
|
|
+ group by a.id
|
|
|
+ order by a.id desc;
|
|
|
</select>
|
|
|
|
|
|
<select id="GroupingListTwo" resultType="com.bizmatics.model.GroupingList">
|