MYSQL语句,还不会写SQL?来我教你!

一、查询语句

mapper

List selectGroupDevice(@Param("groupDeviceDto") GroupDeviceDto groupDeviceDto, @Param("domainId") Long domainId);

xml

    

二、添加

1.一个字段批量添加

mapper

Boolean insertGroupDevice(@Param("physicalDeviceId") List physicalDeviceId, @Param("domainId") Long domainId, @Param("groupId") Long groupId);

xml

insert into device_group_relation (group_id, domain_id, physical_device_id, bind_time)
        VALUES
        
            (#{groupId},#{domainId},#{device},now())
        

三、删除

1.批量删除

mapper

Boolean deleteDevice(@Param("groupDeviceDto") GroupDeviceIdDto groupDeviceDto);

xml

   delete
        from device_group_relation
        where group_id = #{groupDeviceDto.groupId}
        and physical_device_id in
        
            #{physicalDeviceId}
        

你可能感兴趣的:(基础,数据库,sql,数据库)