select b.id, b.tenant_id, b.project_id, b.building_code, b.building_name, b.region,
b.address, b.property_nature, b.property_cert_no, b.property_no, b.land_no,
b.sort_order, b.building_area, b.property_area, b.rentable_area, b.self_use_area,
b.supporting_area, b.parking_area, b.account_id, b.building_tags, b.is_hot, b.total_floors, b.facilities, b.image_url, b.create_time,
b.last_mod_time, b.create_user_id, b.last_mod_user_id,
b.del_flag, b.remark, b.reserve1, b.reserve2, b.reserve3,
p.project_name
from TB_BUILDING b
left join TB_PROJECT p on b.project_id = p.id and p.del_flag = '0'
insert into TB_BUILDING
tenant_id,
project_id,
building_code,
building_name,
region,
address,
property_nature,
property_cert_no,
property_no,
land_no,
sort_order,
building_area,
property_area,
rentable_area,
self_use_area,
supporting_area,
parking_area,
account_id,
building_tags,
is_hot,
total_floors,
facilities,
image_url,
create_user_id,
last_mod_user_id,
del_flag,
remark,
reserve1,
reserve2,
reserve3,
create_time,
last_mod_time
#{tenantId},
#{projectId},
#{buildingCode},
#{buildingName},
#{region},
#{address},
#{propertyNature},
#{propertyCertNo},
#{propertyNo},
#{landNo},
#{sortOrder},
#{buildingArea},
#{propertyArea},
#{rentableArea},
#{selfUseArea},
#{supportingArea},
#{parkingArea},
#{accountId},
#{buildingTags},
#{isHot},
#{totalFloors},
#{facilities},
#{imageUrl},
#{createUserId},
#{lastModUserId},
#{delFlag},
#{remark},
#{reserve1},
#{reserve2},
#{reserve3},
CURRENT_TIMESTAMP,
CURRENT_TIMESTAMP
update TB_BUILDING
building_code = #{buildingCode},
building_name = #{buildingName},
region = #{region},
address = #{address},
property_nature = #{propertyNature},
property_cert_no = #{propertyCertNo},
property_no = #{propertyNo},
land_no = #{landNo},
sort_order = #{sortOrder},
building_area = #{buildingArea},
property_area = #{propertyArea},
rentable_area = #{rentableArea},
self_use_area = #{selfUseArea},
supporting_area = #{supportingArea},
parking_area = #{parkingArea},
account_id = #{accountId},
building_tags = #{buildingTags},
is_hot = #{isHot},
total_floors = #{totalFloors},
facilities = #{facilities},
image_url = #{imageUrl},
last_mod_user_id = #{lastModUserId},
remark = #{remark},
reserve1 = #{reserve1},
reserve2 = #{reserve2},
reserve3 = #{reserve3},
last_mod_time = CURRENT_TIMESTAMP
where id = #{id} and del_flag = '0'
update TB_BUILDING set del_flag = '1' where id = #{id}
update TB_BUILDING set del_flag = '1' where id in
#{id}