使用索引替换
This commit is contained in:
parent
f95d2d0157
commit
c7adca34bd
|
@ -222,7 +222,7 @@
|
|||
WHERE 1 = 1
|
||||
AND del_flag = 0
|
||||
<if test="type != null and type != ''">
|
||||
AND type = #{type}
|
||||
AND MATCH (type) AGAINST ( #{type} IN BOOLEAN MODE)
|
||||
</if>
|
||||
AND type != '赋能案例'
|
||||
GROUP BY type
|
||||
|
@ -446,7 +446,7 @@
|
|||
AND MATCH (tdr.name) AGAINST ( #{dto.name} IN BOOLEAN MODE)
|
||||
</if>
|
||||
<if test="dto.type != null and dto.type != '' ">
|
||||
AND tdr.type = #{dto.type}
|
||||
AND MATCH (tdr.type) AGAINST ( #{dto.type} IN BOOLEAN MODE)
|
||||
</if>
|
||||
|
||||
|
||||
|
@ -506,7 +506,7 @@
|
|||
AND MATCH (tdr.name) AGAINST ( #{dto.name} IN BOOLEAN MODE)
|
||||
</if>
|
||||
<if test="dto.type != null and dto.type != ''">
|
||||
AND tdr.type = #{dto.type}
|
||||
AND MATCH (tdr.type) AGAINST ( #{dto.type} IN BOOLEAN MODE)
|
||||
</if>
|
||||
<if test="dto.districtId != null and dto.districtId != ''">
|
||||
AND tdr.district_id = #{dto.districtId}
|
||||
|
@ -538,7 +538,7 @@
|
|||
AND MATCH (tdr.name) AGAINST ( #{dto.name} IN BOOLEAN MODE)
|
||||
</if>
|
||||
<if test="dto.type != null and dto.type != ''">
|
||||
AND tdr.type = #{dto.type}
|
||||
AND MATCH (tdr.type) AGAINST ( #{dto.type} IN BOOLEAN MODE)
|
||||
</if>
|
||||
<if test="dto.districtId != null and dto.districtId != ''">
|
||||
AND tdr.district_id = #{dto.districtId}
|
||||
|
@ -658,7 +658,7 @@
|
|||
sys_dept sd
|
||||
LEFT JOIN ( SELECT dept_id, COUNT( id ) AS "deptCount" FROM tb_data_resource WHERE 1 = 1 AND del_flag = 0
|
||||
<if test="resourceType != null and resourceType != ''">
|
||||
AND type = #{resourceType}
|
||||
AND MATCH (type) AGAINST ( #{resourceType} IN BOOLEAN MODE)
|
||||
</if>
|
||||
GROUP BY dept_id ) tdr ON sd.id = tdr.dept_id
|
||||
) temp1
|
||||
|
@ -699,7 +699,7 @@
|
|||
LEFT JOIN ( SELECT dept_id, COUNT( id ) AS "deptCount" FROM tb_data_resource
|
||||
WHERE 1 = 1 AND del_flag = 0
|
||||
<if test="resourceType != null and resourceType != ''">
|
||||
AND type = #{resourceType}
|
||||
AND MATCH (type) AGAINST ( #{resourceType} IN BOOLEAN MODE)
|
||||
</if>
|
||||
GROUP BY dept_id ) tdr ON sd.id = tdr.dept_id
|
||||
LEFT JOIN sys_region sr ON sd.district = sr.id
|
||||
|
@ -1034,7 +1034,7 @@
|
|||
FROM tb_data_resource
|
||||
WHERE 1 = 1
|
||||
AND del_flag = 0
|
||||
AND type = #{type}
|
||||
AND MATCH (type) AGAINST ( #{type} IN BOOLEAN MODE)
|
||||
AND type != '赋能案例'
|
||||
LIMIT 30
|
||||
</select>
|
||||
|
@ -1152,7 +1152,9 @@
|
|||
COUNT( tdav.data_resource_id ) AS total
|
||||
FROM
|
||||
(SELECT a.* FROM tb_data_attr a INNER JOIN tb_data_resource c ON a.data_resource_id = c.id
|
||||
WHERE c.type = #{resourceType} AND c.dept_id = #{id} AND c.del_flag = 0) tdav
|
||||
WHERE
|
||||
MATCH (c.type) AGAINST ( #{resourceType} IN BOOLEAN MODE)
|
||||
AND c.dept_id = #{id} AND c.del_flag = 0) tdav
|
||||
JOIN mysql.help_topic b ON b.help_topic_id < ( LENGTH( tdav.attr_value ) - LENGTH( REPLACE ( tdav.attr_value,
|
||||
';', '' ) ) + 1 )
|
||||
WHERE
|
||||
|
@ -1176,7 +1178,9 @@
|
|||
SELECT a.id FROM tb_data_resource a WHERE a.del_flag = 0 AND a.type='应用资源' AND a.dept_id = #{id}
|
||||
) a
|
||||
INNER JOIN tb_data_resource_rel b ON a.id = b.key_id INNER JOIN tb_data_resource c ON b.reference_id = c.id
|
||||
WHERE b.del_flag = 0 AND c.type = #{resourceType} AND c.del_flag = 0
|
||||
WHERE b.del_flag = 0 AND
|
||||
MATCH (c.type) AGAINST ( #{resourceType} IN BOOLEAN MODE)
|
||||
AND c.del_flag = 0
|
||||
) a INNER JOIN tb_data_attr b ON a.id = b.data_resource_id AND b.del_flag = 0
|
||||
) tdav
|
||||
JOIN mysql.help_topic b ON b.help_topic_id < ( LENGTH( tdav.attr_value ) - LENGTH( REPLACE ( tdav.attr_value,
|
||||
|
@ -1201,7 +1205,7 @@
|
|||
WHERE
|
||||
1 = 1
|
||||
AND tdr.del_flag = 0
|
||||
AND tdr.type = '组件服务'
|
||||
AND MATCH (tdr.type) AGAINST ( '组件服务' IN BOOLEAN MODE)
|
||||
GROUP BY
|
||||
tdr.id
|
||||
ORDER BY
|
||||
|
@ -1221,7 +1225,7 @@
|
|||
WHERE
|
||||
1 = 1
|
||||
AND tdr.del_flag = 0
|
||||
AND tdr.type = '组件服务'
|
||||
AND MATCH (tdr.type) AGAINST ( '组件服务' IN BOOLEAN MODE)
|
||||
GROUP BY
|
||||
tdr.id
|
||||
ORDER BY
|
||||
|
@ -1243,7 +1247,7 @@
|
|||
WHERE
|
||||
b.del_flag = 0
|
||||
AND
|
||||
b.type = '组件服务'
|
||||
AND MATCH (b.type) AGAINST ( '组件服务' IN BOOLEAN MODE)
|
||||
<if test="id != null and id != ''">
|
||||
AND (a.pids LIKE concat(concat('%',#{id}),'%') OR a.id = #{id})
|
||||
</if>
|
||||
|
@ -1269,7 +1273,7 @@
|
|||
and (c.id= #{id} OR INSTR(c.pids,#{id}))
|
||||
</if>
|
||||
<if test="resourceType != null and resourceType != ''">
|
||||
AND b.type = #{resourceType}
|
||||
AND MATCH (b.type) AGAINST ( #{resourceType} IN BOOLEAN MODE)
|
||||
</if>
|
||||
|
||||
</select>
|
||||
|
@ -1289,7 +1293,7 @@
|
|||
and (c.id = #{id} OR INSTR(c.pids,#{id}))
|
||||
</if>
|
||||
<if test="resourceType != null and resourceType != ''">
|
||||
AND b.type = #{resourceType}
|
||||
AND MATCH (b.type) AGAINST ( #{resourceType} IN BOOLEAN MODE)
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectResourceBrowseNum" parameterType="java.util.Map" resultType="integer">
|
||||
|
@ -1308,7 +1312,7 @@
|
|||
and (c.id = #{id} OR INSTR(c.pids,#{id}))
|
||||
</if>
|
||||
<if test="resourceType != null and resourceType != ''">
|
||||
AND b.type = #{resourceType}
|
||||
AND MATCH (b.type) AGAINST ( #{resourceType} IN BOOLEAN MODE)
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectResourceRelNum" parameterType="java.util.Map" resultType="integer">
|
||||
|
@ -1327,7 +1331,7 @@
|
|||
and (c.id = #{id} OR INSTR(c.pids,#{id}))
|
||||
</if>
|
||||
<if test="resourceType != null and resourceType != ''">
|
||||
AND b.type = #{resourceType}
|
||||
AND MATCH (b.type) AGAINST ( #{resourceType} IN BOOLEAN MODE)
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectResourceShare" parameterType="java.util.Map" resultType="integer">
|
||||
|
@ -1342,8 +1346,7 @@
|
|||
and (b.id = #{id} OR INSTR(b.pids,#{id}))
|
||||
</if>
|
||||
<if test="resourceType != null and resourceType != ''">
|
||||
AND
|
||||
a.type = #{resourceType}
|
||||
AND MATCH (a.type) AGAINST ( #{resourceType} IN BOOLEAN MODE)
|
||||
</if>
|
||||
<if test="shareCondition != null and shareCondition != ''">
|
||||
AND
|
||||
|
@ -1374,8 +1377,7 @@
|
|||
b.id = e.creator
|
||||
where
|
||||
(c.id = #{id} or c.pids LIKE CONCAT('%',CONCAT(#{id},'%')))
|
||||
AND
|
||||
d.type = #{resourceType}
|
||||
AND MATCH (d.type) AGAINST ( #{resourceType} IN BOOLEAN MODE)
|
||||
AND
|
||||
a.del_flag = 0
|
||||
AND
|
||||
|
@ -1392,7 +1394,8 @@
|
|||
SELECT COUNT(a.id) as carNum FROM tb_resource_car a INNER JOIN sys_user b ON a.user_id = b.id INNER JOIN
|
||||
sys_dept c
|
||||
ON b.dept_id = c.id INNER JOIN tb_data_resource d ON a.resource_id = d.id
|
||||
WHERE a.del_flag = 0 AND (c.id = #{id} OR INSTR(c.pids,#{id})) AND d.type = #{resourceType} AND d.del_flag = 0
|
||||
WHERE a.del_flag = 0 AND (c.id = #{id} OR INSTR(c.pids,#{id})) AND MATCH (d.type) AGAINST ( #{resourceType} IN
|
||||
BOOLEAN MODE) AND d.del_flag = 0
|
||||
</select>
|
||||
|
||||
<!--根据组件类型查询部门使用组件的数量-->
|
||||
|
@ -1531,7 +1534,9 @@
|
|||
<select id="resourceInstallationOrDataResourceDetails" parameterType="java.util.Map" resultType="java.util.Map">
|
||||
SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName
|
||||
FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id
|
||||
WHERE a.type = #{resourceType} AND a.del_flag = 0
|
||||
WHERE
|
||||
MATCH (a.type) AGAINST ( #{resourceType} IN BOOLEAN MODE)
|
||||
AND a.del_flag = 0
|
||||
<if test="id != '0'.toString()">
|
||||
AND (b.ID = #{id} OR INSTR(b.pids,#{id}))
|
||||
</if>
|
||||
|
@ -1554,7 +1559,7 @@
|
|||
LEFT JOIN sys_region sr ON sd.district = sr.id
|
||||
WHERE
|
||||
1 = 1
|
||||
AND tdr.type = '应用资源'
|
||||
AND MATCH (tdr.type) AGAINST ( '应用资源' IN BOOLEAN MODE)
|
||||
AND tdr.del_flag = 0
|
||||
<if test=" type != null and type != ''">
|
||||
AND sd.type = #{type}
|
||||
|
@ -1591,65 +1596,67 @@
|
|||
</select>
|
||||
<select id="countByCIMType" resultType="java.util.Map">
|
||||
SELECT
|
||||
'平台' AS type,
|
||||
COUNT( id ) AS "count"
|
||||
'平台' AS type,
|
||||
COUNT( id ) AS "count"
|
||||
FROM
|
||||
tb_data_resource tdr
|
||||
tb_data_resource tdr
|
||||
WHERE
|
||||
del_flag = 0
|
||||
AND dept_id = #{deptId}
|
||||
AND type = '应用资源' UNION
|
||||
del_flag = 0
|
||||
AND dept_id = #{deptId}
|
||||
AND
|
||||
MATCH (type) AGAINST ( '应用资源' IN BOOLEAN MODE)
|
||||
UNION
|
||||
SELECT
|
||||
( CASE tda.attr_value WHEN '智能算法' THEN '组件' WHEN '图层服务' THEN '图层' ELSE '其他' END ) AS "type",
|
||||
COUNT( tdr.id ) AS "count"
|
||||
( CASE tda.attr_value WHEN '智能算法' THEN '组件' WHEN '图层服务' THEN '图层' ELSE '其他' END ) AS "type",
|
||||
COUNT( tdr.id ) AS "count"
|
||||
FROM
|
||||
tb_data_resource tdr,
|
||||
tb_data_attr tda
|
||||
tb_data_resource tdr,
|
||||
tb_data_attr tda
|
||||
WHERE
|
||||
tdr.del_flag = 0
|
||||
AND tda.del_flag = 0
|
||||
AND tdr.id = tda.data_resource_id
|
||||
AND tdr.dept_id = #{deptId}
|
||||
AND tdr.type = '组件服务'
|
||||
AND tda.attr_type = '组件类型'
|
||||
AND tda.attr_value IN ( '智能算法', '图层服务' )
|
||||
tdr.del_flag = 0
|
||||
AND tda.del_flag = 0
|
||||
AND tdr.id = tda.data_resource_id
|
||||
AND tdr.dept_id = #{deptId}
|
||||
AND MATCH (tdr.type) AGAINST ( '组件服务' IN BOOLEAN MODE)
|
||||
AND tda.attr_type = '组件类型'
|
||||
AND tda.attr_value IN ( '智能算法', '图层服务' )
|
||||
GROUP BY
|
||||
tda.attr_value
|
||||
tda.attr_value
|
||||
</select>
|
||||
<select id="getCIMApplyApplicationList" resultType="java.util.Map">
|
||||
SELECT
|
||||
tdr.id,
|
||||
tdr.name,
|
||||
tdr.description,
|
||||
tda.attr_value AS "pic",
|
||||
tdr.create_date
|
||||
tdr.id,
|
||||
tdr.name,
|
||||
tdr.description,
|
||||
tda.attr_value AS "pic",
|
||||
tdr.create_date
|
||||
FROM
|
||||
tb_data_resource tdr,
|
||||
tb_data_attr tda
|
||||
tb_data_resource tdr,
|
||||
tb_data_attr tda
|
||||
WHERE
|
||||
tdr.id = tda.data_resource_id
|
||||
AND tdr.del_flag = 0
|
||||
AND tda.del_flag = 0
|
||||
AND tdr.type = '应用资源'
|
||||
AND tda.attr_type = '应用图片'
|
||||
AND tdr.dept_id = #{deptId}
|
||||
tdr.id = tda.data_resource_id
|
||||
AND tdr.del_flag = 0
|
||||
AND tda.del_flag = 0
|
||||
AND MATCH (tdr.type) AGAINST ( '应用资源' IN BOOLEAN MODE)
|
||||
AND tda.attr_type = '应用图片'
|
||||
AND tdr.dept_id = #{deptId}
|
||||
ORDER BY
|
||||
tdr.create_date
|
||||
tdr.create_date
|
||||
</select>
|
||||
|
||||
<select id="getImgServices" resultType="java.util.Map">
|
||||
<select id="getImgServices" resultType="java.util.Map">
|
||||
SELECT A.*,IFNULL(c.attr_value,'') as link
|
||||
FROM
|
||||
(
|
||||
SELECT m.* FROM
|
||||
(
|
||||
SELECT a.name,a.id,a.info_list FROM tb_data_resource a INNER JOIN tb_data_attr b ON a.id = b.data_resource_id
|
||||
WHERE a.dept_id = #{deptid} AND a.del_flag = 0 and a.type = '组件服务'
|
||||
AND (b.attr_type = '组件类型' AND b.attr_value = '图层服务' ) AND b.del_flag = 0
|
||||
) m
|
||||
INNER JOIN tb_data_attr b ON m.id = b.data_resource_id
|
||||
AND b.attr_type = '分类' AND LOCATE(#{type},b.attr_value) AND b.del_flag = 0
|
||||
) A
|
||||
(
|
||||
SELECT m.* FROM
|
||||
(
|
||||
SELECT a.name,a.id,a.info_list FROM tb_data_resource a INNER JOIN tb_data_attr b ON a.id = b.data_resource_id
|
||||
WHERE a.dept_id = #{deptid} AND a.del_flag = 0 and MATCH (a.type) AGAINST ( '组件服务' IN BOOLEAN MODE)
|
||||
AND (b.attr_type = '组件类型' AND b.attr_value = '图层服务' ) AND b.del_flag = 0
|
||||
) m
|
||||
INNER JOIN tb_data_attr b ON m.id = b.data_resource_id
|
||||
AND b.attr_type = '分类' AND LOCATE(#{type},b.attr_value) AND b.del_flag = 0
|
||||
) A
|
||||
|
||||
LEFT JOIN tb_data_attr c
|
||||
ON A.id = c.data_resource_id
|
||||
|
@ -1661,8 +1668,8 @@
|
|||
SELECT a.name,a.id
|
||||
FROM tb_data_resource a INNER JOIN tb_data_attr b ON a.id = b.data_resource_id
|
||||
WHERE
|
||||
a.dept_id = #{deptid}
|
||||
AND a.type = '组件服务'
|
||||
a.dept_id = #{deptid}
|
||||
AND MATCH (a.type) AGAINST ( '组件服务' IN BOOLEAN MODE)
|
||||
AND a.del_flag = 0
|
||||
AND (b.attr_type = '组件类型' AND b.attr_value = '智能算法' )
|
||||
AND b.del_flag = 0
|
||||
|
|
Loading…
Reference in New Issue