lin %!s(int64=4) %!d(string=hai) anos
pai
achega
332f002afc
Modificáronse 1 ficheiros con 7 adicións e 2 borrados
  1. 7 2
      src/main/resources/mapper/BuildingMapper.xml

+ 7 - 2
src/main/resources/mapper/BuildingMapper.xml

@@ -203,12 +203,17 @@
 
 
     <select id="findByNameUnique" resultType="int">
-        select count(1) from sc_building where status = 1 and name = #{name} and site_id = #{siteId} and community = #{community}
+        select count(1) from sc_building where status = 1 and name = #{name} and site_id = #{siteId} and community_id = #{community}
         <if test="id != null"> and id != #{id}</if>
     </select>
 
     <select id="getBuildingList" resultType="com.zoniot.ccrc.dto.BuildingDto">
-        select * from sc_building where status = 1
+        select
+            sb.*,
+            sc.name as community_name
+        from sc_building sb
+        left join sc_community sc on(sc.id = sb.community_id)
+        where sb.status = 1
     </select>
 
     <select id="getById" resultType="com.zoniot.ccrc.dto.BuildingDto">