share-platform/renren-admin/src/main/resources/mapper/fuse/TbFuseDao.xml

100 lines
4.0 KiB
XML
Raw Normal View History

2022-07-04 14:44:20 +08:00
<?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="io.renren.modules.fuse.dao.TbFuseDao">
2022-09-29 17:51:37 +08:00
2022-07-11 09:17:28 +08:00
<resultMap id="fuseDTO" type="io.renren.modules.fuse.dto.TbFuseDTO">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="description" column="description"/>
<result property="applicationArea" column="application_area"/>
<result property="deptId" column="dept_id"/>
<result property="sceneUrl" column="scene_url"/>
2022-07-11 09:17:28 +08:00
<result property="creator" column="creator"/>
<result property="createDate" column="create_date"/>
<result property="updater" column="updater"/>
<result property="updateDate" column="update_date"/>
<result property="isCollect" column="isCollect"/>
<result property="collectCount" column="collectCount"/>
<result property="infrastructureCount" column="infrastructure_count"/>
2022-10-13 11:32:29 +08:00
<result property="dataSourceCount" column="data_source_count"/>
<result property="componentCount" column="component_count"/>
2022-12-13 03:07:40 +08:00
<result property="district" column="district"/>
<result property="area" column="area"/>
2022-07-11 09:17:28 +08:00
</resultMap>
<select id="getFuseDTOList" resultMap="fuseDTO">
2023-01-09 11:53:16 +08:00
SELECT
tf.*,
count( trc.id ) AS collectCount,
IF
(
sum(
trc.user_id = #{userId})>0 , 'true', 'false') as isCollect
FROM
tb_fuse tf
LEFT JOIN ( SELECT id, resource_Id, user_id FROM tb_resource_collection WHERE 1 = 1 AND del_flag = 0 ) trc ON tf.id = trc.resource_id
WHERE
1 =1
2022-07-11 09:17:28 +08:00
<if test="name != null and name != ''">
and name like concat('%', #{name}, '%')
</if>
<if test="description != null and description != ''">
and description like concat('%', #{description}, '%')
</if>
<if test="applicationArea != null and applicationArea != ''">
and application_area like concat('%', #{applicationArea}, '%')
</if>
<if test="deptId != null and deptId != ''">
and deptId = #{deptId}
</if>
2022-07-29 16:48:23 +08:00
<if test="type != null and type != ''">
and type = #{type}
</if>
2022-07-11 09:17:28 +08:00
<if test="deptUser != null and deptUser != ''">
and dept_user like concat('%', #{deptUser}, '%')
</if>
2022-12-13 03:07:40 +08:00
<if test="district != null and district != ''">
and district = #{district}
</if>
2022-07-11 09:17:28 +08:00
<if test="mobile != null and mobile != ''">
and mobile like concat('%', #{mobile}, '%')
</if>
<if test="provider != null and provider != ''">
and provider like concat('%', #{provider}, '%')
</if>
<if test="providerUser != null and providerUser != ''">
and provider_user like concat('%', #{providerUser}, '%')
</if>
<if test="providerMobile != null and providerMobile != ''">
and provider_mobile like concat('%', #{providerMobile}, '%')
</if>
<if test="creator != null and creator != ''">
and creator = #{creator}
</if>
<if test="createDate != null and createDate != ''">
and create_date #{createDate}
</if>
<if test="updater != null and updater != ''">
and updater = #{updater}
</if>
<if test="updateDate != null and updateDate != ''">
and updateDate #{updateDate}
</if>
2023-01-04 15:14:39 +08:00
<if test="senses != null and senses.length > 0 ">
and application_area in
<foreach collection="senses" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="areas != null and areas.length > 0 ">
and area in
<foreach collection="areas" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
2022-07-11 09:17:28 +08:00
group by tf.id
2023-01-06 17:28:55 +08:00
ORDER BY ${orderField} ${order}
2022-07-11 09:17:28 +08:00
</select>
2022-07-04 14:44:20 +08:00
</mapper>