|
@@ -165,6 +165,39 @@
|
|
|
limit #{param.skip},#{param.size}
|
|
|
</if>
|
|
|
</sql>
|
|
|
+ <sql id="commonQueryObjectListByParam">
|
|
|
+ SELECT DISTINCT SQL_CALC_FOUND_ROWS
|
|
|
+ dto.*,
|
|
|
+ JSON_ARRAYAGG( dtr.obj_from ) AS objFromIds,
|
|
|
+ JSON_ARRAYAGG( dtr.obj_to ) AS objToIds
|
|
|
+ FROM
|
|
|
+ dt_object AS dto
|
|
|
+ INNER JOIN ( SELECT * FROM dt_relation AS dtrA WHERE 1=1
|
|
|
+ <if test="null!=param.relId and param.relId.length>0">
|
|
|
+ AND (dtrA.obj_from = #{param.relId} OR dtrA.obj_to=#{param.relId})
|
|
|
+ </if>
|
|
|
+ <if test="null!=param.projectId and param.projectId.length>0">
|
|
|
+ AND dtrA.project_id = #{param.projectId}
|
|
|
+ </if>
|
|
|
+ <if test="null!=param.relCode and param.relCode.length>0">
|
|
|
+ AND dtrA.rel_code = #{param.relCode}
|
|
|
+ </if>
|
|
|
+ ) AS dtr ON (dtr.obj_to = dto.id OR dtr.obj_from = dto.id)
|
|
|
+ WHERE
|
|
|
+ 1 = 1
|
|
|
+ <if test="null!=param.projectId and param.projectId.length>0">
|
|
|
+ AND dto.obj_from = #{param.projectId}
|
|
|
+ </if>
|
|
|
+ <if test="null!=param.objType and param.objType.length>0">
|
|
|
+ AND dto.obj_type = #{param.objType}
|
|
|
+ </if>
|
|
|
+ <if test="null!=param.keyword and param.keyword.length>0">
|
|
|
+ AND dto.local_name LIKE CONCAT('%',#{param.keyword},'%')
|
|
|
+ </if>
|
|
|
+ AND dto.valid = TRUE
|
|
|
+
|
|
|
+ </sql>
|
|
|
+
|
|
|
|
|
|
<select id="queryObjectDigitalsByProjectId" resultMap="BaseResultMap,count">
|
|
|
SELECT DISTINCT SQL_CALC_FOUND_ROWS
|
|
@@ -196,43 +229,39 @@
|
|
|
SELECT FOUND_ROWS() AS totalCount;
|
|
|
</select>
|
|
|
<select id="queryObjectListByFloorIdAndRoomFuncType" resultMap="BaseResultMap,count">
|
|
|
- SELECT DISTINCT
|
|
|
- dto.*,
|
|
|
- JSON_ARRAYAGG( dtr.obj_from ) AS objFromIds,
|
|
|
- JSON_ARRAYAGG( dtr.obj_to ) AS objToIds
|
|
|
- FROM
|
|
|
- dt_object AS dto
|
|
|
- INNER JOIN ( SELECT * FROM dt_relation AS dtrA WHERE 1=1
|
|
|
- <if test="null!=param.floorId and param.floorId.length>0">
|
|
|
- AND dtrA.obj_from = #{param.floorId}
|
|
|
- </if>
|
|
|
- <if test="null!=param.projectId and param.projectId.length>0">
|
|
|
- AND dtrA.project_id = #{param.projectId}
|
|
|
- </if>
|
|
|
- <if test="null!=param.relCode and param.relCode.length>0">
|
|
|
- AND dtrA.rel_code = #{param.relCode}
|
|
|
- </if>
|
|
|
- ) AS dtr ON dtr.obj_to = dto.id
|
|
|
- WHERE
|
|
|
- 1 = 1
|
|
|
- <if test="null!=param.projectId and param.projectId.length>0">
|
|
|
- AND dto.obj_from = #{param.projectId}
|
|
|
- </if>
|
|
|
- <if test="null!=param.objType and param.objType.length>0">
|
|
|
- AND dto.obj_type = #{param.objType}
|
|
|
- </if>
|
|
|
+ <include refid="commonQueryObjectListByParam">
|
|
|
+ <property name="param" value="#{param}"/>
|
|
|
+ </include>
|
|
|
<if test="null!=param.roomFuncType and param.roomFuncType.length>0">
|
|
|
AND JSON_UNQUOTE(JSON_EXTRACT(dto.infos, '$.roomFuncType'))=#{param.roomFuncType}
|
|
|
</if>
|
|
|
- <if test="null!=param.keyword and param.keyword.length>0">
|
|
|
- AND dto.local_name LIKE CONCAT('%',#{param.keyword},'%')
|
|
|
- </if>
|
|
|
- AND dto.valid = TRUE
|
|
|
GROUP BY
|
|
|
- dto.id;
|
|
|
+ dto.id
|
|
|
+ <include refid="pageSet">
|
|
|
+ <property name="param" value="#{param}"/>
|
|
|
+ </include>
|
|
|
+ ;
|
|
|
SELECT
|
|
|
FOUND_ROWS( ) AS totalCount;
|
|
|
</select>
|
|
|
+ <select id="queryObjectListBySpaceIdAndClassCode" resultMap="BaseResultMap,count">
|
|
|
+ <include refid="commonQueryObjectListByParam">
|
|
|
+ <property name="param" value="#{param}"/>
|
|
|
+ </include>
|
|
|
+ <if test="null!=param.classCode and param.classCode.length>0">
|
|
|
+ AND dto.class_code=#{param.classCode}
|
|
|
+ </if>
|
|
|
+ GROUP BY
|
|
|
+ dto.id
|
|
|
+ <include refid="pageSet">
|
|
|
+ <property name="param" value="#{param}"/>
|
|
|
+ </include>
|
|
|
+ ;
|
|
|
+ SELECT
|
|
|
+ FOUND_ROWS( ) AS totalCount;
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
</mapper>
|