mybatis where 中in使用mybatis
AND id IN <foreach collection="ids" item="id" index="index" open="(" close=")" separator=","> #{id} </foreach>
新增後取得新增idapp
baseMapper.insert(property); propertyId = property.getId();
MySql實現根據某個條件去重求和code
COUNT(DISTINCT pr.id) 'property_right_number', LEFT JOIN assets_property_right AS pr ON pr.id = pu.property_right_num_id AND pr.is_deleted=0 AND pu.is_deleted=0
根據條件批量刪除get
LambdaUpdateWrapper<Property> deletePropertyWrapper = Wrappers.<Property>lambdaUpdate(); deletePropertyWrapper.in(Property::getOrgId, orgIds).eq(Property::getPropertyType, 1); int unitRow = baseMapper.delete(deletePropertyWrapper);